Is there any way to get a parameter into the css?

I wanted to make a variable indicator to show a dimmer level. I was going to use a css “progress bar” type construct, but I would need to be able to get the level variable into the css. Can that be done?

I’d really like to do this too. I’d like to show light bulbs with the rgb colour value. Can’t think of a way to do this without a parameter.

2 Likes

Hmm can’t you do this like this but using the brightness attribute in the floorplan.yaml…
I use this to change the color of my plants when they have less than 10% moisture

class_template: '
      var temp = parseFloat(entity.state.replace("%", ""));
      if (temp <= 10)
        return "plant-dead"; <-------- where these are different brightness levels/colors/transparency in the css file
      else
        return "plant-watered";
      '
1 Like