Hi folks. Any update on this? Has HA or card_mod changed in the last few months to allow some kind of dynamic customisation of badges? I’m keen for person badges with colours based on zone location, like a green border when the person is home.
Thanks.
is it that one that require to change the javascript file or not? I’ve to admit that after reading a lot of pages of the card_mod thread I was more confused than ever before, I worked throughout the day between all your, Marius and Arganto posts, reading a lot of code.
I was pretty happy with what I did for myself. Might be that it would not suit everyone’s need for sure.
Hi Olivier! There are 2 methods as I described in card-mod thread:
With mod-card (arganto’s).
W/o mod-card - but a hacked js is needed (open in editor & replace 1 word with another).
Both methods have pro & contra.
1 - no need to hack, just keep using an official plugin.
2 - you can use card-mod-badge-yaml in themes like before 2024.8, less migration steps from “old badges”.
Do not recommend any particular method. Not using badges myself))
Improve styling of new ha-card and ha-badge elements
This means stack cards can now be styled, and cards in Sections dashboards should work better
There is now no reason whatsoever to use mod-card
I’m expecting this means we don’t need to use mod-card to work with the new badges. Looking forward to some examples here of simpler code, like for person badges with different colours based on zone… thanks.
Name cannot be overridden.
Consider it as same state-badge from picture-elements which lacks this possibility.
The only way to replace a name - card-mod.
Go to main card-mod thread - 1st post - link at the bottom - picture-elements.
should have mentioned I am running card_mod 3.5.0, so dont need the mod-card.
Everyone should still be using 3.4.4 now, and require the mod-card to modify badges.
the modification itself should be valid for 3.4.4 too…
also, I did quickly try to get the rgb() colors from the badge color (and prevent the hard-coded rgb there) using the relative value syntax rgb(from var(--badge-color) r g b / 1) function. (see CSS rgb() function)
I didnt manage to find the 100% correct syntax for that though. Which is too bad, as it would allow me to generalize the modification into a yaml anchor or include