Entity remove icon and change text color on sensor state

Hi All,

I need some help getting my entities list items to remove the icon so I have more space for the entity description. Then I also want the entity text color to change based on sensor status. In my case, the sensor values are ‘up’ or ‘down’.
I have found a way using card_mod to remove the icon.
Then I found a way to change the text color based on state.
But I haven’t found a way to implement both of these features together. I can only have one or the other at the moment.

type: entities
entities:
  - entity: sensor.uptimekuma_my_diskstation
    style: >
      :host { 
      color: {% if is_state('sensor.uptimekuma_my_diskstation', 'down') %} red
      {% else %} green {% endif %};

With the above code, the text color does change based on the sensor status.

I added this code to remove the icon.

card_mod:
      style:
        hui-generic-entity-row:
          $: |
            state-badge {
              display: none;
            }

This did remove the icon, but it disable the text color change based on state. Text is now white.

Here is how I have the code with both pieces.

type: entities
entities:
  - entity: sensor.uptimekuma_my_diskstation
    card_mod:
      style:
        hui-generic-entity-row:
          $: |
            state-badge {
              display: none;
            }
    style: >
      :host { 
      color: {% if is_state('sensor.uptimekuma_my_diskstation', 'down') %} red
      {% else %} green {% endif %};

Can someone please help get this code in order so that I can remove the icon and have the text change color based on the sensor state?

image

Anybody help me with this?

Suggest to ask similar questions in the huge card-mod thread instead of creating a new topic.
It will definitely attract more people, share your experience with other card-mod users & all solutions will be kept in 1 place instead of being scattered.