#How to apply a theme to a specific card

1 messages · Page 1 of 1 (latest)

hushed violet
#

Hello,
I'd like to try creating my own Lovelace theme and would like to apply custom CSS properties to specific elements.
How can I apply CSS properties only to the mushroom-light-card elements?

unborn belfry
# hushed violet Hello, I'd like to try creating my own Lovelace theme and would like to apply cu...
hushed violet
unborn belfry
frail slate
#

Another option would be to use card_mod in your theme.yaml. Look for "card-mod-card-yaml"... However, not sure if this works with mushroom cards.
I briefly looked at this as an option but I don't know if it is possible to target the Mushroom Light Cards

#

Some other options to consider:
auto entities can output cards based on the entities you want show. card_mod can be incorporated into the cards
Decluttering card can be used to create templates to reduce the amount of repeatitive code. The concept is similar to YAML anchors like suggested above. The downside with this method: you'd still have to modify each of the cards

#

Converting your current UI-based dashboard to a YAML-based dashboard would be the easiest/quickest to be able to modify all of the cards. You'd be working with raw YAML and not be able to use the UI to edit the dashboard. Then, you could make a YAML anchor like coasting24 suggested and then copy/paste a single line into each Mushroom Light card.
Take a look at Adding more dashboards with YAML noting the code mentioned in You can also add YAML dashboards when your main dashboard is UI configured:. Using something like VSCode or your favorite text editor can be used. Just copy your raw dashboard code (Edit the dashboard > click the three dots in the top right > Raw configuration editor) into your text editor and save it based on the configuration you saved.