Skip to content

Design tokens / Colors

Colors ​

The tokens swapped per brand and per theme, defined in packages/pixel/tokens/color.css.

Every color is declared with CSS light-dark(), carrying a light and a dark value in one token:

css
--color-master-dark: light-dark(#2c2c2c, #c9c9c9);

Which one applies is decided by the page's color-scheme — see Dark mode for how to turn it on. The swatches below render whichever value is active in your browser right now.

Each family has five tones (lighter, light, base, dark, darker), except master with seven and menu with three.

Master ​

The neutral scale — text, surfaces and borders. The foundation of any composition, regardless of brand.

TokenLightDark
--color-master-lightest#fafafa#1f1f1f
--color-master-lighter#f0f0f0#3d3d3d
--color-master-light#e6e6e6#5c5c5c
--color-master#626262#a3a3a3
--color-master-dark#2c2c2c#c9c9c9
--color-master-darker#1a1a1a#e1e1e1
--color-master-darkest#0a0a0a#f5f5f5

Note how the ramp inverts between modes: master-lightest is the lightest surface in light mode and the darkest in dark mode. That's what makes a component styled with ramp steps work in both without a single override.

Primary ​

The brand's main tones — buttons and interactive elements.

Token
--color-primary-lighter
--color-primary-light
--color-primary
--color-primary-dark
--color-primary-darker

Complete ​

Completion status, progress, informational success.

Token
--color-complete-lighter
--color-complete-light
--color-complete
--color-complete-dark
--color-complete-darker

Success ​

Confirmations and positive outcomes.

Token
--color-success-lighter
--color-success-light
--color-success
--color-success-dark
--color-success-darker

Warning ​

Alerts that need attention but don't block the flow.

Token
--color-warning-lighter
--color-warning-light
--color-warning
--color-warning-dark
--color-warning-darker

Danger ​

Errors and destructive actions.

Token
--color-danger-lighter
--color-danger-light
--color-danger
--color-danger-dark
--color-danger-darker

Info ​

Informational tones — helper text, neutral notifications.

Token
--color-info-lighter
--color-info-light
--color-info
--color-info-dark
--color-info-darker

Navigation surfaces — sidebars, menus. Three tones instead of five, since menus rarely need fine gradation.

Token
--color-menu-light
--color-menu
--color-menu-dark

Pure ​

TokenValue
--color-pure-white#fff
--color-pure-black#000

The only two tokens with no light-dark() variation — they represent the absolute ends of the scale, not a semantic color, so they don't shift with the theme.

!> That also makes them the two to avoid in a theme-aware surface. A background of --color-pure-white stays white in dark mode; use --color-master-lightest when you mean "the lightest surface", not "white".

Using color ​

Pick by meaning, not by appearance:

preview
Code
html
<kb-stack direction="row" spacing="nano">
  <kb-button color="primary">Save</kb-button>
  <kb-button color="danger">Delete</kb-button>
  <kb-button color="success">Confirm</kb-button>
</kb-stack>

Any suffix of --color-* works in an element's color attribute — the value is interpolated into var(--color-{value}), so an unknown name silently resolves to nothing rather than failing loudly.