How do I combined two styles in a single Grid cell?

I’ve tried different methods posted here and StackOverFlow and none seem to work. I basically have the following CSS:

.v-grid-cell.cellBackgroundColor {
	background-color: red;
}

.v-grid-cell.cellfontColor {
	color: green;
}

And for the code I have:

addColumn(MyData::getValue)
	.setStyleGenerator(data -> "cellBackgroundColor cellFontColor");

All this seems to do is use the last style and ignore the first one. I then saw [this post which suggested putting a period between the two styles]
(https://vaadin.com/forum/thread/15553757) but that didn’t work either.

Basically how can I combine two different styles? And in case you’re wondering why I’m not doing it in css it’s because the combination is due to logic in the code which is not included in the sample code to simplify it.

Yes, there are some limitations with CSS and stylenames here. The better approach would be the following on CSS side:

.v-grid-cell.my-cell-style {
	background-color: red;
    color: green;
}

And in Java side:

addColumn(MyData::getValue)
	.setStyleGenerator(data -> "my-cell-style");

The problem with that approach is that it’s a conditional combination of css styles and there are a lot permutations. I’m basically looking at over 500 possible permutations…