Change badge color mushroom


How do I change the badge color based on state? as I do on primary information?

exactly the same way you would a normal icon or state.

type: custom:mushroom-template-card
primary: Hello, {{user}}
secondary: How are you?
icon: mdi:home
badge_color: |-
  {% set state = states('sensor.pond_pumps_power')|float(-1) %}
  {% if state >= 150 %} green
  {% else %} grey
  {% endif %}
icon_color: ''
badge_icon: mdi:home

or

type: custom:mushroom-template-card
entity: switch.4ch_relay_bridge_light
layout: vertical
badge_color: |-
  {% set state = states('switch.4ch_relay_bridge_light') %}
  {% if state >= "on" %} green
  {% else %} grey
  {% endif %}
icon_color: ''
badge_icon: mdi:home
icon: mdi:home

I tried this:
image
but it doesnt work. Im doing it with a template card but the icon doesnt change.
Even trying putting green or other color doesnt work

your screenshot doesn’t have an Icon in the badge icon section.
you need

badge_icon: mdi:home

without a badge icon it has nothing to show