Hi there,
I created and modified a mushroom cover card and when changing the icon color by using a template the spacing gets lost. However, changing the icon color without templating does not affect the spacing.
Any idea to use my template to change the icon color without destroying the original spacing?
type: custom:mushroom-cover-card
entity: cover.rollladen_schlafen_kinder
card_mod:
style: |
ha-state-icon {
color: gray;
}
ha-card {
--card-primary-font-size: 18px;
} :host {
--mush-spacing:5px;
--mush-card-primary-font-weight: normal
} mushroom-shape-icon {
--shape-color: none !important;
--shape-color-disabled: transparent !important;
--icon-symbol-size: 100px;
margin: 1px !important;
}
show_buttons_control: true
show_tilt_position_control: false
show_position_control: false
icon_type: icon
fill_container: true
secondary_info: none
tap_action:
action: none
hold_action:
action: none
double_tap_action:
action: none
layout: vertical
results in:
This is regardless whether using color name (e.g. grey
, red
…) or color code (e.g. #ffffff
…).
type: custom:mushroom-cover-card
entity: cover.rollladen_schlafen_kinder
card_mod:
style: |
ha-state-icon {
{% set entity = 'cover.rollladen_schlafen_kinder' %}
{% if state_attr(entity, 'current_position') |int == 100 %}
{% set icon_col = '#%02x%02x%02x' % (255,255,255) %}
{% elif state_attr(entity, 'current_position') |int > 75 %}
{% set icon_col = '#%02x%02x%02x' % (224,224,224) %}
{% elif state_attr(entity, 'current_position') |int > 50 %}
{% set icon_col = '#%02x%02x%02x' % (193,193,193) %}
{% elif state_attr(entity, 'current_position') |int > 25 %}
{% set icon_col = '#%02x%02x%02x' % (162,162,162) %}
{% elif state_attr(entity, 'current_position') |int > 0 %}
{% set icon_col = '#%02x%02x%02x' % (131,131,131) %}
{% else %} {{ '#%02x%02x%02x' % (100,100,100) }}
{% set icon_col = '#%02x%02x%02x' % (100,100,100) %}
{% endif %}
color: {{ icon_col }};
}
ha-card {
--card-primary-font-size: 18px;
} :host {
--mush-spacing:5px;
--mush-card-primary-font-weight: normal
} mushroom-shape-icon {
--shape-color: none !important;
--shape-color-disabled: transparent !important;
--icon-symbol-size: 100px;
margin: 1px !important;
}
show_buttons_control: true
show_tilt_position_control: false
show_position_control: false
icon_type: icon
fill_container: true
secondary_info: none
tap_action:
action: none
hold_action:
action: none
double_tap_action:
action: none
layout: vertical
Results in:
This happens regardless the type of template. Even inserting {{ whatever }}
as value for color
did not change the behaviour.
Also tried using --card-mod-icon-color:
but using template for the value showed the same outcome.
Any idea to change the icon color state attribute dependend without crashing the spacing of my modification?
Thank you for your help and kind regards,
Benedikt