Changing Sensor colour based on values

Hello,

I have created a virtual sensor to calculate my power meters numbers with the numbers of my photovoltaik/solar inverter to get positive numbers instead of negative ones if the solar grid stores energy to the public grid.

However in case this number is positive it should be shown in green colour in the Dashboard but I don’t understand what to add to the sensor values!?

- sensor:
    # Berechnet anhand des Stromzählers die Rückgabe ins Netz, wenn negative Werte ausgegben werden
      - name: "Strom zurück ins Netz"
        unique_id: "stromzurueckinsnetz"
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
            {% if is_number(states('sensor.strom_aktuell')) and states('sensor.strom_aktuell') | int(0) < 0 %}
                  {{(states('sensor.strom_aktuell') | int(0))*-1 | round }}
            {% else %}
                {{(states ('0.0') | int(0)) |round(3) }}
            {% endif %}

Is it your expectation (based on your understanding of HA docs)? If yes - no, there is automatically set color for this sensor.
Or is it your intention (i.e. you want to add this functionality to your setup)? If yes - then this may be achieved either by card-mod (for some particular card, i.e. locally) or by Custom UI (for all Lovelace, i.e. globally).