Calendar colors

How I can set the background color of the events on the widget calendar to change based on state of the event? Or what it’s the same, associate a color with a state.
Thanks

The calendar view accepts a field name as backgroud color (this is explained on our documentation)

If you want to make it change based on the state you should create a function field that returns the color name based on the state of the record and use this name as background color of the calendar view.