Nerwyn/service-call-tile-feature

Separate spinbox icon-colors

Closed this issue · 1 comments

I'm looking to colour the main icon only and leave the increment/decrement icons default. Could this be achieved by adding icon-color: to the increment and decrement elements and using the root one to relate to the central icon?

code example of what I'm trying to do:

        icon_color: >-
          {% if state_attr("climate.r07_c01_ac", "current_temperature") > (state_attr("climate.r07_c01_ac", "temperature") - 1) and state_attr("climate.r07_c01_ac", "current_temperature") < (state_attr("climate.r07_c01_ac", "temperature") + 1) %}
            green
          {% endif %}

results:
image

A few things:

  • icon_color is deprecated, it internally remaps to style.--icon-color.
  • style.--icon-color sets a general icon color which will apply to this element and any sub elements, like the increment and decrement buttons.
  • To set a color to the center icon more directly in such a way that it doesn't affect the increment and decrement buttons, use icon_style.color.
  • You can change the styles of the increment and decrement buttons by setting increment/decrement.style/icon_style.
icon_style:
  color: red
decrement:
  icon_style:
    color: blue
increment:
  icon_style:
    color: green