Best way for colours is either using client tags to store hex colours as strings, or using a project library to store colours as strings in a library variable, and retrieving these in your bindings using runScript.
However, I would recommend also using a dataset tag (or script dictionary) to store lookup values against colours to use, and then use this in your component bindings to get the colour.
For example, I have a status desc tag in all of my device udts which is an expression tag using case
to get the status of the device as a string (Running, Stopped, Faulted, etc). Then my dataset tag has columns value
and styleClass
(perspective, but you can do similar for Vision).
Then my binding to get the colour is:
Lookup({System/Datasets/Style Classes/Device Status}, {status desc tag path}, '', 'value', 'styleClass')
This way essentially templates your map transforms and allows your maps to reside in a single place, rather than having a gazillion magic case statements everywhere doing colour mapping. Of course, in Vision it's slightly less nice if you use a dataset tag, as your colours will still be magic. But at least you will have far fewer copies and youll know they're all just inside of the few dataset colour maps that you have
Example data in the dataset:
value, colour, styleClass
"Running", "0, 255, 0", "Device/Status/On"
"Stopped", "128, 128, 128", "Device/Status/Off"
You would probably use the java.awt.Color data type for the colour column