I’m looking for how can i change the color of an event, and I’m seeing in the doc that i have to define a css class for each color i want and load it with scheduler.templates.event_class. The problem is that in my case, my datas have a custom field with the hex color code, and so it can be any color, and it’s not possible to create a class for each color i find (atleast 30)…
Is there an easier way to set the event color, like after loading event, setting event.color = red or anything… ?
If i’ve missed a post or a doc already existing, i’m sorry, else thanks a lot !
Unfortunately there is no direct mapping for color property of event.
Currently the only way to achieve such mapping is the custom code modification.
Next feature is not documented one, and probably will not work for all modes as well as may be not supported in next versions
event._text_style - value of this property will be added to the style string of event.
so you can set it ( from onEventLoading handler for example ) with necessary styling.
By the way - it possible to create css classes dynamically, similar to samples\02_customization\01_events_coloring.html - so any count of colors can be supported through css classes.
Ok i added this code and works only in month view, which does not change event color on others views, especially on week one. I’m going to try to add dynamically css class from an array of colors…
In case of week and day week, the style is set on top level container, while default css rules defines color for inner elements, which overrides your styling.
Basically you can remove from dhtmlxscheduler.css default color values , but it still not very reliable solution.