Threshold sensor badge color

I made several threshold sensors.
I made them into a badge, hoping that i can see the status on a glance, but unlike other “normal” sensors, I can’t figure out how to get the color of a threshold sensor to change

any help?

I have this

- entity: binary_sensor.dishwasher_on
    style: |
      @keyframes blinker { 50% { opacity: 0; } } :host {
        {% if is_state('binary_sensor.dishwasher_on', 'powered') %}
          --label-badge-red: red;
        {% else %}
          --label-badge-red: yellow;
        {% endif %}