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.
How to change colors of grid elements
Hello,
I'm trying to figure out how to make different lines in a grid to be different colors. If possible, I would like the color of the grid elements to be based on the content of the element. (For example, "Square" is green, "Circle" is blue, ...)
What would be the best way to do this?
Check documentation for RowStyleGenerator
Create your own style generator by extending this interface and overriding the getStyle()
https://vaadin.com/api/7.7.7/com/vaadin/ui/Grid.RowStyleGenerator.html
And the set it as your RowStyleGenerator in your Grid
https://vaadin.com/api/7.7.7/com/vaadin/ui/Grid.html#setRowStyleGenerator-com.vaadin.ui.Grid.RowStyleGenerator-
And finaly define something suitable in your theme for the stylenames you return with getStyle()