If you are using Classic Dashboards, you can do this by having a hidden multivalue item for each element you want coloured. You would set this up based on the value of the other fields. You can then use standard field colouring to colour the fields based in the (hidden) value
Can u provide a code example ?
I have shown this many times in the past - here is one example - hopefully you can get what you need from it