hey, how is it possible to change the background-color?
for example āno warningā, blue
and otherwise red?
type: custom:hui-element
card_type: markdown
card_mod:
style: |
ha-card {
box-shadow: none;
background-size: 100%;
}
content: >2
{% set current_count = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_count") %}
{% set advance_count = state_attr("sensor.dwd_weather_warnings_advance_warning_level", "warning_count") %}
{% if ((current_count == 0 or current_count == None) and (advance_count == 0 or advance_count == None)) %}
**<font color=#44739e>Keine Warnungen</font>**
{% else %}
{% for i in range(current_count) %}
{% set headline = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ loop.index ~ "_headline") %}
{% set description = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ loop.index ~ "_description") %}
{% set level = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ loop.index ~ "_level") %}
{% set time_start = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ loop.index ~ "_start") | as_timestamp %}
{% set weekday_start = time_start | timestamp_custom("%w", True) | int %}
{% set time_end = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ loop.index ~ "_end") | as_timestamp %}
{% set weekday_end = time_end | timestamp_custom("%w", True) | int %}
**<font color=#fdd835>{{ headline }}</font>**
*<font color=gray>{{
['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][weekday_start-1]
~ ", " ~ time_start | timestamp_custom("%H:%M") ~ " - " ~
['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][weekday_end-1]
~ ", " ~ time_end | timestamp_custom("%H:%M") }}</font>*
{{ description|trim }}
{% if not loop.last %}
***
{% endif %}
{% endfor %}
{% if ((current_count != 0) and (advance_count != 0)) %}{% endif %}
{% for i in range(advance_count) %}
{% set headline = state_attr("sensor.dwd_weather_warnings_advance_warning_level", "warning_" ~ loop.index ~ "_headline") %}
{% set description = state_attr("sensor.dwd_weather_warnings_advance_warning_level", "warning_" ~ loop.index ~ "_description") %}
{% set level = state_attr("sensor.sensor.dwd_weather_warnings_advance_warning_level", "warning_" ~ loop.index ~ "_level") %}
{% set time_start = state_attr("sensor.dwd_weather_warnings_advance_warning_level", "warning_" ~ loop.index ~ "_start") | as_timestamp%}
{% set weekday_start = time_start | timestamp_custom("%w", True) | int %}
{% set time_end = state_attr("sensor.dwd_weather_warnings_advance_warning_level", "warning_" ~ loop.index ~ "_end") | as_timestamp %}
{% set weekday_end = time_end | timestamp_custom("%w", True) | int %}
**<font color=#fdd835>{{ headline }}</font>**
*<font color=gray>{{
['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][weekday_start-1]
~ ", " ~ time_start | timestamp_custom("%H:%M") ~ " - " ~
['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][weekday_end-1]
~ ", " ~ time_end | timestamp_custom("%H:%M") }}</font>*
{{ description|trim }}
{% if not loop.last %}
***
{% endif %}
{% endfor %}
{% endif %}