Howdy, I am stumped after days of trying to change the āha-tile-badgeā icon on a Tile card (the small gray clock in the attached image).
The example Iām using is a climate sensor (thermostat). The badge changes based on the hvac action but I want to change it with card-mod depending on different situations.
Iāve had great success changing the main icon with if/else statements in the card-mod style, but can do nothing but hide the badge icon. To hide it, I used:
ha-tile-badge { display: none; }
Iām wondering if it has something to do with the shadow DOMs but canāt quite decipher what to do.
thanks to @arganto I learned today we can mod the view badges after all (I had repeatedly posted we couldnāt, so sorry for that), using mod card and the hui- version of the ha card to mod
color: {{'var(--ok-color)' if states('sensor.processor_use')|int(0) < 14
else 'var(--alert-color)'}};
inside the same mod.
which is very nice.
I dod blow up my processor with several syntax errors there, so be carefulā¦
now looking for a way to
use the config.entity in those templates and make the mod easily transferable to other badges
a way to set this icon size in card-mod- theme, so we dont have to adjust each and every individual badge.
(aware that is for the other thread, but so intricately related, I keep it here firstā¦)
I am not sure. at all. anymoreā¦
I figured it was not possible at all, then Arganto told me it is with mod card, and I had known that, and had posted about that (I really truly didnt remember, still dontā¦) and now you tell me there is a post without mod-cardā¦?
does that rely on your hacked version too? I could set the view to sections view, and only use the --mdc-icon-size (that is, until they respond to my FR/Discussion and add a theme variable for the icon size )
talking about theming, it would be cool if we could also limit the horizontal space (width) of the complete badge area to a single column. maybe a nice challenge for card-mod themes tooā¦
No, it is a ānormalā way with addressing a badge from a hui-view level.
Can be used in a theme and this is a very hard way (difficult to use for a particular entity).
would you know how to set the background of the badge?
we can set background on that state-display, but not yet found the correct element to colorize the badges background completely
separate post for this:
because of the card_mod (with mod-card, idk) there is an ugly effect on reload of the view.
in my main theme I have a ha-card-border-radius: 0.
recently ha-badge-border-radius was added to the styles of the badges, and thatās great, because we can set the radius in our themes now.
I have ha-badge-border-radius: 24px in my main theme.
any badge in the dashboard that has any mod-card/card-mod set (and even without any mod itself), shows the squared border-radius 0 for a moment, and then loads the actual styling.
left 2 badges have a mod, the most right badge has notā¦
btw, same happens with the new type: heading when card-mod is set: