thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.06k stars 169 forks source link

Using local custom svg for --card-mod-icon #236

Closed Exynom closed 6 months ago

Exynom commented 1 year ago

First off, thanks for this awesome project!

As the title says, I'd like to use card mod to replace the stock mdi weather icons in a HACS weather card with custom animated SVGs available in the file system.

I'm sure this is possible somehow, I just can't seem to figure out how exactly.. I've tried the following (haven't gotten into templating the different weather icons yet, first wanted to simply include a local svg): card_mod: style: weather-bar$: | .condition-icon { --card-mod-icon: /config/lovelace-includes/weather-svg/drizzle.svg; } and the following variations: --card-mod-icon: "/config/lovelace-includes/weather-svg/drizzle.svg"; --card-mod-icon: url("/config/lovelace-includes/weather-svg/drizzle.svg"); --card-mod-icon: url(/local/config/lovelace-includes/weather-svg/drizzle.svg); but for each of them it only shows an empty space instead of the icon. Trying out the example case of --card-mod-icon: mdi:bed; works as expected.

Thanks a ton! Cheers, Andy

thomasloven commented 6 months ago

This can be used to add custom local svg icons to Home Assistant: https://github.com/thomasloven/hass-fontawesome