aldabil21 / react-scheduler

React scheduler component based on Material-UI & date-fns
The Unlicense
353 stars 127 forks source link

Set color of events #279

Closed atheck closed 9 months ago

atheck commented 9 months ago

Hi, first of all: Thank you for your work.

I use the color property of the events to have different colors for different types of events. The default renderer correctly uses this property as background color. But I can't change the text color accordingly. I use a custom eventRenderer to solve this issue. But since I can't override rendering multi day events or events in month view, I can not fix the text color there.

Is there a solution to this problem?

I think the following line needs to be changed for custom colors:

https://github.com/aldabil21/react-scheduler/blob/23b93c739d63ae3bb44766092f9cd7ab5804256e/src/lib/components/events/EventItem.tsx#L249C15-L249C15

Maybe introduce a textColor property on the event or call a function to get the contrast text color (from the MUI theme).

aldabil21 commented 9 months ago

Thx for reporting in next release you can use textColor as hex or palette.path

atheck commented 9 months ago

Thank you! I'll try it soon.