custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.83k stars 227 forks source link

Filter styles for states #797

Open piotrmarczewski opened 7 months ago

piotrmarczewski commented 7 months ago

Checklist

Describe the bug When using style for a state, the filter it applies (to change the color of the entity_picture) does not automatically work. They only work after refreshing the browser or entering YAML editing and saving again. If I use a filter with the opacity([X]) value, they work without any problems.

Version of the card Version: v4.1.1

To Reproduce This is the configuration I used:

type: custom:button-card
entity: switch.uruchom_uspij
show_name: true
show_icon: false
show_entity_picture: true
show_state: true
tap_action:
  action: toggle
state:
  - value: 'on'
    styles:
      entity_picture:
        - filter: >-
            invert(85%) sepia(15%) saturate(6043%) hue-rotate(351deg)
            brightness(101%) contrast(104%) opacity(100%);
  - value: 'off'
    styles:
      entity_picture:
        - filter: >-
            invert(37%) sepia(76%) saturate(343%) hue-rotate(167deg)
            brightness(96%) contrast(88%)

Expected behavior I expected that the button color changes when the button state changes.

Desktop:

Smartphone: