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()