# Theme variables

> Every variable a theme can set, with its default value in light and dark mode.

Source: https://contributors.home-assistant.io/marketplace/reference/theme-variables/

<!-- Generated by `pnpm theme-variables` from scripts/theme-variables/. Edit those files, not this one. -->

A [theme](https://contributors.home-assistant.io/glossary/theme/) sets variables of the frontend. This page lists the ones a theme can set, with the default value of each. For how to write a theme, and which variables most themes set, start with [Publish a theme](https://contributors.home-assistant.io/marketplace/guides/themes/).

The tables on this page are generated from the frontend source, at [`afcf7d4e08`](https://github.com/home-assistant/frontend/commit/afcf7d4e080b86bc2bf01e32070099e60dc74dab) of the `dev` branch. Variables can be renamed or removed in any release, so test your theme with every beta.

In a theme file, a variable has no `--` in front, the way this page shows them. In the frontend source, and in CSS, it does: `primary-color` in your theme is `--primary-color` in the code.

Many defaults point to another variable, like `var(--primary-color)`. Those follow that variable: change `primary-color`, and everything that defaults to it changes with it. So set the variables at the top of the chain first, and only set the ones below them where you want something different.

The **Dark** column shows the value the frontend uses in dark mode, when it differs from the light one. **Not set** means the frontend sets no value in that mode, and the components that read the variable use a default of their own.

## Design tokens

Newer components use [design tokens](https://contributors.home-assistant.io/glossary/design-token/), with names that start with `ha-`. A theme can set them too. The Design area shows several of them, with what each is for, so they are not repeated here:

- [Color](https://contributors.home-assistant.io/design/foundations/color/): the color palettes, like `ha-color-primary-40`. Set the primary palette to give newer components your color, as [Publish a theme](https://contributors.home-assistant.io/marketplace/guides/themes/#the-design-tokens) explains.
- [Spacing](https://contributors.home-assistant.io/design/foundations/spacing/): the spacing scale, `ha-space-1` to `ha-space-20`, and the corner radius scale, `ha-border-radius-*`.
- [Typography](https://contributors.home-assistant.io/design/foundations/typography/): the font sizes, `ha-font-size-*`.

The other tokens are below, by the file of the frontend that defines them, together with a few older variables set in the same files, like `header-height`.

### Borders, radii, and motion

From [`src/resources/theme/core.globals.ts`](https://github.com/home-assistant/frontend/blob/dev/src/resources/theme/core.globals.ts).

| Variable | Default |
| --- | --- |
| `ha-border-width-sm` | `1px` |
| `ha-border-width-md` | `2px` |
| `ha-border-width-lg` | `3px` |
| `ha-picture-border-radius` | `var(--ha-border-radius-lg)` |
| `ha-picture-border-radius-sm` | `var(--ha-border-radius-sm)` |
| `ha-content-width-narrow` | `720px` |
| `ha-content-width-wide` | `1280px` |
| `ha-content-gutter` | `var(--ha-space-4)` |
| `ha-animation-duration-none` | `1ms` |
| `ha-animation-duration-instant` | `75ms` |
| `ha-animation-duration-fast` | `150ms` |
| `ha-animation-duration-normal` | `250ms` |
| `ha-animation-duration-slow` | `350ms` |

### Header and dialogs

From [`src/resources/theme/main.globals.ts`](https://github.com/home-assistant/frontend/blob/dev/src/resources/theme/main.globals.ts).

| Variable | Default |
| --- | --- |
| `header-height` | `56px` |
| `ha-dialog-scrim-backdrop-filter` | `brightness(68%)` |

### Typography

From [`src/resources/theme/typography.globals.ts`](https://github.com/home-assistant/frontend/blob/dev/src/resources/theme/typography.globals.ts).

| Variable | Default |
| --- | --- |
| `ha-font-family-body` | `Roboto, Noto, sans-serif` |
| `ha-font-family-code` | `monospace` |
| `ha-font-family-longform` | `ui-sans-serif, system-ui, sans-serif` |
| `ha-font-size-scale` | `1` |
| `ha-font-weight-light` | `300` |
| `ha-font-weight-normal` | `400` |
| `ha-font-weight-medium` | `500` |
| `ha-font-weight-bold` | `700` |
| `ha-font-family-heading` | `var(--ha-font-family-body)` |
| `ha-font-weight-body` | `var(--ha-font-weight-normal)` |
| `ha-font-weight-heading` | `var(--ha-font-weight-bold)` |
| `ha-font-weight-action` | `var(--ha-font-weight-medium)` |
| `ha-line-height-condensed` | `1.2` |
| `ha-line-height-normal` | `1.6` |
| `ha-line-height-expanded` | `2` |
| `ha-font-smoothing` | `antialiased` |
| `ha-moz-osx-font-smoothing` | `grayscale` |

### Shadows

From [`src/resources/theme/semantic.globals.ts`](https://github.com/home-assistant/frontend/blob/dev/src/resources/theme/semantic.globals.ts).

| Variable | Light | Dark |
| --- | --- | --- |
| `ha-box-shadow-s` | `0 1px 2px 0 rgba(0, 0, 0, 0.08), 0 1px 3px 0 rgba(0, 0, 0, 0.12)` | `0 1px 2px 0 rgba(0, 0, 0, 0.4), 0 1px 3px 0 rgba(0, 0, 0, 0.5)` |
| `ha-box-shadow-m` | `0 3px 6px -1px rgba(0, 0, 0, 0.1), 0 8px 16px -2px rgba(0, 0, 0, 0.15)` | `0 3px 6px -1px rgba(0, 0, 0, 0.35), 0 8px 16px -2px rgba(0, 0, 0, 0.45)` |
| `ha-box-shadow-l` | `0 6px 12px -3px rgba(0, 0, 0, 0.12), 0 16px 32px -6px rgba(0, 0, 0, 0.2)` | `0 6px 12px -3px rgba(0, 0, 0, 0.4), 0 16px 32px -6px rgba(0, 0, 0, 0.55)` |

### Pure colors

From [`src/resources/theme/color/core.globals.ts`](https://github.com/home-assistant/frontend/blob/dev/src/resources/theme/color/core.globals.ts).

| Variable | Default |
| --- | --- |
| `ha-color-black` | `#000000` |
| `ha-color-white` | `#ffffff` |

### Semantic colors

From [`src/resources/theme/color/semantic.globals.ts`](https://github.com/home-assistant/frontend/blob/dev/src/resources/theme/color/semantic.globals.ts).

| Variable | Light | Dark |
| --- | --- | --- |
| `ha-color-focus` | `var(--ha-color-neutral-60)` | Same |
| `ha-color-text-primary` | `var(--ha-color-neutral-05)` | `var(--white-color)` |
| `ha-color-text-secondary` | `var(--ha-color-neutral-40)` | `var(--ha-color-neutral-80)` |
| `ha-color-text-disabled` | `var(--ha-color-neutral-60)` | Same |
| `ha-color-text-link` | `var(--ha-color-primary-40)` | `var(--ha-color-primary-60)` |
| `ha-color-text-primary-inverted` | `var(--ha-color-white)` | `var(--ha-color-black)` |
| `ha-color-text-secondary-inverted` | `var(--ha-color-neutral-20)` | `var(--ha-color-neutral-40)` |
| `ha-color-border-primary-quiet` | `var(--ha-color-primary-90)` | Same |
| `ha-color-border-primary-normal` | `var(--ha-color-primary-70)` | Same |
| `ha-color-border-primary-loud` | `var(--ha-color-primary-40)` | Same |
| `ha-color-border-neutral-quiet` | `var(--ha-color-neutral-90)` | `var(--ha-color-neutral-40)` |
| `ha-color-border-neutral-normal` | `var(--ha-color-neutral-60)` | `var(--ha-color-neutral-50)` |
| `ha-color-border-neutral-loud` | `var(--ha-color-neutral-40)` | `var(--ha-color-neutral-70)` |
| `ha-color-border-danger-quiet` | `var(--ha-color-red-90)` | Same |
| `ha-color-border-danger-normal` | `var(--ha-color-red-70)` | `var(--ha-color-red-50)` |
| `ha-color-border-danger-loud` | `var(--ha-color-red-40)` | `var(--ha-color-red-50)` |
| `ha-color-border-warning-quiet` | `var(--ha-color-orange-90)` | Same |
| `ha-color-border-warning-normal` | `var(--ha-color-orange-70)` | `var(--ha-color-orange-50)` |
| `ha-color-border-warning-loud` | `var(--ha-color-orange-40)` | `var(--ha-color-orange-50)` |
| `ha-color-border-success-quiet` | `var(--ha-color-green-90)` | Same |
| `ha-color-border-success-normal` | `var(--ha-color-green-70)` | Same |
| `ha-color-border-success-loud` | `var(--ha-color-green-40)` | Same |
| `ha-color-fill-primary-quiet-resting` | `var(--ha-color-primary-95)` | `var(--ha-color-primary-05)` |
| `ha-color-fill-primary-quiet-hover` | `var(--ha-color-primary-90)` | `var(--ha-color-primary-10)` |
| `ha-color-fill-primary-quiet-active` | `var(--ha-color-primary-95)` | `var(--ha-color-primary-05)` |
| `ha-color-fill-primary-normal-resting` | `var(--ha-color-primary-90)` | `var(--ha-color-primary-10)` |
| `ha-color-fill-primary-normal-hover` | `var(--ha-color-primary-80)` | `var(--ha-color-primary-20)` |
| `ha-color-fill-primary-normal-active` | `var(--ha-color-primary-90)` | `var(--ha-color-primary-10)` |
| `ha-color-fill-primary-loud-resting` | `var(--ha-color-primary-40)` | Same |
| `ha-color-fill-primary-loud-hover` | `var(--ha-color-primary-30)` | Same |
| `ha-color-fill-primary-loud-active` | `var(--ha-color-primary-40)` | Same |
| `ha-color-fill-neutral-quiet-resting` | `var(--ha-color-neutral-95)` | `var(--ha-color-neutral-05)` |
| `ha-color-fill-neutral-quiet-hover` | `var(--ha-color-neutral-90)` | `var(--ha-color-neutral-10)` |
| `ha-color-fill-neutral-quiet-active` | `var(--ha-color-neutral-95)` | `var(--ha-color-neutral-00)` |
| `ha-color-fill-neutral-normal-resting` | `var(--ha-color-neutral-90)` | `var(--ha-color-neutral-10)` |
| `ha-color-fill-neutral-normal-hover` | `var(--ha-color-neutral-80)` | `var(--ha-color-neutral-20)` |
| `ha-color-fill-neutral-normal-active` | `var(--ha-color-neutral-90)` | `var(--ha-color-neutral-10)` |
| `ha-color-fill-neutral-loud-resting` | `var(--ha-color-neutral-40)` | `var(--ha-color-neutral-60)` |
| `ha-color-fill-neutral-loud-hover` | `var(--ha-color-neutral-30)` | `var(--ha-color-neutral-70)` |
| `ha-color-fill-neutral-loud-active` | `var(--ha-color-neutral-40)` | `var(--ha-color-neutral-60)` |
| `ha-color-fill-disabled-quiet-resting` | `var(--ha-color-neutral-95)` | `var(--ha-color-neutral-10)` |
| `ha-color-fill-disabled-quiet-hover` | `var(--ha-color-neutral-90)` | `var(--ha-color-neutral-20)` |
| `ha-color-fill-disabled-normal-resting` | `var(--ha-color-neutral-95)` | `var(--ha-color-neutral-20)` |
| `ha-color-fill-disabled-normal-hover` | `var(--ha-color-neutral-90)` | `var(--ha-color-neutral-30)` |
| `ha-color-fill-disabled-loud-resting` | `var(--ha-color-neutral-80)` | `var(--ha-color-neutral-30)` |
| `ha-color-fill-disabled-loud-hover` | `var(--ha-color-neutral-70)` | `var(--ha-color-neutral-40)` |
| `ha-color-fill-danger-quiet-resting` | `var(--ha-color-red-95)` | `var(--ha-color-red-05)` |
| `ha-color-fill-danger-quiet-hover` | `var(--ha-color-red-90)` | `var(--ha-color-red-10)` |
| `ha-color-fill-danger-quiet-active` | `var(--ha-color-red-95)` | `var(--ha-color-red-05)` |
| `ha-color-fill-danger-normal-resting` | `var(--ha-color-red-90)` | `var(--ha-color-red-10)` |
| `ha-color-fill-danger-normal-hover` | `var(--ha-color-red-80)` | `var(--ha-color-red-20)` |
| `ha-color-fill-danger-normal-active` | `var(--ha-color-red-90)` | `var(--ha-color-red-10)` |
| `ha-color-fill-danger-loud-resting` | `var(--ha-color-red-50)` | `var(--ha-color-red-40)` |
| `ha-color-fill-danger-loud-hover` | `var(--ha-color-red-40)` | `var(--ha-color-red-30)` |
| `ha-color-fill-danger-loud-active` | `var(--ha-color-red-50)` | `var(--ha-color-red-40)` |
| `ha-color-fill-warning-quiet-resting` | `var(--ha-color-orange-95)` | `var(--ha-color-orange-05)` |
| `ha-color-fill-warning-quiet-hover` | `var(--ha-color-orange-90)` | `var(--ha-color-orange-10)` |
| `ha-color-fill-warning-quiet-active` | `var(--ha-color-orange-95)` | `var(--ha-color-orange-05)` |
| `ha-color-fill-warning-normal-resting` | `var(--ha-color-orange-90)` | `var(--ha-color-orange-10)` |
| `ha-color-fill-warning-normal-hover` | `var(--ha-color-orange-80)` | `var(--ha-color-orange-20)` |
| `ha-color-fill-warning-normal-active` | `var(--ha-color-orange-90)` | `var(--ha-color-orange-10)` |
| `ha-color-fill-warning-loud-resting` | `var(--ha-color-orange-70)` | `var(--ha-color-orange-40)` |
| `ha-color-fill-warning-loud-hover` | `var(--ha-color-orange-50)` | `var(--ha-color-orange-30)` |
| `ha-color-fill-warning-loud-active` | `var(--ha-color-orange-70)` | `var(--ha-color-orange-40)` |
| `ha-color-fill-success-quiet-resting` | `var(--ha-color-green-95)` | `var(--ha-color-green-05)` |
| `ha-color-fill-success-quiet-hover` | `var(--ha-color-green-90)` | `var(--ha-color-green-10)` |
| `ha-color-fill-success-quiet-active` | `var(--ha-color-green-95)` | `var(--ha-color-green-05)` |
| `ha-color-fill-success-normal-resting` | `var(--ha-color-green-90)` | `var(--ha-color-green-10)` |
| `ha-color-fill-success-normal-hover` | `var(--ha-color-green-80)` | `var(--ha-color-green-20)` |
| `ha-color-fill-success-normal-active` | `var(--ha-color-green-90)` | `var(--ha-color-green-10)` |
| `ha-color-fill-success-loud-resting` | `var(--ha-color-green-50)` | `var(--ha-color-green-40)` |
| `ha-color-fill-success-loud-hover` | `var(--ha-color-green-40)` | `var(--ha-color-green-30)` |
| `ha-color-fill-success-loud-active` | `var(--ha-color-green-50)` | `var(--ha-color-green-40)` |
| `ha-color-on-primary-quiet` | `var(--ha-color-primary-50)` | `var(--ha-color-primary-70)` |
| `ha-color-on-primary-normal` | `var(--ha-color-primary-40)` | `var(--ha-color-primary-60)` |
| `ha-color-on-primary-loud` | `var(--white-color)` | Same |
| `ha-color-on-neutral-quiet` | `var(--ha-color-neutral-50)` | `var(--ha-color-neutral-70)` |
| `ha-color-on-neutral-normal` | `var(--ha-color-neutral-40)` | `var(--ha-color-neutral-60)` |
| `ha-color-on-neutral-loud` | `var(--white-color)` | Same |
| `ha-color-on-disabled-quiet` | `var(--ha-color-neutral-80)` | `var(--ha-color-neutral-40)` |
| `ha-color-on-disabled-normal` | `var(--ha-color-neutral-70)` | `var(--ha-color-neutral-50)` |
| `ha-color-on-disabled-loud` | `var(--ha-color-neutral-95)` | `var(--ha-color-neutral-50)` |
| `ha-color-on-danger-quiet` | `var(--ha-color-red-50)` | `var(--ha-color-red-70)` |
| `ha-color-on-danger-normal` | `var(--ha-color-red-40)` | `var(--ha-color-red-60)` |
| `ha-color-on-danger-loud` | `var(--white-color)` | Same |
| `ha-color-on-warning-quiet` | `var(--ha-color-orange-50)` | `var(--ha-color-orange-70)` |
| `ha-color-on-warning-normal` | `var(--ha-color-orange-40)` | `var(--ha-color-orange-60)` |
| `ha-color-on-warning-loud` | `var(--white-color)` | Same |
| `ha-color-on-success-quiet` | `var(--ha-color-green-50)` | `var(--ha-color-green-70)` |
| `ha-color-on-success-normal` | `var(--ha-color-green-40)` | `var(--ha-color-green-60)` |
| `ha-color-on-success-loud` | `var(--white-color)` | Same |
| `ha-color-surface-default` | `var(--ha-color-white)` | `var(--ha-color-neutral-10)` |
| `ha-color-surface-low` | `var(--ha-color-neutral-95)` | `var(--ha-color-neutral-05)` |
| `ha-color-surface-lower` | `var(--ha-color-neutral-90)` | `var(--ha-color-black)` |
| `ha-color-surface-default-inverted` | `var(--ha-color-neutral-10)` | `var(--ha-color-white)` |
| `ha-color-surface-low-inverted` | `var(--ha-color-neutral-05)` | `var(--ha-color-neutral-95)` |
| `ha-color-surface-lower-inverted` | `var(--ha-color-black)` | `var(--ha-color-90)` |
| `ha-color-on-surface-default` | `var(--ha-color-neutral-05)` | `var(--ha-color-neutral-95)` |
| `ha-color-form-background` | `var(--ha-color-neutral-95)` | `var(--ha-color-neutral-20)` |
| `ha-color-form-background-hover` | `var(--ha-color-neutral-90)` | `var(--ha-color-neutral-30)` |
| `ha-color-form-background-disabled` | `var(--ha-color-neutral-80)` | `var(--ha-color-neutral-20)` |
| `ha-color-shadow-scrollable-fade` | `rgba(0, 0, 0, 0.08)` | Same |
| `ha-color-border-normal` | Not set | `var(--ha-color-primary-50)` |

## Component variables

Some components read a variable of their own, with a default in the component itself. These are the ones meant for themes. When a theme does not set one, the component uses the default in the table.

### Cards

| Variable | Default | What it changes |
| --- | --- | --- |
| `ha-card-background` | `var(--card-background-color, white)` | The background of cards. |
| `ha-card-backdrop-filter` | `none` | A backdrop filter behind cards, like a blur. |
| `ha-card-border-radius` | `var(--ha-border-radius-lg)` | The roundness of the corners of cards. Many other surfaces, like tiles and expansion panels, follow it. |
| `ha-card-border-width` | `1px` | The width of the border of cards. |
| `ha-card-border-color` | `var(--divider-color, #e0e0e0)` | The color of the border of cards. |
| `ha-card-box-shadow` | `none` | The shadow of cards. |
| `ha-card-header-color` | `var(--primary-text-color)` | The color of the title of a card. |
| `ha-card-header-font-family` | `inherit` | The font of the title of a card. |
| `ha-card-header-font-size` | `var(--ha-font-size-2xl)` | The size of the title of a card. |
| `ha-card-feature-gap` | `12px` | The space between the features of a card. |

### Dashboard layout

| Variable | Default | What it changes |
| --- | --- | --- |
| `masonry-view-card-margin` | `4px 4px 8px` | The margin around cards in the masonry and sidebar views. |
| `ha-view-sections-column-min-width` | `320px` | The narrowest a column of the sections view gets. |
| `ha-view-sections-column-max-width` | `500px` | The widest a column of the sections view gets. |
| `ha-view-sections-column-gap` | `32px` | The space between the columns of the sections view. |
| `ha-view-sections-narrow-column-gap` | `8px` | The space between the columns of the sections view on narrow screens. |
| `ha-view-sections-row-gap` | `24px` | The space between the rows of the sections view. |
| `ha-view-sections-row-height` | `56px` | The height of a row of the sections view. |
| `ha-view-sections-extra-top-margin` | `80px` | The space above the sections view. |
| `ha-section-grid-column-gap` | `8px` | The space between the cards of a section, side by side. |
| `ha-section-grid-row-gap` | `8px` | The space between the rows of cards in a section. |
| `ha-section-grid-row-height` | `56px` | The height of a row of cards in a section. |
| `ha-section-background-color` | `var(--secondary-background-color)` | The background of a section that has one turned on. |
| `ha-section-border-radius` | `var(--ha-border-radius-xl)` | The roundness of the corners of a section. |
| `grid-card-gap` | `8px` | The space between the cards of a grid card. |
| `stack-card-gap` | `8px` | The space between the cards of a horizontal or vertical stack card. |
| `horizontal-stack-card-gap` | `var(--stack-card-gap, 8px)` | The space between the cards of a horizontal stack card. |
| `vertical-stack-card-gap` | `var(--stack-card-gap, 8px)` | The space between the cards of a vertical stack card. |

### Cards and rows

| Variable | Default | What it changes |
| --- | --- | --- |
| `ha-heading-card-title-color` | `var(--primary-text-color)` | The color of the title of a heading card. |
| `ha-heading-card-title-font-size` | `var(--ha-font-size-l)` | The size of the title of a heading card. |
| `ha-heading-card-subtitle-color` | `var(--secondary-text-color)` | The color of a subtitle of a heading card. |
| `ha-picture-card-text-color` | `white` | The text on top of the picture of the picture entity and picture glance cards. |
| `ha-picture-icon-button-color` | `#a9a9a9` | The icons of a picture glance card, for entities that are off. |
| `ha-picture-icon-button-on-color` | `white` | The icons of a picture glance card, for entities that are on. |
| `section-header-text-color` | `var(--primary-text-color)` | The label of a section row in an entities card. |
| `entities-divider-color` | `var(--divider-color)` | The line of a divider or section row in an entities card. |

### Badges

| Variable | Default | What it changes |
| --- | --- | --- |
| `ha-heading-badge-text-color` | `var(--secondary-text-color)` | The text of the badges of a heading card. |
| `ha-heading-badge-font-size` | `var(--ha-font-size-m)` | The size of the text of the badges of a heading card. |
| `ha-heading-badge-font-weight` | `400` | The weight of the text of the badges of a heading card. |
| `ha-heading-badge-line-height` | `20px` | The line height of the badges of a heading card. |
| `ha-heading-badge-size` | `26px` | The height of the button badges of a heading card. |
| `ha-heading-badge-icon-size` | `16px` | The size of the icon of the button badges of a heading card. |
| `ha-label-badge-color` | `var(--primary-color)` | The ring and the label background of a label badge. |
| `ha-label-badge-label-color` | `white` | The text of the label of a label badge. |
| `ha-label-badge-label-text-transform` | `uppercase` | The capitalization of the label of a label badge. |
| `ha-label-badge-size` | `2.5em` | The size of a label badge. |
| `ha-label-badge-font-size` | `1.5em` | The size of the value in a label badge. |
| `ha-label-badge-border-radius` | `50%` | The roundness of a label badge. |
| `ha-label-badge-padding` | `0 0 0 0` | The padding around a label badge. |
| `ha-label-badge-title-font-size` | `0.9em` | The size of the title below a label badge. |
| `ha-label-badge-title-width` | `5em` | The width of the title below a label badge. |

### Dashboard header

| Variable | Default | What it changes |
| --- | --- | --- |
| `app-header-backdrop-filter` | `none` | A backdrop filter behind the header of dashboards, like a blur. |
| `app-header-edit-background-color` | `#455a64` | The header of a dashboard while you edit it. |
| `app-header-edit-text-color` | `white` | The text and icons in the header of a dashboard while you edit it. |

### Markdown

| Variable | Default | What it changes |
| --- | --- | --- |
| `markdown-link-color` | `var(--primary-color)` | Links in Markdown, like in the Markdown card. |
| `markdown-code-text-color` | `inherit` | The text of code in Markdown. |
| `markdown-list-indent` | `revert` | The indent of lists in Markdown. |
| `markdown-table-border-color` | `var(--divider-color)` | The color of the borders of tables in Markdown. |
| `markdown-table-border-width` | `1px` | The width of the borders of tables in Markdown. |
| `markdown-table-border-style` | `solid` | The style of the borders of tables in Markdown. |
| `markdown-table-padding-inline` | `0.5em` | The space left and right in the cells of tables in Markdown. |
| `markdown-table-padding-block` | `0.25em` | The space above and below in the cells of tables in Markdown. |
| `markdown-table-text-align` | `start` | The alignment of text in tables in Markdown. |

### Code editor

| Variable | Default | What it changes |
| --- | --- | --- |
| `code-editor-background-color` | `var(--card-background-color)` | The background of the code editor. |
| `code-editor-gutter-color` | `var(--secondary-background-color, whitesmoke)` | The gutter of the code editor, with the line numbers. |

## Classic variables

The older variables, from [`src/resources/theme/color/color.globals.ts`](https://github.com/home-assistant/frontend/blob/dev/src/resources/theme/color/color.globals.ts). Most themes still set them, and many components still use them.

The variables starting with `mdc-` in the same file are left out: they pass these variables on to older components, and follow them by themselves.

You don't need to set the `rgb-` variables. When a theme sets a variable to a hex color, like `primary-color: "#03a9f4"`, the frontend sets `rgb-primary-color` from it. Only set an `rgb-` variable yourself when its color isn't a hex value, like `rgb()` or `var()`.

### Main colors

| Variable | Light | Dark |
| --- | --- | --- |
| `primary-color` | `var(--ha-color-primary-40)` | Same |
| `dark-primary-color` | `#0288d1` | Same |
| `darker-primary-color` | `#016194` | Same |
| `light-primary-color` | `#b3e5fc` | Same |
| `accent-color` | `#ff9800` | Same |
| `divider-color` | `rgba(0, 0, 0, 0.12)` | `rgba(225, 225, 225, 0.12)` |
| `outline-color` | `rgba(0, 0, 0, 0.12)` | `rgba(225, 225, 225, 0.12)` |
| `outline-hover-color` | `rgba(0, 0, 0, 0.24)` | `rgba(225, 225, 225, 0.24)` |
| `shadow-color` | `rgba(0, 0, 0, 0.16)` | `rgba(0, 0, 0, 0.48)` |
| `scrollbar-thumb-color` | `rgb(194, 194, 194)` | `rgb(110, 110, 110)` |
| `error-color` | `#db4437` | Same |
| `warning-color` | `#ffa600` | Same |
| `success-color` | `#43a047` | Same |
| `info-color` | `#039be5` | Same |
| `disabled-color` | `#bdbdbd` | `#464646` |

### Text

| Variable | Light | Dark |
| --- | --- | --- |
| `primary-text-color` | `var(--ha-color-text-primary)` | `#e1e1e1` |
| `secondary-text-color` | `var(--ha-color-text-secondary)` | `#9b9b9b` |
| `text-primary-color` | `#ffffff` | Same |
| `text-light-primary-color` | `#212121` | Same |
| `disabled-text-color` | `#bdbdbd` | `#6f6f6f` |

### Backgrounds

| Variable | Light | Dark |
| --- | --- | --- |
| `card-background-color` | `#ffffff` | `#1c1c1c` |
| `primary-background-color` | `#fafafa` | `#111111` |
| `secondary-background-color` | `#e5e5e5` | `#282828` |
| `clear-background-color` | `#ffffff` | `#111111` |

### RGB variants

| Variable | Light | Dark |
| --- | --- | --- |
| `rgb-primary-color` | `0, 154, 199` | Same |
| `rgb-accent-color` | `255, 152, 0` | Same |
| `rgb-primary-text-color` | `33, 33, 33` | `225, 225, 225` |
| `rgb-secondary-text-color` | `114, 114, 114` | `155, 155, 155` |
| `rgb-text-primary-color` | `255, 255, 255` | Same |
| `rgb-card-background-color` | `255, 255, 255` | `28, 28, 28` |
| `rgb-warning-color` | `255, 166, 0` | Same |
| `rgb-error-color` | `219, 68, 55` | Same |
| `rgb-success-color` | `67, 160, 71` | Same |
| `rgb-info-color` | `3, 155, 229` | Same |

### Sidebar

| Variable | Light | Dark |
| --- | --- | --- |
| `sidebar-text-color` | `var(--primary-text-color)` | Same |
| `sidebar-background-color` | `var(--card-background-color)` | Same |
| `sidebar-selected-text-color` | `var(--primary-color)` | Same |
| `sidebar-selected-icon-color` | `var(--primary-color)` | Same |
| `sidebar-icon-color` | `rgba(var(--rgb-primary-text-color), 0.6)` | Same |

### Header

| Variable | Light | Dark |
| --- | --- | --- |
| `app-header-text-color` | `var(--sidebar-text-color)` | Same |
| `app-header-background-color` | `var(--sidebar-background-color)` | Same |
| `app-header-border-bottom` | `1px solid var(--divider-color)` | Same |
| `app-theme-color` | `var(--app-header-background-color)` | Same |

### Entity states

| Variable | Light | Dark |
| --- | --- | --- |
| `state-icon-color` | `#44739e` | Same |
| `state-active-color` | `var(--amber-color)` | Same |
| `state-inactive-color` | `var(--grey-color)` | Same |
| `state-unavailable-color` | `var(--state-icon-unavailable-color, var(--disabled-text-color))` | Same |
| `state-alarm_control_panel-armed_away-color` | `var(--green-color)` | Same |
| `state-alarm_control_panel-armed_custom_bypass-color` | `var(--green-color)` | Same |
| `state-alarm_control_panel-armed_home-color` | `var(--green-color)` | Same |
| `state-alarm_control_panel-armed_night-color` | `var(--green-color)` | Same |
| `state-alarm_control_panel-armed_vacation-color` | `var(--green-color)` | Same |
| `state-alarm_control_panel-arming-color` | `var(--orange-color)` | Same |
| `state-alarm_control_panel-disarming-color` | `var(--orange-color)` | Same |
| `state-alarm_control_panel-pending-color` | `var(--orange-color)` | Same |
| `state-alarm_control_panel-triggered-color` | `var(--red-color)` | Same |
| `state-alert-off-color` | `var(--orange-color)` | Same |
| `state-alert-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-active-color` | `var(--amber-color)` | Same |
| `state-binary_sensor-battery-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-carbon_monoxide-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-gas-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-glass_break-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-heat-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-lock-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-moisture-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-problem-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-safety-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-smoke-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-sound-on-color` | `var(--red-color)` | Same |
| `state-binary_sensor-tamper-on-color` | `var(--red-color)` | Same |
| `state-climate-auto-color` | `var(--green-color)` | Same |
| `state-climate-cool-color` | `var(--blue-color)` | Same |
| `state-climate-dry-color` | `var(--orange-color)` | Same |
| `state-climate-fan_only-color` | `var(--cyan-color)` | Same |
| `state-climate-heat-color` | `var(--deep-orange-color)` | Same |
| `state-climate-heat-cool-color` | `var(--amber-color)` | Same |
| `state-cover-active-color` | `var(--purple-color)` | Same |
| `state-device_tracker-active-color` | `var(--blue-color)` | Same |
| `state-device_tracker-home-color` | `var(--green-color)` | Same |
| `state-fan-active-color` | `var(--cyan-color)` | Same |
| `state-humidifier-on-color` | `var(--blue-color)` | Same |
| `state-lawn_mower-active-color` | `var(--teal-color)` | Same |
| `state-lawn_mower-error-color` | `var(--red-color)` | Same |
| `state-light-active-color` | `var(--amber-color)` | Same |
| `state-lock-jammed-color` | `var(--red-color)` | Same |
| `state-lock-locked-color` | `var(--green-color)` | Same |
| `state-lock-locking-color` | `var(--orange-color)` | Same |
| `state-lock-unlocked-color` | `var(--red-color)` | Same |
| `state-lock-unlocking-color` | `var(--orange-color)` | Same |
| `state-lock-open-color` | `var(--red-color)` | Same |
| `state-lock-opening-color` | `var(--orange-color)` | Same |
| `state-media_player-active-color` | `var(--light-blue-color)` | Same |
| `state-person-active-color` | `var(--blue-color)` | Same |
| `state-person-home-color` | `var(--green-color)` | Same |
| `state-plant-active-color` | `var(--red-color)` | Same |
| `state-siren-active-color` | `var(--red-color)` | Same |
| `state-sun-above_horizon-color` | `var(--amber-color)` | Same |
| `state-sun-below_horizon-color` | `var(--indigo-color)` | Same |
| `state-switch-active-color` | `var(--amber-color)` | Same |
| `state-update-active-color` | `var(--orange-color)` | Same |
| `state-vacuum-active-color` | `var(--teal-color)` | Same |
| `state-vacuum-error-color` | `var(--red-color)` | Same |
| `state-valve-active-color` | `var(--blue-color)` | Same |
| `state-sensor-battery-high-color` | `var(--green-color)` | Same |
| `state-sensor-battery-low-color` | `var(--red-color)` | Same |
| `state-sensor-battery-medium-color` | `var(--orange-color)` | Same |
| `state-water_heater-eco-color` | `var(--green-color)` | Same |
| `state-water_heater-electric-color` | `var(--orange-color)` | Same |
| `state-water_heater-gas-color` | `var(--orange-color)` | Same |
| `state-water_heater-heat_pump-color` | `var(--orange-color)` | Same |
| `state-water_heater-high_demand-color` | `var(--deep-orange-color)` | Same |
| `state-water_heater-performance-color` | `var(--deep-orange-color)` | Same |
| `state-weather-clear_night-color` | `var(--deep-purple-color)` | Same |
| `state-weather-cloudy-color` | `var(--light-grey-color)` | Same |
| `state-weather-exceptional-color` | `var(--red-color)` | Same |
| `state-weather-fog-color` | `var(--grey-color)` | Same |
| `state-weather-hail-color` | `var(--cyan-color)` | Same |
| `state-weather-lightning_rainy-color` | `var(--lime-color)` | Same |
| `state-weather-lightning-color` | `var(--yellow-color)` | Same |
| `state-weather-partlycloudy-color` | `var(--blue-grey-color)` | Same |
| `state-weather-pouring-color` | `var(--indigo-color)` | Same |
| `state-weather-rainy-color` | `var(--blue-color)` | Same |
| `state-weather-snowy_rainy-color` | `var(--light-blue-color)` | Same |
| `state-weather-snowy-color` | `#c0e0ff` | Same |
| `state-weather-sunny-color` | `var(--amber-color)` | Same |
| `state-weather-windy_variant-color` | `var(--green-color)` | Same |
| `state-weather-windy-color` | `var(--green-color)` | Same |
| `state-icon-error-color` | `var(--error-state-color, var(--error-color))` | Same |

### Energy

| Variable | Light | Dark |
| --- | --- | --- |
| `energy-grid-consumption-color` | `#488fc2` | Same |
| `energy-grid-return-color` | `#8353d1` | `#a280db` |
| `energy-solar-color` | `#ff9800` | Same |
| `energy-non-fossil-color` | `#0f9d58` | Same |
| `energy-battery-out-color` | `#4db6ac` | Same |
| `energy-battery-in-color` | `#f06292` | Same |
| `energy-gas-color` | `#8e021b` | Same |
| `energy-water-color` | `#00bcd4` | Same |

### History

| Variable | Light | Dark |
| --- | --- | --- |
| `history-unavailable-color` | `transparent` | Same |
| `history-unknown-color` | `var(--dark-grey-color)` | Same |

### Inputs

| Variable | Light | Dark |
| --- | --- | --- |
| `input-idle-line-color` | `rgba(0, 0, 0, 0.42)` | `rgba(255, 255, 255, 0.42)` |
| `input-hover-line-color` | `rgba(0, 0, 0, 0.87)` | `rgba(255, 255, 255, 0.87)` |
| `input-disabled-line-color` | `rgba(0, 0, 0, 0.06)` | `rgba(255, 255, 255, 0.06)` |
| `input-outlined-idle-border-color` | `rgba(0, 0, 0, 0.38)` | `rgba(255, 255, 255, 0.38)` |
| `input-outlined-hover-border-color` | `rgba(0, 0, 0, 0.87)` | `rgba(255, 255, 255, 0.87)` |
| `input-outlined-disabled-border-color` | `rgba(0, 0, 0, 0.06)` | `rgba(255, 255, 255, 0.06)` |
| `input-fill-color` | `rgb(245, 245, 245)` | `rgba(255, 255, 255, 0.05)` |
| `input-disabled-fill-color` | `rgb(250, 250, 250)` | `rgba(255, 255, 255, 0.02)` |
| `input-ink-color` | `rgba(0, 0, 0, 0.87)` | `rgba(255, 255, 255, 0.87)` |
| `input-label-ink-color` | `rgba(0, 0, 0, 0.6)` | `rgba(255, 255, 255, 0.6)` |
| `input-disabled-ink-color` | `rgba(0, 0, 0, 0.37)` | `rgba(255, 255, 255, 0.37)` |
| `input-dropdown-icon-color` | `rgba(0, 0, 0, 0.54)` | `rgba(255, 255, 255, 0.54)` |

### Sliders

| Variable | Light | Dark |
| --- | --- | --- |
| `slider-color` | `var(--primary-color)` | Same |
| `slider-secondary-color` | `var(--light-primary-color)` | Same |
| `slider-track-color` | `var(--scrollbar-thumb-color)` | Same |

### Tables

| Variable | Light | Dark |
| --- | --- | --- |
| `table-header-background-color` | `var(--input-fill-color)` | Same |
| `table-row-background-color` | `var(--primary-background-color)` | Same |
| `table-row-alternative-background-color` | `var(--secondary-background-color)` | Same |
| `data-table-background-color` | `var(--card-background-color)` | Same |

### Label badges

| Variable | Light | Dark |
| --- | --- | --- |
| `label-badge-grey` | `#9e9e9e` | Same |
| `label-badge-red` | `var(--error-color)` | Same |
| `label-badge-blue` | `var(--info-color)` | Same |
| `label-badge-green` | `var(--success-color)` | Same |
| `label-badge-yellow` | `var(--warning-color)` | Same |
| `label-badge-background-color` | `var(--card-background-color)` | Same |
| `label-badge-text-color` | `rgba(var(--rgb-primary-text-color), 0.8)` | Same |

### Markdown

| Variable | Light | Dark |
| --- | --- | --- |
| `markdown-code-background-color` | `var(--primary-background-color)` | Same |

### Buttons and chips

| Variable | Light | Dark |
| --- | --- | --- |
| `ha-assist-chip-filled-container-color` | `rgba(var(--rgb-primary-text-color), 0.15)` | Same |
| `ha-assist-chip-active-container-color` | `rgba(var(--rgb-primary-color), 0.15)` | Same |
| `chip-background-color` | `rgba(var(--rgb-primary-text-color), 0.15)` | Same |
| `ha-button-primary-light-color` | Not set | `#4082a040` |
| `ha-button-warning-light-color` | Not set | `#917b54c1` |
| `ha-button-neutral-color` | Not set | `#d9dae0` |
| `ha-button-neutral-light-color` | Not set | `#6a7081` |

### Chart colors

| Variable | Light | Dark |
| --- | --- | --- |
| `color-1` | `#4269d0` | Same |
| `color-2` | `#f4bd4a` | Same |
| `color-3` | `#ff725c` | Same |
| `color-4` | `#6cc5b0` | Same |
| `color-5` | `#a463f2` | Same |
| `color-6` | `#ff8ab7` | Same |
| `color-7` | `#9c6b4e` | Same |
| `color-8` | `#97bbf5` | Same |
| `color-9` | `#01ab63` | Same |
| `color-10` | `#094bad` | Same |
| `color-11` | `#c99000` | Same |
| `color-12` | `#d84f3e` | Same |
| `color-13` | `#49a28f` | Same |
| `color-14` | `#048732` | Same |
| `color-15` | `#d96895` | Same |
| `color-16` | `#8043ce` | Same |
| `color-17` | `#7599d1` | Same |
| `color-18` | `#7a4c31` | Same |
| `color-19` | `#6989f4` | Same |
| `color-20` | `#ffd444` | Same |
| `color-21` | `#ff957c` | Same |
| `color-22` | `#8fe9d3` | Same |
| `color-23` | `#62cc71` | Same |
| `color-24` | `#ffadda` | Same |
| `color-25` | `#c884ff` | Same |
| `color-26` | `#badeff` | Same |
| `color-27` | `#bf8b6d` | Same |
| `color-28` | `#927acc` | Same |
| `color-29` | `#97ee3f` | Same |
| `color-30` | `#bf3947` | Same |
| `color-31` | `#9f5b00` | Same |
| `color-32` | `#f48758` | Same |
| `color-33` | `#8caed6` | Same |
| `color-34` | `#f2b94f` | Same |
| `color-35` | `#eff26e` | Same |
| `color-36` | `#e43872` | Same |
| `color-37` | `#d9b100` | Same |
| `color-38` | `#9d7a00` | Same |
| `color-39` | `#698cff` | Same |
| `color-40` | `#00d27e` | Same |
| `color-41` | `#d06800` | Same |
| `color-42` | `#009f82` | Same |
| `color-43` | `#c49200` | Same |
| `color-44` | `#cbe8ff` | Same |
| `color-45` | `#fecddf` | Same |
| `color-46` | `#c27eb6` | Same |
| `color-47` | `#8cd2ce` | Same |
| `color-48` | `#c4b8d9` | Same |
| `color-49` | `#f883b0` | Same |
| `color-50` | `#a49100` | Same |
| `color-51` | `#f48800` | Same |
| `color-52` | `#27d0df` | Same |
| `color-53` | `#a04a9b` | Same |
| `color-54` | `#4269d0` | Same |

### Code editor syntax

| Variable | Light | Dark |
| --- | --- | --- |
| `codemirror-keyword` | Not set | `#c792ea` |
| `codemirror-operator` | Not set | `#89ddff` |
| `codemirror-variable` | Not set | `#f07178` |
| `codemirror-variable-2` | Not set | `#eeffff` |
| `codemirror-variable-3` | Not set | `#decb6b` |
| `codemirror-builtin` | Not set | `#ffcb6b` |
| `codemirror-atom` | Not set | `#f78c6c` |
| `codemirror-number` | Not set | `#ff5370` |
| `codemirror-def` | Not set | `#82aaff` |
| `codemirror-string` | Not set | `#c3e88d` |
| `codemirror-string-2` | Not set | `#f07178` |
| `codemirror-comment` | Not set | `#545454` |
| `codemirror-tag` | Not set | `#ff5370` |
| `codemirror-meta` | Not set | `#ffcb6b` |
| `codemirror-attribute` | Not set | `#c792ea` |
| `codemirror-property` | Not set | `#c792ea` |
| `codemirror-qualifier` | Not set | `#decb6b` |
| `codemirror-type` | Not set | `#decb6b` |

### Named colors

| Variable | Light | Dark |
| --- | --- | --- |
| `red-color` | `#f44336` | Same |
| `pink-color` | `#e91e63` | Same |
| `purple-color` | `#926bc7` | Same |
| `deep-purple-color` | `#6e41ab` | Same |
| `indigo-color` | `#3f51b5` | Same |
| `blue-color` | `#2196f3` | Same |
| `light-blue-color` | `#03a9f4` | Same |
| `cyan-color` | `#00bcd4` | Same |
| `teal-color` | `#009688` | Same |
| `green-color` | `#4caf50` | Same |
| `light-green-color` | `#8bc34a` | Same |
| `lime-color` | `#cddc39` | Same |
| `yellow-color` | `#ffeb3b` | Same |
| `amber-color` | `#ffc107` | Same |
| `orange-color` | `#ff9800` | Same |
| `deep-orange-color` | `#ff6f22` | Same |
| `brown-color` | `#795548` | Same |
| `light-grey-color` | `#bdbdbd` | Same |
| `grey-color` | `#9e9e9e` | Same |
| `dark-grey-color` | `#606060` | Same |
| `blue-grey-color` | `#607d8b` | Same |
| `black-color` | `#000000` | Same |
| `white-color` | `#ffffff` | Same |

### Other

| Variable | Light | Dark |
| --- | --- | --- |
| `bar-box-shadow` | `0 2px 12px var(--shadow-color)` | Same |
| `map-filter` | Not set | `invert(0.9) hue-rotate(170deg) brightness(1.5) contrast(1.2) saturate(0.3)` |
