Avec card_mod ça l’air de fonctionné :
- type: state-icon
style:
left: 56%
top: 54%
entity: light.0x00158d0002e75493
icon: mdi:lightbulb
tap_action:
action: toggle
state_color: false
card_mod:
style: |
:host {
--card-mod-icon-color: {% if states('light.0x00158d0002e75493') == "on" %} black {% else %} white {% endif %};
}
ou plus simple:
- type: state-icon
style:
left: 56%
top: 54%
entity: light.0x00158d0002e75493
icon: mdi:lightbulb
tap_action:
action: toggle
state_color: false
card_mod:
style: |
:host {
--card-mod-icon-color: {% if states(config.entity) == "on" %} black {% else %} white {% endif %};
}