Styling footer (or header):
This whole description outdated since HA 2021.12 when new "chip" buttons were presented.
Earlier I tried to understand the styling and faced some problem which was described here and here. The problem was not solved but I found a walkaround - and then decided not to worry about the problem (since there is another solution).
Resizing icons:
- type: entities
style: |
.header-footer.footer {
--mdc-icon-size: 50px;
height: 50px;
}
entities:
- sun.sun
- type: divider
footer:
type: buttons
entities:
- entity: binary_sensor.updater
- entity: binary_sensor.updater
Note: this method allows to resize icons but do not align them with respect to the center of the card:
To make icons aligned, the following method must be used:
- type: entities
style:
.header-footer.footer hui-buttons-header-footer$:
hui-buttons-base$div: |
state-badge {
width: unset !important;
}
.: |
.header-footer.footer {
--mdc-icon-size: 50px;
height: 50px;
}
entities:
- sun.sun
- type: divider
footer:
type: buttons
entities:
- entity: binary_sensor.updater
- entity: binary_sensor.updater
Colored icons:
Method #1 - works for all kind of entities including "sensor"
, "input_boolean"
, "binary_sensor"
, "sun.sun"
:
type: entities
card_mod:
style:
hui-buttons-header-footer$:
hui-buttons-base$div: |
state-badge {
color: red;
}
entities:
- sun.sun
- type: divider
footer:
type: buttons
entities:
- entity: sun.sun
- entity: sun.sun
- entity: sun.sun
Method #2 - same for some particular items:
type: entities
card_mod:
style:
hui-buttons-header-footer$:
hui-buttons-base$div: |
div:nth-child(1) state-badge {
color: red;
}
div:nth-child(3) state-badge {
color: cyan;
}
entities:
- sun.sun
- type: divider
footer:
type: buttons
entities:
- entity: sun.sun
- entity: sun.sun
- entity: sun.sun
Method #3 - changing "--paper-item-icon-color"
& "--paper-item-icon-active-color"
variables which define styles for binary_sensor
, input_boolean
, switch
, sun.sun
:
type: entities
card_mod:
style: |
.header-footer.footer {
--paper-item-icon-active-color: orange;
--paper-item-icon-color: grey;
}
entities:
- sun.sun
- type: divider
footer:
type: buttons
entities:
- entity: sensor.cleargrass_1_co2
- entity: sun.sun
- entity: input_boolean.service_true_value
Changing a background:
type: entities
entities:
- sun.sun
footer:
type: buttons
entities:
- entity: sun.sun
- entity: sun.sun
style:
.header-footer.footer hui-buttons-header-footer:
$: |
hui-buttons-base {
background-color: red;
}
####### END of old style-buttons #######
Styling an image inside a footer:
By default the footer’ height is automatically set dependingly on the image’s size:
type: entities
entities:
- sun.sun
footer:
type: picture
image: >-
https://www.home-assistant.io/images/lovelace/header-footer/balloons-header.png
Here is how to adjust the image’s height to the card’s height:
type: entities
entities:
- sun.sun
footer:
type: picture
image: >-
https://www.home-assistant.io/images/lovelace/header-footer/balloons-header.png
style:
.header-footer.footer hui-picture-header-footer:
$: |
img {
height: 100%;
}
.: |
.header-footer.footer {
height: 200px;
}
P.S. Do you know that you can use a GIF?
type: entities
entities:
- sun.sun
footer:
type: picture
image: 'https://i.gifer.com/Z23b.gif'
style:
.header-footer.footer hui-picture-header-footer:
$: |
img {
height: 100%;
}
.: |
.header-footer.footer {
height: 100px;
}
type: entities
entities:
- sun.sun
footer:
type: picture
image: 'https://i.gifer.com/5uwq.gif'
style:
.header-footer.footer hui-picture-header-footer:
$: |
img {
height: 100%;
}
.: |
.header-footer.footer {
height: 70px;
}
ha-card {
--ha-card-background: black ;
color: white;
}
More examples are described here.