You are reading the development docs (2026.12.1-dev.1): features here may not be released yet.
Skip to content

Colours ​

Every colour key on every LCARdS card takes the same colour values: a CSS variable, a theme token, a colour function, or any CSS colour. A colour key can also take a state map, which picks a colour from the card's entity state.

  • Colours built from CSS variables and theme tokens follow the alert mode: when red alert shifts the palette, they change with it, without a refresh. Hex and named colours stay as they are.
  • A state map (active, inactive, above:50, a state name ...) picks the colour as the entity changes; templates work too.
PageCovers
Colour ValuesCSS variables, theme tokens, colour functions such as alpha() and darken(), base(), match-light
State MapsColours by state: state and number keys, the order they are checked in, where maps work, templates
Attributes and BucketsColours from an attribute (ranges_attribute, state_attribute) and your own state groups (state_classification)

Quick start ​

Two examples to start from: one fixed colour, and a colour that follows the entity.

  • A fixed colour is a plain value. A colour that follows the entity is a map of states to colours, with default for everything else.
yaml
type: custom:lcards-button
preset: lozenge
text:
  label:
    show: true
    content: FIXED
style:
  card:
    color:
      background: alpha(var(--lcars-blue), 0.6)
yaml
type: custom:lcards-button
entity: input_boolean.lcards_test_toggle
preset: lozenge
text:
  name:
    show: true
tap_action:
  action: toggle
style:
  card:
    color:
      background:
        active: var(--lcars-orange)
        inactive: var(--lcars-gray)
        unavailable: var(--lcars-alert-red)

Colour value formats ​

What you can write in a colour key. Every format works in every colour key, on its own or as a value in a state map.

  • Quote hex colours in YAML: unquoted, #ff9900 starts a comment and the key is left empty.
FormatExampleNotes
CSS variablevar(--lcards-orange)Any --lcards-*, --lcars-* or Home Assistant variable. See CSS variables
Theme token paththeme:colors.ui.primaryA colour from the active theme. See Theme token paths
Colour functiondarken(var(--lcards-orange), 0.2)alpha(), darken(), lighten(), saturate(), desaturate(), mix(), base(). See Computed colour tokens
Hex"#F90", "#FF9900", "#FF990080"3, 4, 6 or 8 digits; the last digit (of 4) or pair (of 8) is the alpha
Named colourblack, orange, transparentAny CSS colour name, in lower case, and currentColor
RGB / HSLrgba(255, 153, 0, 0.5), hsl(36 100% 50%)Comma or space syntax, optional / alpha
Other CSS coloursoklch(0.75 0.17 60), color-mix(in srgb, red 25%, blue)hwb(), lab(), lch(), oklab(), oklch(), color(), color-mix()
Match lightmatch-lightThe colour of the card's light entity. See match-light

Card keys ​

Three top-level card keys change how state maps read the entity. They are on the Attributes and Buckets page.

yaml
type: custom:lcards-button
entity: light.tv
preset: lozenge
ranges_attribute: brightness_pct # ranges compare the brightness, 0 to 100
text:
  name:
    show: true
style:
  card:
    color:
      background:
        above:70: var(--lcars-yellow)
        active: var(--lcars-orange)
        inactive: var(--lcars-gray)
KeyTypeDefaultDescription
ranges_attributestringthe stateThe attribute that range keys (above:N, between:N:M ...) compare: see ranges_attribute
state_attributestring-The attribute whose value picks exact-match keys: see state_attribute
state_classificationobject-Which states count as active or inactive, and your own named groups: see state_classification

Released under the MIT License. | About