It's going to depend on the environment in which your code runs, the presentation language(s) you are using, and the framework under which that operates.
For C# and WinForms, this may help:
Colouring DataGridView Cells According to their Content in WinForms[
^]
Probably, a similar technique is applicable for other systems, but without much better data we really can't be specific!