Setting the state color for a template sensor

With the new state colour released in 2022.12 I had the idea to change the colour of a template sensor based on its sign (-‘ve, +’ve).

This mini graph card displays a template sensor which is a simple sign reversal of the original sensor, but setting the config to show the state colour just shows the original blue of the sensor. I’d like to change it red for negative values, i.e. when the battery is losing charge to help the family see that they’re using more power than is being supplied by solar.

The template config in template.yaml is:

- sensor:
    - name: my_home_battery_power_neg
      state: "{{ - ( states('sensor.my_home_battery_power') | float ) }}"
      unit_of_measurement: W

I was thinking to add a line to the config such as:

state_color: if … return: red
etc.

Does anyone have feedback on how this new state colour can be used by us mere mortals?

Same here, I really want to be able to set the color for my wind direction sensor (which translates compass points to N, NNE, NE, ENE, etc). Right now they have very random colors, which isn’t useful in my history-graph, it would be nice to be able to control the colors to get a better sense for what the wind is doing.

Edit I just found the docs that explain how to control this. It’s not as clean as attaching it to the template, but hopefully I can make this work.