Giving color to cells in a Grid (version 7.4.1)

How can I give color to empty cells in vaadin grid(version 7.4.1) ?
I tried the following code:
grid.setCellStyleGenerator(new Grid.CellStyleGenerator() {
@Override
public String getStyle(CellReference cellReference) {
if(null==cellReference.getValue()){
return “red”;
}else{
return null;
}
}
});

in .scss

.v-grid-cell.red {
color: red;
}
This is not working.

The CSS attribute “color” defines the color of the text. So your code is working, but you define that the text within the cell should be red. Since you apply the color only to cells whose content is null, you obviously won’t have any text in the cells that would get the color red.

If you want the background of the cell to be red, then change the attribute from “color” to “background-color”.