Skip to content

Commit

Permalink
Update CARD-MOD-EXAMPLES.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusthvdb authored Nov 29, 2023
1 parent c214c0f commit e764461
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions CARD-MOD-EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ card_mod:

Set both icon and icon_color:
```
entity: input_select.tts_gender
card_mod:
style: |
:host {
--card-mod-icon:
{% set gen = states(config.entity) %}
{{'mdi:human-female' if gen == 'Female' else 'mdi:human-male'}};
--paper-item-icon-color:
{% set gen = states(config.entity) %}
{{'maroon' if gen == 'Female' else 'dodgerblue'}};
}
entity: sensor.zigbee_connectivity
card_mod:
style: |
Expand All @@ -72,6 +84,27 @@ card_mod:
--paper-item-icon-color:
{{'green' if con == 'connected' else 'maroon'}};
}
entity: input_number.intercom_volume
card_mod:
style: |
:host {
--card-mod-icon:
{% set vol = states(config.entity)|float(0) %}
{% if vol == 0.0 %} mdi:volume-off
{% elif vol <= 0.3 %} mdi:volume-low
{% elif vol <= 0.6 %} mdi:volume-medium
{% else %} mdi:volume-high
{% endif %};
--paper-item-icon-color:
{% if vol == 0.0 %} gray
{% elif vol <= 0.3 %} dodgerblue
{% elif vol <= 0.6 %} green
{% elif vol <= 0.8 %} orange
{% else %} red
{% endif %};
}
# note you only need to set the intial variable `{% set con = states(config.entity) %}` once, and it is used in both mods!
```
Set an icon_color in an auto-entities card:
Expand Down

0 comments on commit e764461

Please sign in to comment.