I create two expression tags for mode and status of devices which are string tags. Then I set these to their descriptive status.
I then use the descriptive tag everywhere for bindings etc so that the states are completely unambiguous and easy to know exactly what the expression is doing. It also means, if for some reason another device is created that doesn’t have the same logic and states (for example if the plc has an integer that represents the status as 0-closed,1-closing, etc) then it doesn’t matter, you can continue to use your templates regardless as their descriptive status remains unchanged. It’s a way of abstracting your plc logic from your gui objects.
I’m going to assume you’re using Vision. For the actual animation of colours, for Vision I define colours in Vision Client Tags which are essentially client-scoped internal memory tags. These should be set to strings and their values set either to an RGB e.g. ‘color(R, G, B)’ or to a hex e.g. ‘#F68C5A’ colour. Unfortunately the human interprettable colour model (HSL) isn’t supported
I would define colours for device states: off, on, faulted, etc.
Then in your graphic, I use an expression binding for the colours that references those client tags: