#Change Badge Icon/Text Color with card_mod?

1 messages · Page 1 of 1 (latest)

raw raft
#

So recently I'm starting to dive more and more into customization and really loving the options with card_mod. But I'm having a hard time with trying to set the Icon and/or Text Color of a Badge through card_mod.

For example, the following Badge:

badges:
  - type: entity
    show_state: true
    show_icon: true
    entity: person.john_doe
    state_content:
      - name
      - state
    name: John
    color: state

With the help of Claude AI, I tried adding card_mod on this one as followed, but it didn't do anything.:

    card_mod:
      style: |
        :host {
          {% if is_state('person.john_doe', 'home') %}
            --ha-badge-color: green !important;
            --ha-badge-text-color: green !important;
          {% endif %}
        }
edgy quarry
#

Maybe try Mushroom Template Cards. They can be manipulated easily.
I set one up to only show the badge if a light is on.

#

No need for Card-Mod

frank echo
#

@raw raft Did you manage to solve this? I'm having troubles as well..

mint swift
#

Bagdes can't be styled with card_mod (yet). The pulled 3.5.0 version was able to do that but broke too much other things which is why it was pulled. V4 beta will be available soon which will allow badges to be styled with card_mod.