MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    *REQUEST* how to make calendar event colored according to title string found?

    Custom CSS
    2
    3
    103
    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.
    • M
      M1st3r-E last edited by

      using MMM-CalendarExt2 (but im sure some things are done the same…)
      so i was able to add multiple calendars but one specific calendar is a “shared” calendar and cannot use the option --> .CX2 .event.sharedCalName and assign a color as all events will grab this same color… i found that .event.[data-calendar-name=“xx”] works for specific Cal names but this is by calendar… i want to do this by calendar event and cannot find the appropriate string… does this option even exist? if so, can someone provide it? i.e. for calendar event starting with “E:” color blue while events starting with “M:” color pink, etc… tnx

      M 1 Reply Last reply Reply Quote 0
      • M
        MMRIZE @M1st3r-E last edited by MMRIZE

        @M1st3r-E
        You can use transforming in view configuration.

        transform: (event) => {
          if (event.title.search("Birthday") > -1) { // If the event might include "Birthday" in its title,
            event.className = "BirthdayTitle"; // Assign new CSS class name of that event to "BirthdayTitle"
          }
          return event; // Return that event.
        };
        

        event object could have these properties;

        calendarId: 1;
        calendarName: "Tottenham";
        className: "mySoccerClass";
        description: "FA Cup, round 3";
        duration: 7200;
        endDate: "1546638300";
        endDateJ: "2019-01-04T21:45:00.000Z";
        icon: "noto-soccer-ball";
        isFullday: false;
        isMoment: false;
        isOneday: true;
        isPassed: false;
        isRecurring: false;
        isCancelled: false;
        location: "";
        startDate: "1546631100";
        startDateJ: "2019-01-04T19:45:00.000Z";
        title: "Team T.B.A. - Tottenham Hotspur";
        uid: "1:1546631100:1546638300:op54vk5s1r0ivl8i165ampip88@google.com";
        ms_busystatus: "BUSY"; // Only for calendar from MS Outlook. Available : "BUSY", "FREE", "TENTATIVE", "OOF"
        
        M 1 Reply Last reply Reply Quote 0
        • M
          M1st3r-E @MMRIZE last edited by

          @MMRIZE tnx alot mate

          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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy