This worked for me.
- type: picture-elements
image: local/overlay.svg
card_mod:
style: |
ha-card {
{% if is_state('sensor.text_temperature_comfort_upstairs','FROSTY') %}
--ha-card-background: radial-gradient(circle, blue, black, black, blue) !important;
{% elif is_state('sensor.text_temperature_comfort_upstairs','COLD') %}
--ha-card-background: radial-gradient(circle, dodgerblue, black, black, dodgerblue) !important;
{% elif is_state('sensor.text_temperature_comfort_upstairs','CHILLY') %}
--ha-card-background: radial-gradient(circle, deepskyblue, black, black, deepskyblue) !important;
{% elif is_state('sensor.text_temperature_comfort_upstairs','COOL') %}
--ha-card-background: radial-gradient(circle, mediumaquamarine, black, black, mediumaquamarine) !important;
{% elif is_state('sensor.text_temperature_comfort_upstairs','MILD') %}
--ha-card-background: radial-gradient(circle, limegreen, black, black, limegreen) !important;
{% elif is_state('sensor.text_temperature_comfort_upstairs','PERFECT') %}
--ha-card-background: radial-gradient(circle, yellowgreen, black, black, yellowgreen) !important;
{% elif is_state('sensor.text_temperature_comfort_upstairs','WARM') %}
--ha-card-background: radial-gradient(circle, orange, black, black, orange) !important;
{% elif is_state('sensor.text_temperature_comfort_upstairs','HOT') %}
--ha-card-background: radial-gradient(circle, orangered, black, black, orangered) !important;
{% elif is_state('sensor.text_temperature_comfort_upstairs','BOILING') %}
--ha-card-background: radial-gradient(circle, crimson, black, black, crimson) !important;
{% endif %}
}
See SIMPLE AIR COMFORT CARD