Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calendar - setColor with no CSS edition
Hi,
Does somebody have an elegant (or even not !) solution to set a task-color in the Calendar component ?
We can do that with some CSS edition, but it's a big limit.
The current case : each user can select its own color with ColorPicker component, this color should be the one in use in the calendar for their tasks.
Regards
Sebastien
You can store the color in the database and inject it as a CSS rule with Page.getStyles().add(). You can do this also dynamically with the ColorPicker when the user is choosing the styles.
Good example of this using the ColorPicker https://vaadin.com/wiki/-/wiki/Main/Dynamically+injecting+CSS