Conditional color - What is correct formula syntax?

I have a vertical nav menu element (made from scratch). When a user selects an item (category), I want that menu item’s div to be a specific color. The attached image shows my current formula (which isn’t working). Can someone please give me the correct formula syntax for a conditional color? Thanks!

You need to wrap background color css “into quotes first”.

If you bind a color the value should be a string with a valid css color. Something like "red" or "#00ff00 ecc.
Don’t add the css property, bind the right option in the editor, for example the text color or the background color.

thanks for you replies @Broberto and @dorilama . I’m a noob, and don’t know css and I’m not a programmer, and I don’t understand your answers. Can either of you kindly re-write my formula correctly (verbatim)? If so, thanks in advance!

Hi @fredo22
You need to output a string with a color value, so in your case “#74992E” directly. Also, you need to have an option for when “selected_admin” is false. It looks like this:

image

A better approach would be to use your pre-defined project colors:

This way, if you need to change your colors later, you don’t have to adjust all your formulas.

Best,
Max

1 Like

Thanks @Max - Much appreciated! The solution is so much simpler than I imagined :slight_smile:

1 Like