Alternating colors with an expression

Good day! What bit of code to I add to make colors alternate(like flashing) when an expression is true. here is my base code.
image

It currently only displays red, but i would like add a yellow alternate in it.

thanks you

Possible the simplest flasher is
if(dateExtract(now(100),'ms')>500,<true condition>,<false condition>)
or
if(dateExtract(now(100),'sec')%2,<true condition>,<false condition>)
depending on the frequency you want.

Note: If you have more than one component flashing this way, they won’t be particularly synchronized, which I think looks ugly. I generally make a flasher property with one of the above bindings at the highest level it makes sense (depends on if you’re going to have embedded views or not) and use that in the if statement instead.

1 Like

You can use css. Try playing with this to find the settings you want:

This alternates between a background color set on an element, and the background color set on this class (here yellow).

2 Likes

How do I get to the style classes?

You can create style classes by adding styles in that folder:

image

Thanks alot. I have my style set up and running now. Big help