I am wondering how to revert colors to the default theme colors.
I have a binding on textStyle.color, when there is a alarm state I set the color to red using a “if true then map to ‘red’ “.
My question is how do I revert this to a theme color? Obviously mapping it to black or white would work only when the user is on the “correct” theme.
I tried “default” and that does not seem to work it just holds the red after the alarm has cleared.
The proper CSS way to do this would be to create a Perspective style class alarmState where you set the text color. Rather than red I would use a built-in theme color --error. When using this in your style class you will use the var(--error) syntax.
Then create an expression binding on the label's style.classes:
if(
{[default]myAlarm}, // replace with your alarm indicator.
'alarmState',
''
)
This will change with theme selection to match everything else which you will naturally have defined with theme colors (won't you?).
1 Like
Thanks, while messing with that I also learned you can go to Map and change the output types which includes a selection for style class.
1 Like