MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-CalendarExt3Journal - How to set colors for calendars?

    Scheduled Pinned Locked Moved Solved Troubleshooting
    4 Posts 2 Posters 266 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N Offline
      nobbistyles
      last edited by

      I’m new to MM2 and tried to find a clear answer to my question but was not really able to find it.

      The Goal is a Senior-Calender for my very old parents with dementia showing only those informations they need. The calender “Abfall” and “Feiertag” should have a white background, “Mom” should be yellow, dad should be “green”.

      I used the standard calender app to define my calenders, set background colors but they don’t appear in Ext3Journal. I also tried to work over the eventTransformer function with symbol but this also didn’t work (maybe my syntax was wrong because everything appeared in the first defined color).

      Attached my current config.js:

      /* Config Sample
       *
       * For more information on how you can configure this file
       * see https://docs.magicmirror.builders/configuration/introduction.html
       * and https://docs.magicmirror.builders/modules/configuration.html
       *
       * You can use environment variables using a `config.js.template` file instead of `config.js`
       * which will be converted to `config.js` while starting. For more information
       * see https://docs.magicmirror.builders/configuration/introduction.html#enviromnent-variables
       */
      let config = {
      	address: "localhost",	// Address to listen on, can be:
      							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
      							// - another specific IPv4/6 to listen on a specific interface
      							// - "0.0.0.0", "::" to listen on any interface
      							// Default, when address config is left out or empty, is "localhost"
      	port: 8080,
      	basePath: "/",	// The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
      									// you must set the sub path here. basePath must end with a /
      	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],	// Set [] to allow all IP addresses
      									// or add a specific IPv4 of 192.168.1.5 :
      									// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
      									// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
      									// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
      
      	useHttps: false,			// Support HTTPS or not, default "false" will use HTTP
      	httpsPrivateKey: "",	// HTTPS private key path, only require when useHttps is true
      	httpsCertificate: "",	// HTTPS Certificate path, only require when useHttps is true
      
      	language: "de",
      	locale: "de-DE",   // this variable is provided as a consistent location
      			   // it is currently only used by 3rd party modules. no MagicMirror code uses this value
      			   // as we have no usage, we  have no constraints on what this field holds
      			   // see https://en.wikipedia.org/wiki/Locale_(computer_software) for the possibilities
      
      	logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
      	timeFormat: 24,
      	units: "metric",
      
      	modules: [
      		{
      			module: "alert",
      		},
      		{
      			module: "updatenotification",
      			position: "top_bar"
      		},
      		{
      			module: "clock",
      			position: "top_left"
      		},
      		{
      			module: "weather",
      			// position: "top_center",
      			config: {
      				weatherProvider: "openmeteo",
      				type: "current",
      				lat: ?,
      				lon: ?
      			}
      		},
      		{
      			module: "weather",
      			// position: "top_right",
      			header: "Wetter Vorhersage",
      			config: {
      				weatherProvider: "openmeteo",
      				type: "forecast",
      				lat: ?,
      				lon: ?			}
      		},
      		{
      			module: "calendar",
      			header: "Kalender",
      			// position: "top_left",
      			config: {
      				coloredBackground: true,
      				calendars: [
      					{
      						fetchInterval: 7 * 24 * 60 * 60 * 1000,
      						symbol: "calendar-check",
      						url: 'webcal://localhost:8080/modules/ical/Abfall2025.ics',
      						name: "Abfall",
      						bgColor: '#FFFFFF'
      					},
      					{
      						symbol: "calendar-check",
      						url: 'webcal://localhost:8080/modules/ical/feiertag.ics',
      						name: "Feiertag",
      						bgColor: '#FFFFFF'
      					},
      				    {
      						fetchInterval: 1000 * 60 * 1,
      						symbol: "fa-solid fa-venus",
      						url: "google cal mom",
      						name: "mom",
      						bgColor: '#FFFF00'
      					},
      					{
      						fetchInterval: 1000 * 60 * 1,
      						symbol: "fa-solid fa-mars",
      						url: "google cal dad",
      						name: "dad",
      						bgColor: '#00FF00'
      					},
      				]
      			}
      		},
      		{
      			module: "MMM-CalendarExt3Journal",
      			position: "middle_center",
      			config: {
      						height: '50vh',
      						width: '100%',
      						locale: 'de-DE',
      						staticWeek: false,
      						staticTime: true,
      						days: 7,
      						hourLength: 12,
      						beginHour:  8,
      						dateHeaderOptions: {
      							day: 'numeric', 
      							weekday: 'long'
      						},
      						calendarSet: ["Abfall", "Feiertag", "mom", "dad"],
      					}
      		},			
      	]
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") { module.exports = config; }
      
      

      Perhaps someone can point me in the right direction?

      S 1 Reply Last reply Reply Quote 0
      • S Away
        sdetweil @nobbistyles
        last edited by sdetweil

        @nobbistyles in MagicMirror calendar its just color, not bgColor. you are changing the color of the text, not the background

        then Ext3 will pick that up

        ext3 eventTransformer is a routine that gets passed every event

        eventTransformer:  (evt)=>{
           if(evt.?????){ // check event field for needing to be changed
               //do something to this event
           }
          //return the modified evt
          return evt
        }
        

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        N 1 Reply Last reply Reply Quote 0
        • N Offline
          nobbistyles @sdetweil
          last edited by

          @sdetweil
          Thank you.

          Finally I solved it with:

          eventTransformer: (ev) => {
          							const customEvents = [
          								{ keyword: "Mum", symbol: ["fa-solid fa-venus"], color: "yellow" },
          								{ keyword: "Dad", symbol: ["fa-regular fa-mars"], color: "green" },
          							]
          							const found = customEvents.find((condition) => {
          							return ev.title.search(condition.keyword) !== -1
          						})
          						if (found) {
          							ev.icon = [ found.symbol ]
          							ev.color = found.color
          						}
          						return ev
          						},			
          					}
          
          S 1 Reply Last reply Reply Quote 0
          • N nobbistyles has marked this topic as solved on
          • S Away
            sdetweil @nobbistyles
            last edited by

            @nobbistyles cool

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy