using a button-card with this style on the card:
card:
- background-color: >
[[[ return states['sensor.' + variables.id + '_background_color'].state; ]]]
- background-image: >
[[[ return 'url(' + states['sensor.' + variables.id + '_picture'].state +')'; ]]]
- background-position: center
- background-repeat: no-repeat
- background-size: 95%
as you can see there is a background-color, which shows a nice small ‘border’ around the background-image. This is perfect when the border-radius is 0px, which is my system default.
However, I have 1 theme where the border-radius is set to 25px (Christmas…) and then there s a small issue here.
The button-card gets rounded nicely, but the background-image is cut at the rounded edges, and isnt rounded itself.
can we not set the border radius on the background image itself too?
ofc I did try and add a dedicated
- border-radius: var(--ha-card-border-radius)
but that doesnt help. It simply adds the radius which is already set in the theme. And it does that to the card, and not the image…
edit
I was able to set
show_entity_picture: true
entity_picture: >
[[[ return states['sensor.' + variables.id + '_picture'].state; ]]]
take out the background settings mostly, except for color, and style it with:
entity_picture:
- border-radius: var(--ha-card-border-radius)
which is nice too.
I do see the picture not always being fully centered though, even though all of my pics are 100% square.
Will let the cache flow for a bit and see what happens on successive reloads.
Using the picture as background was spot perfect…
always something…
edit
nothing to do with cache. it was the set padding. inspector showed the card had padding: 4.096px 0px
which explains it all…
fixed with:
card:
- padding: 0px
and