I may not be looking with the right search terms, but I’m having a hard time finding the best practice for storing a set of custom colors by name to be able to use them project wide across my vision screens.
How can I best setup and store definitions such that I can tell my project that OD_BG1 is #002b36 and then be able to set object color properties in Vision to be OD_BG1 and have them show that hex code?
We’re going to be releasing a module in the next couple months that does exactly this!
It’ll support defining named colors (tokens), which can have a unique value for a given theme. There can be multiple themes for a project which can be swapped on the fly. A theme is a collection of color ramps organized to form a palette.
Tokens can either reference palette colors from a theme, or can reference other tokens (with optional palette or key shifts) in order to create a hierarchy.
And thanks to caching/avoiding Jython interpretation performance is much better than client tag/script module color storage options.
Stay tuned for more info, there should be a public beta coming soon!
5 Likes
In the meantime…
You can make a 2-column dataset memory tag
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/0/2/022d13d01b24450a5e4e7ee063be01530d234b91.png)
Put a custom property on the component (My example uses ‘colorName’)
Bind the component colors using a lookup expression.:
toColor(
lookup({[Test]ColorTable},
{Root Container.Rectangle.colorName},
'#A0A0A0',
'colorName',
'hexVal'
)
)
Thanks Jordan, that makes a lot of sense. What’s my best bet for being able to centrally create and manage that memory tag? Can I stick the datasets somewhere in an inheritable project so that I can use this across projects and gateways?
If it’s in a tag, it will already be global.
@bmusson Looking forward to seeing what you’ve got.
EDIT: The obvious exception to this is if you put it in a client tag.
@JordanCClark Some screenshots to build hype
(Also, I'm a big fan of the Mineral UI design system)
So for general timeline: the design interface for tokens (including relative references with the common [.]
syntax) is the only thing that needs wrapped up before the beta. Then between the beta and the full release I'd like to implement a "Theme Browser" for drag/drog designing in Vision.
5 Likes