If a theme selection has to be provided for users between light and dark modes in vision, What will be the best way? Our vision project includes nearly all components in ignition vision module.
Unlike perspective where css styling is directly applied for a component, Does vision components have something related to themes ?
How I though so far is, to pass in colors via tag to each component on screen ?
Are there any easy methods / Different approaches for this ?
I use client tags for this and store the colour values in hex or as “color(123,234,231)”. You could have light and dark folders of colour tags and then a ‘selected’ folder which references one of the two theme folders.
I store all my colors in script modules, inside helper classes.
Basic gist:
Groups of colors make ColorRamps (eg. blue10 to blue100), groups of ColorRamps make a ColorPalette (eg. high-performance, saturated, etc.), ThemeTokens reference colors from a ColorPalette (eg. “process/state/transitioning” = blue40), and finally groups of ThemeTokens make a Theme (eg. light, dark, colorblind, etc.). Then component templates can use ThemeTokens from the active theme for styling.
Themes can be swapped by either changing the active palette or theme, and client color change requests become 10 second fixes.
We are already doing this but.,
Considering the screens have tables and trends, The axis, border and chart colours can become tricky right? Any suggestions.
The idea is very abstract for me to understand, Still i will try my level best to understand this.
If possible, can you help me with some screens shots and snippets.
That will be more helpful. Thanks.
A ThemeToken holds subtokens (nested ThemeTokens) and values (colors), which are both referenced by string keys. It’s basically a fancy nested dictionary.
Take alarms for example; we have tokens for critical/high/medium/low/diagnostic, foreground/background color, and primary/secondary for flashing.