Modify the background color of a perspective column container

Hello all
I am trying to modify the background color with a bit. I have already made the style for the background but i dont see any place in the root to put the bit.
Should i create the root variable? Should i make other view and use a rectangle or something like that?


If i click “Ok”
The style gets like this…

Your expression is a direct equality comparison. Assuming you want a style named “Alarmbackground” to be applied when the tag in your screenshot has a value of 2, then you want an expression like this:

if ({[default]TagPath/tagName.value} = 2, "alarmBackground", "")

In this expression, if the alarm has a value of 2, then “Alarmbackground” is supplied by the expression, else an empty string is applied.

2 Likes

Been bashing my head for a few hours trying to do this

Tried multiple props on multiple different containers/elements using both style classes and directly feeding the backgroundColor with color(R,G,B). (Note: I can see the value change as expected in the designer PROP window)
image

I finally got it working if I return “#FF0000” or “#FFFFFF” from my expression (or from my style [note I was using 255,0,0 in the style which also shows red]) directly onto the backgroundColor PROP.

Regards
Dave

Perspective (HTML,CSS) expects a string in either a hex format or rgb(r,g,b) format. Your (now removed) images shows you were using a color expression, which returns a java.awt Color object, which will only work in Vision Clients.

As for the Style you’re trying to use, the Style Editor is doing its best to figure out what you’re trying to do and provide a preview, but it’s doing too much and making it look like the value you’re providing is valid. The Design panel - which is behaving like a Session would - is ignoring the property because the value is invalid:
Screen Shot 2022-07-15 at 7.25.50 AM