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-Calendarext3 eventTransformer

    Scheduled Pinned Locked Moved Solved Troubleshooting
    4 Posts 2 Posters 878 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.
    • B Offline
      bicolorbore586
      last edited by

      So, I’ve copied the code, but wondering how to add more than 1 event title / colour combination, eg John = Blue for the example below, but how would I get John=Blue, Steve=Green, Sandra=Orange, I’ve tried copying and having a separate line for each, but that results in none of the events having colours.

      eventTransformer: (ev) => {
      if (ev.title.search(‘John’) > -1) ev.color = ‘blue’
      return ev
      }

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @bicolorbore586
        last edited by sdetweil

        @bicolorbore586

        if… color blue
        else if… color red
        else if … color green

        return

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        B 1 Reply Last reply Reply Quote 1
        • B Offline
          bicolorbore586 @sdetweil
          last edited by

          @sdetweil Legend!

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @bicolorbore586
            last edited by

            @bicolorbore586 after u get above three if/else, in my opinion it’s better to use a switch/case clause

            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