@suspect24 Here is how I implemented the transform function.
Background: my daughter plays on a softball team that contains the word “Panic”. I want to change the background color to match the team color and I want to include a softball icon for the event.
I add the following code to the defaultSet section in MMM-CalendarExt2. This means every time the word “Panic” is found in an event title that the commands following are executed.
Note: I have an If…else If structure here so I can actually transform a number of items.
defaultSet: { calendar: { maxItems: 500, scanInterval: 1000*60*1, beforeDays: 5, afterDays: 60, maxIterations: 100, }, view: { timeFormat: "h:mm A", transform: function(event) { if (event.title.search("Panic") > -1) { event.icon = "noto-softball"; event.className = "view_panic"; } else if (event.title.search("Arin") > -1) { event.icon = "noto-softball"; } else if (event.title.search("Violin") > -1) { event.icon = "emojione-monotone:violin"; } return event; }, }, scene: {} },Now that I have assigned a className object to the events that contain the word “Panic” I can use that object in the custom. css file.
.CX2 .event.view_panic { background-color:rgba(139,0,139,1); }There may be other ways to do this but this one worked out well for me.