Help with combining card-mod codes
I’ve got a Tile card which I want to use card-mod to do three changes to;
- Increase the font size and spacing
- Increase the icon size
- Set a conditional background colour
With a bit of tinkering (I’m no CSS expert, or coder) I can apply all of these changes independently with the three separate blocks of code below but I cannot get them to all apply at the same time. The best I can get (thanks ChatGPT) is the icon size and the background colour, but the font size doesn’t apply.
Any help would be greatfully received! Seems like such a basic thing.
#Font size
card_mod:
style:
ha-tile-info:
$: |
.primary {
font-size: 30px !important;
line-height: 35px !important;
}
#Icon size
card_mod:
style:
.: |
ha-tile-icon {
--mdc-icon-size: 40px !important;
}
#Background colour
card_mod:
style: |
ha-card {
{% if states(config.entity) in ['off', 'unavailable'] %}
background: rgba(50,50,50,0.6);
--card-primary-color: rgba(150,150,150,1);
--card-secondary-color: rgba(150,150,150,1);
{% else %}
background: rgba(255,128,0,0.3);
{% endif %}
}
The code that ChatGPT (and Gemini actually) gave which works only for Icon size and background colour is;
card_mod:
style: |
ha-card {
{% if states(config.entity) in ['off', 'unavailable'] %}
background: rgba(50,50,50,0.6);
--card-primary-color: rgba(150,150,150,1);
--card-secondary-color: rgba(150,150,150,1);
{% else %}
background: rgba(255,128,0,0.3);
{% endif %}
}
ha-tile-icon {
--mdc-icon-size: 40px !important;
}
ha-tile-info:
$: |
.primary {
font-size: 30px !important;
line-height: 35px !important;
}