You could use “generated columns”, generate Label components in the generator and assign any CSS you want with io.jmix.ui.component.HtmlAttributes bean.
Note that structure of the Vaadin component can be complex - it can consist of several html “div” elements, and all of them inherit some styles from the theme, so assigning just one CSS for the parent component could appear to be not enough.
Personally I have implemented similar requirement in my CUBA project in the past.
I preferred to use limited number of colors and CSS styles.
Used color picker component only with the “swatches” tab enabled, so users could only choose one of preconfigured colors.
Created a CSS style in the theme for each of the colors. For example for Table:
thanks for your reply.
When I apply the background color css to the component of the DataGrid it only colors the label background but not the grid cell. Additionally the text position with Label component renderer is different than with default text renderer.
Perhaps we can use that somewhere else. For this data grid we will use some predefined styles.
I am using EntityComboBox listing thousands of colors. I would like to color the background of each color to make selection visually easy. Using StyleProvider would require to define all the colors in the SCSS. Is there a way to do it without defining all the colors in the CSS file?