Tried to style the card by card-mod.
Sometimes styles are applied:
type: custom:map-card
x: 10
y: 10
card_size: 10
title: xxxx
card_mod:
style:
$: |
.card-header {color: red !important;}
type: custom:map-card
x: 10
y: 10
card_size: 10
title: xxxx
card_mod:
style: |
ha-card {border-color: red !important;}
But sometimes - not applied.
Do not know who is a culprit here - card-mod or map-card.
Anyway, some simple styling may be done by defining CSS variables on a HIGHER level if you wrap the map-card into mod-card:
type: custom:mod-card
card:
type: custom:map-card
x: 10
y: 10
card_size: 10
title: xxxx
card_mod:
style: |
ha-card {--primary-text-color: red !important;}
Theoretically, mod-card is not needed if the inner card (here - map-card) has it’s own “ha-card” element. But in this particular case mod-card it least provides a stable result.
Another example - going deeper to style a header (which was not working stable w/o mod-card, see the very 1st example above):
type: custom:mod-card
card:
type: custom:map-card
x: 10
y: 10
card_size: 10
title: xxxx
card_mod:
style:
map-card $:
.type-undefined $: |
.card-header {color: red !important;}
Update 25.06.24: see no issues with card-mod in rev. 1.4.
Supporting themes - seems to be working OK.
Consider this simple custom theme (light mode only):
test_border:
ha-card-border-width: 0px
ha-card-border-radius: 4px
ha-card-box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12)
These changed CSS variables seem to be properly used: