Hard to answer without knowing what your colors are based on.
In QS you can build an expression to control the background color and text colors in each cell. You go to edit mode and then expand the dimension or measure properties and add an expression for the colors.
But I would really need a better idea of what you are doing to give you any better answer than that.
Thanks for the help Mark. I guess I am taking for granted that this is an "easy" thing to do in other programs like Excel, Google DataStudio, etc ..
I followed the post below and created three variables which I then used in a background color expression. Very cumbersome process to get what I feel is a simple results.