I had customised old badges in terms of colours and fonts, which was based on certain conditions.
With new badges all of these customizations were lost, but I found a solution to continue using legacy badges by changing type. While I can see the old badges, customisation is still not working anymore. Two examples:
Font and colour remain always the same regardless of the state.
Can anyone give me some hints on what and especially how it has to be changed to make the customisation work again?
I tried searching CSS properties of badges with Inspector in browser, but I just don’t understand enough CSS to find the solution.
Alternatively, if someone can point me on how to use the state based color customisations on new badges, would also be great (whch property should be addressed instead of “:host” and “–label-badge-red”.
Following!
I had very customized badges that are now gone, this changes should cover people using the old badges, not force a change like this with no option.
There are a lot of changes lately that I simply don’t understand, why are they doing this to long time users???
Thx for the instructions, I tried it and it works just fine.
However, I prefer old style badges - they consume significantly less space (two rows instead of four with my 54 badges ) and also give better quick overview of the states (at least for my taste). so I will wait a bit for the possible solution of customising the old ones.
If it won’t be possible, I will recreate the 54 badges according to your proposal.
Thx again.
As much as I like the minimalist new badge style, I don’t like that I can’t customize them with card-mod as I used to.
So it is now 2 days that I’m recreating a kind of custom:badge-card using stack-in-card, entities and custom:hui-state-badge-element and a lot of card-mod instructions
I’m not posting that in the card-mod thread as it will be lost in all the replies.
Feel free to inspire yourself from this code, enhance it and do kind and positive comments on my starting code
This is a next change affecting Thomas Lovens cards. @thomasloven could you posisbly indicate your view in maintaining your cards with the existing and upcoming changes on the dash/frontend?
I was trying with mushroom also, but didn’t succeed with satisfactory result.
Are you willing to post some yaml of these badges, so I can try to recreate and style them a bit further?
Great, but if i understand correctly (didn’t try it out yet), this is a custom card and therefore does not span over the whole width of the screen? Because what I want to achieve is, as it was with old badges - they are on the top of the screen on the whole width.
So my preferred solution would include something like
please keep this thread on the hui-state-badge-element so we can focus.
they are nice!. please post in Mushroom styling thread? (not here as it will only confuse users looking to style the now legacy State badge). Ofc the link would be nice, so we can all followup .
Ill add this for now, as Ive tested the available theme variables and have these working:
# Legacy Badges loaded as custom
# https://github.com/home-assistant/frontend/blob/20408392d2c26b7320cee2e1b4ca3c8bd880b84e/src/panels/lovelace/badges/hui-state-label-badge.ts
# https://github.com/home-assistant/frontend/blob/20408392d2c26b7320cee2e1b4ca3c8bd880b84e/src/components/entity/ha-state-label-badge.ts
label-badge-background-color: orange
label-badge-text-color: ivory
label-badge-red: var(--ha-color)
ha-label-badge-font-size: 15px
ha-label-badge-size: 30px
ha-label-badge-border-radius: 0
# X ha-label-badge-color: yellow
# X ha-label-badge-label-text-transform: lowercase #capitalize|none|uppercase|lowercase
ha-label-badge-label-color: white
# X ha-label-badge-label-background-color: ivory
ha-label-badge-title-font-size: 10px
ha-label-badge-title-font-weight: 400
ha-label-badge-title-width: 50px
# X ha-label-badge-title-color: white
# need .label-badge .label span for label background-color, color, border-radius
ofc those are generic, and not per badge.
the commented X dont work, even though they are used in the resource…
Yes, it is to replace the (not yet updated) badge-card.
So, no, unless you do a “one card widht” page, like panel or lateral bar, it will not span, sorry.
I tried with your syntax since 2024.8.0b0 but gave up as nothing seemed to work to customize the custom:hui-state-badge-element inside the badge element even if it is working in another card like the entities one that I used in my post.
But I think it is much easier than to use a picture-element card
I used the custom badge card with floorplan card in panel mode - this worked really well for letting me show badges while maximizing the size of the floorplan card.
There now seems to be no way to show badges in panel mode - has anyone found any workarounds for that? I tried layout card, and while it does allow me to maximize the floorplan card, the button to add badges disappears.
The custom:hui-state-badge-element seems too big compared to what is in my memory and the gap between each card of the stack is also too big.
If someone know how to apply a 80% factor on the badge (probably at the entities card level) and reduce the gap between the entities cards (probably at stack-in-card level)?
I’m looking for that gap, the green part, but as I’m using transparent background, I can change my stack-in-card to an horizontal-stack and try your code