Themes & colours
Pro Cards follow your Home Assistant theme, so they look at home next to the built-in cards. This guide shows what a theme changes, which colours you can write, and where a card's colour comes from.
Themes
Any Home Assistant theme restyles the cards with the rest of the dashboard; there is nothing to set per card. Every example here has a theme picker in its top-right corner. This one is pinned to Graphite, a theme by Tilman Griesel.
Dark mode
The cards follow Home Assistant's dark mode and a theme's dark variant on their own. The auto / light / dark button beside an example's theme picker shows it in either mode.
Theme variables
The cards read these theme variables. Set them in a theme (without the leading --) and every Pro Card follows, as do the built-in cards that read them.
| Variable | What it changes |
|---|---|
ha-card-background, card-background-color | the card's background |
ha-card-backdrop-filter | what the card does to what is behind it, such as a glass theme's blur |
ha-card-border-radius, ha-card-border-width, ha-card-border-color | the card's corners and border |
ha-card-box-shadow | the card's shadow |
primary-color | the default colour of a badge, and of an entity in the deprecated cards; the power flow's home |
state-icon-color | the default colour of an entity on a tile, a poster and a tile group |
primary-text-color, secondary-text-color | the text |
text-primary-color | the text on a filled button (a pressed control) |
divider-color | dividers, grid lines, the power flow's idle links |
disabled-color | the grey behind the controls of a tile and a poster; the power flow's idle nodes |
red-color, amber-color … (every named colour) | that colour wherever a card uses it |
state-<domain>-<state>-color, state-inactive-color, state-unavailable-color | an entity's colour by its state |
energy-solar-color, energy-grid-consumption-color, energy-battery-in-color … | the power and energy flow's sources and links, as on the energy panel |
weather-icon-sun-color, -moon-color, -cloud-front-color, -rain-color, -snow-color | the weather icons, as on the weather forecast card |
switch-unchecked-track-color | a toggle that is off |
ha-tile-icon-border-radius | the shape behind an icon (round by default; a ring stays round) |
tile-icon-opacity, tile-icon-hover-opacity | the soft colour behind an icon (0.2), and under the pointer (0.35) |
For example, rounded-square icons with no colour behind them:
frontend:
themes:
Flat icons:
ha-tile-icon-border-radius: 10px
tile-icon-opacity: 0A glass theme sets a translucent background and a blur. A tile group and a layout card with card_style: seamless draw both once, on their own surface, and the cards inside stay clear on it:
frontend:
themes:
Glass:
ha-card-background: "rgba(0, 0, 0, 0.35)"
ha-card-backdrop-filter: blur(12px)card_mod and UIX still work, but the cards' inner class names can change with any release, so prefer the variables. This matters most for glass: a card_mod or UIX theme rule written on every ha-card also reaches the tiles inside a tile group and the cards inside a seamless layout, so each paints and blurs once more over the surface.
Text size
The text follows Home Assistant's typography variables. A theme with larger text, for a wall tablet or for easier reading, makes every Pro Card's text larger too.
| Variable | What it changes |
|---|---|
ha-font-size-scale | every text size at once (1.15 makes everything 15 % larger) |
ha-font-size-xs … ha-font-size-5xl | one step of the scale (10 to 40 px) |
ha-font-weight-normal, -medium | the weights |
ha-font-family-body | the font |
ha-tile-info-primary-*, ha-tile-info-secondary-* | a tile's name and line: font-size, font-weight, line-height, color … |
frontend:
themes:
Tablet:
ha-font-size-scale: 1.15
ha-tile-info-secondary-font-size: 15pxThe cards make room for it: a tile grows taller, a plot keeps space for its labels. Text inside a drawing, such as a gauge's value, scales with the drawing. Large text in the theme picker shows any example at ha-font-size-scale: 1.25:
Colour values
Wherever a card takes a colour, you can write:
- a name:
primary,accent,red,pink,purple,deep-purple,indigo,blue,light-blue,cyan,teal,green,light-green,lime,yellow,amber,orange,deep-orange,brown,light-grey,grey,dark-grey,blue-grey,black,white, andprimary-text,secondary-text,disabled; - a hex value such as
#7e57c2,rgb()/hsl(), or any other CSS colour such astomato; - a CSS variable such as
var(--my-color); - on a tile, a poster and their badges, a template that gives one of these.
A name is the theme's --<name>-color, so a theme that changes amber-color changes every card that uses amber.
Where colour comes from
On a tile, a poster, a tile group and the badges of every card, an entity's colour is the first of these that has one, as Home Assistant's own tile and badge choose it:
- the first matching rule's
color(yours, or the kind's own rules, such as a battery's levels); - the card's
color, while the entity is active (on, open, playing, home; a sensor always is). Off or closed it takes the state's colour, as on Home Assistant's tile; - the kind's colour: a light in its own colour (a pale one more saturated and white a light grey, so it shows on a card), a thermostat warm while it heats and cool while it cools;
- Home Assistant's colour for the entity's state, the theme's
state-<domain>-<state>-color, whatever value the card shows: lights amber when on, a thermostat by its mode, locks green or red, people green at home, media players light blue while playing, batteries red below 30 %, orange below 70 %, green above; an unavailable entitystate-unavailable-color; - while active, Home Assistant's state icon colour (
state-icon-color, steel blue in the default theme) on a tile, a poster and a tile group, andprimaryon a badge; while not (off, unknown),state-inactive-color.
So set color for the usual colour and let rules say when it changes. The icon works the same way: the rule's, then the card's, then the entity's own (Look).
The deprecated cards and the old header_entities keep their order: color and icon beat the rules in every state; after the rules comes Home Assistant's state colour, else grey for an off-like word (idle, closed, standby …) and primary for the rest (Moving to 3.0).
Tinted cards
tint_card: true on a rule washes the card in the rule's colour while it matches; in a tile group, just that tile. Keep it for states that need attention.