Colours

Colours are named for the job they do, not the shade they are. Every theme fills in the same roles, so a component never knows which palette it wears.

When to use colour

Use colour to group related things, to separate actions from content and to point at what needs attention. Take every colour from a role token, such as --color-primary, never from a literal value.

When not to use colour

Never let colour carry meaning alone. A red border is not an error message; a green dot is not “done”. Write the state in words, and use colour as a second cue. Never use a brand colour for text or a control’s edge unless it passes 4.5:1.

The roles

Each swatch below is painted with the live theme (default). Use the header’s theme picker and watch them change.

  • Primary The one main action in a view, and the strongest brand colour. --color-primary
  • Secondary Supporting actions and links. --color-secondary
  • Accent A small, deliberate highlight. --color-accent
  • Neutral Chrome: bars, badges, quiet surfaces. --color-neutral
  • Info Helpful, non-urgent messages. --color-info
  • Success A completed or healthy state. --color-success
  • Warning Something to check before continuing. --color-warning
  • Error A failure or a blocking problem. --color-error

Surfaces and text

  • Base 100 The page and card surface. --color-base-100
  • Base 200 A recessed area behind cards. --color-base-200
  • Base 300 Borders and dividers. --color-base-300

Pairs

Every fill has a matching -content colour for the text on it. Always use them together. Body text is --color-base-content on the three base surfaces. Muted text is the body colour mixed toward its surface, never a free-standing grey.

Live contrast check

This table measures the pairs of the theme you are using, in your browser, against WCAG 2.2: 4.5:1 for normal text (AA) and 7:1 for AAA. The reference light and dark themes must pass AA; other themes are the user’s choice, so their failures are reported rather than blocked.

Contrast of colour pairs in the current theme
PairSampleRatioResult
Primary fill with its contentAa…Measuring…
Secondary fill with its contentAa…Measuring…
Accent fill with its contentAa…Measuring…
Neutral fill with its contentAa…Measuring…
Info fill with its contentAa…Measuring…
Success fill with its contentAa…Measuring…
Warning fill with its contentAa…Measuring…
Error fill with its contentAa…Measuring…
Body text on Base 100Aa…Measuring…
Body text on Base 200Aa…Measuring…
Body text on Base 300Aa…Measuring…

Links, focus and brand

  • Links keep an underline, so they are not found by colour alone, and the visited and hover states each have their own token.
  • Focus is a 2px outline with a 2px offset in --lily-focus-ring, at least 3:1 against the page, and 3px solid Highlight in forced-colours mode.
  • Brand colour (--lily-brand, --lily-on-brand) is for bands, rules and logo backgrounds only.
  • Charts use --lily-chart-color-1 to -6, always with a pattern, shape or label as well.

Make it yours without forking

Write a brand overlay: one rule on :root[data-brand], loaded after the theme, setting only documented tokens. A colour pair is set together and must be at least 4.5:1.

:root[data-brand="example"] {
  --color-primary: oklch(42% 0.14 262);
  --color-primary-content: oklch(100% 0 0);
  --lily-brand: oklch(42% 0.14 262);
  --lily-on-brand: oklch(100% 0 0);
}

Dark, high-contrast and forced colours

Dark and high-contrast are themes in their own right, switched with data-theme. When the operating system forces colours, Lily’s themes step back and let system colours through; nothing relies on a background image.