Changing Color based on a variable

Hello Community, I am currently trying to change the color of an element depending on a variable. For example, if value x is over 90%, the color should become green for 80% Yellow and 70% and below red, just like at a traffic light. I did a little searching and found the following snippet.  But I'm unsure if this will help me. Is there a kind of traffic light which can show different statuses or can I solve it differently. Thank you
1 answers

You could use the widget, but for a simple traffic light with three options you could also opt for three different containers with conditional visibility based on the percentage, inside these containers you have the correct traffic light pictures or css classes.
It may not be the most pretty option, but it's a bit more visual than a custom widget.

Let me know if it solved your issue. :)