About the EDS Colour Palette Generator

How the tool generates the 15-step EDS colour scales from Tokens Studio, what each step is for, how contrast is checked, and how to propose a change.

Overview

Every colour scale in the EDS has 15 steps, and each step is generated from three inputs: the hue's anchor colour, a hand-set lightness for the step, and a Gaussian curve that decides how much of the anchor's chroma (colour intensity) the step keeps. This tool runs the same generation in the browser, so you can see what a change to the inputs does to every step, every semantic token and every contrast pair before anyone changes EDS.

Tokens Studio is the source of truth for the inputs (ADR 0016). The tool reads them from the Tokens Studio pull in packages/eds-tokens, so the default palettes, the lightness of each step and the step roles are the values that ship in @equinor/eds-tokens. A test compares every generated step with the Tokens Studio export, for all seven hues in light and dark mode, and fails if the two drift apart. A palette you edit here is therefore a proposal: EDS changes only when the change is made in Tokens Studio.

The pages

Theme Builder
Edit the palettes and see every semantic token they produce, the contrast of each text role and a preview of components. The Config button downloads your changed anchors as a proposal for Tokens Studio.
Data visualisation
Categorical, sequential and diverging palettes for charts, checked for colour vision deficiency in light and dark mode.
Palette editor
Palettes where you set each step by hand, starting from the generated ones. Saved palettes are offered on the Examples page.
Contrast
The contrast between the steps of each palette, one palette at a time or all together.
Examples
Semantic tokens from one palette applied to surfaces, text and components.

The settings button in the header switches between light and dark mode and sets the density. Each mode has its own lightness values, so the examples on this page follow the mode you choose.

How a scale is made

The generator makes each step the way Tokens Studio does. In Tokens Studio's own notation, a step is:

set_chroma(set_lightness(anchor, L), gaussian(L) × C)
  1. Start from the hue's anchor, an OKLCH colour in the Tokens Studio set input/palette. Only its chroma (C) and hue (H) are used.
  2. Replace the lightness with the step's value, L, from input/scale. The anchor's own lightness is not used for any step.
  3. Multiply the anchor's chroma by the Gaussian curve at L. The multiplier is 1 where L equals the curve's mean and falls towards 0 further away, so steps near the mean keep most of the chroma and very light or very dark steps keep little.
  4. Keep the anchor's hue unchanged.

Because every hue uses the same 15 lightness values, step 9 has the same lightness in every hue. That is why one semantic role can point at the same step for all six tones: for example, background.interactive.<tone>.emphasis.default is step 9 for accent, neutral, info, success, warning and danger, and the text on it has similar contrast in all of them.

Example: Moss Green in light mode

Generated live from the Tokens Studio values, so it follows the mode you choose in settings.

oklch(0.4973 0.084851 204.553)
Anchor: L 0.497, C 0.085, H 204.6
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15

Step 9 has L 0.52. The Gaussian curve in light mode has mean 0.6 and standard deviation 2, which gives a multiplier of 0.923 at that lightness, so step 9 has chroma 0.085 × 0.923 = 0.078 and hue 204.6. The anchor itself, at L 0.497, does not have to appear in the scale: a step looks like the anchor only where its lightness happens to be close to the anchor's.

The 15 steps

The lightness of each step is typed by hand in Tokens Studio, 15 values for light mode and 15 for dark mode, and ADR 0016 (D3) records that this is deliberate. When the scale was extended to cover hover, pressed, selected and the muted and emphasis ladders, generated lightness values did not give usable state ladders, and inserting a step into a generated scale shifted and renamed every step after it. So the 15 values are picked to make the ladders work, and everything after them, chroma and hue, is generated.

The values do not run in one straight line. In dark mode the ladder dips at steps 4 and 5, because a strictly increasing ramp could not give every role on those steps the contrast it needs. Steps 14 and 15 run in the opposite direction to steps 1 to 13: step 15 is both the text on emphasis fills and background.surface, which makes the panel surface lighter than the canvas (step 1) in light mode and darker in dark mode.

Each step exists for the semantic tokens that point at it. The table lists them as Tokens Studio names them, with <tone> standing for accent, neutral, info, success, warning or danger. The muted fills sit at steps 1 to 3, the emphasis fills at 9 to 11 and the non-interactive borders at 4, 7 and 9. Steps 6 and 14 have no semantic token in Tokens Studio today.

The 15 steps with their lightness and Tokens Studio roles
StepLight LDark LTokens Studio roles
1 muted0.9800.215
  • background.canvas
  • background.input
  • background.interactive.<tone>.muted.default
  • background.non-interactive.<tone>.muted
  • icon.inverted
  • text.inverted
2 muted hover0.9400.226
  • background.interactive.<tone>.muted.hover
  • background.interactive.disabled
  • background.interactive.read-only
3 muted pressed0.9100.470
  • background.interactive.<tone>.muted.pressed
  • background.interactive.neutral.selected.default
  • background.non-interactive.<tone>.default
4 border muted0.8700.300
  • background.interactive.neutral.selected.hover
  • border.interactive.<tone>.muted.default
  • border.interactive.disabled
  • border.non-interactive.<tone>.muted
5 selected0.8200.450
  • background.interactive.accent.selected.default
  • background.interactive.neutral.selected.pressed
  • border.interactive.<tone>.muted.hover
6 unused0.7700.595No semantic role
7 border0.7200.610
  • background.interactive.accent.selected.hover
  • border.interactive.<tone>.muted.pressed
  • border.interactive.focus
  • border.non-interactive.<tone>.default
  • icon.interactive.disabled
  • icon.tertiary
  • text.interactive.disabled
  • text.tertiary
8 selected pressed0.6200.760
  • background.interactive.accent.selected.pressed
9 emphasis0.5200.820
  • background.interactive.<tone>.emphasis.default
  • background.non-interactive.<tone>.emphasis
  • border.interactive.<tone>.emphasis.default
  • border.interactive.link.default
  • border.non-interactive.<tone>.emphasis
  • icon.interactive.link.default
  • icon.secondary
  • text.interactive.link.default
  • text.secondary
10 emphasis hover0.4700.880
  • background.interactive.<tone>.emphasis.hover
  • border.interactive.<tone>.emphasis.hover
  • border.interactive.link.hover
  • icon.interactive.link.hover
  • icon.on-default.<tone>
  • text.interactive.link.hover
  • text.on-default.<tone>
11 emphasis pressed0.4200.930
  • background.interactive.<tone>.emphasis.pressed
  • border.interactive.<tone>.emphasis.pressed
  • border.interactive.link.pressed
  • icon.interactive.<tone>.default
  • icon.interactive.link.pressed
  • text.interactive.link.pressed
12 on-muted0.3700.960
  • background.inverted
  • icon.interactive.<tone>.hover
  • icon.on-muted.<tone>
  • text.on-muted.<tone>
13 text primary0.3200.990
  • icon.interactive.<tone>.pressed
  • icon.primary
  • text.primary
14 unused0.9000.330No semantic role
15 on-emphasis1.0000.100
  • background.dialog
  • background.floating
  • background.surface
  • icon.on-emphasis.<tone>
  • text.on-emphasis.<tone>

The Gaussian chroma curve

The curve decides how much of the anchor's chroma each step keeps. It is a bell curve over lightness:

gaussian(L, mean, stdDev) = exp((-25 / stdDev) × (L - mean)²)

Tokens Studio sets the mean and standard deviation per mode in input/scale: mean 0.6 in light mode and 0.7 in dark mode, standard deviation 2 in both. The curve below starts at the light mode values (mean 0.6, standard deviation 2). Move the sliders to see how the curve, and the steps on it, change. The sliders only change this picture; the Theme Builder always uses the Tokens Studio values.

Lightness (0 to 1)Chroma multiplier0.000.250.500.751.000.000.250.500.751.00Step 1: L 0.98, multiplier 0.164Step 2: L 0.94, multiplier 0.236Step 3: L 0.91, multiplier 0.301Step 4: L 0.87, multiplier 0.402Step 5: L 0.82, multiplier 0.546Step 6: L 0.77, multiplier 0.697Step 7: L 0.72, multiplier 0.835Step 8: L 0.62, multiplier 0.995Step 9: L 0.52, multiplier 0.923Step 10: L 0.47, multiplier 0.810Step 11: L 0.42, multiplier 0.667Step 12: L 0.37, multiplier 0.516Step 13: L 0.32, multiplier 0.375Step 14: L 0.9, multiplier 0.325Step 15: L 1, multiplier 0.135Mean: 0.60

The curve gives the share of the anchor's chroma that a step keeps at each lightness:

  • Mean is the lightness where the multiplier is 1, so a step there keeps all of the anchor's chroma.
  • Standard deviation sets how wide the curve is. A lower value narrows it, so chroma drops quickly away from the mean; a higher value widens it, so more steps keep their colour.
  • The dots are the 15 steps of the scale. Steps 1 and 15, the canvas and the surface, are furthest from the mean in both modes, so they keep the least chroma.

Try it

This demo generates a scale with the light mode lightness values. It starts from the Moss Green anchor and the Tokens Studio curve for light mode. Change the anchor or the curve, and the chart shows how much chroma each step keeps. Two things are worth trying. A grey anchor, with chroma 0, gives a grey scale whatever the curve does, because the curve can only scale the chroma the anchor has. And moving the mean towards the light end makes the light steps more colourful and the dark ones duller.

Any CSS colour works, for example #ff6b6b or oklch(0.6 0.15 30).

  • Anchor chroma: 0.085
  • Most chroma: step 8 (L 0.62), chroma 0.084

Chroma per step

Step 1: L 0.98, multiplier 0.164, chroma 0.0141Step 2: L 0.94, multiplier 0.236, chroma 0.0202Step 3: L 0.91, multiplier 0.301, chroma 0.0263Step 4: L 0.87, multiplier 0.402, chroma 0.0344Step 5: L 0.82, multiplier 0.546, chroma 0.0465Step 6: L 0.77, multiplier 0.697, chroma 0.0596Step 7: L 0.72, multiplier 0.835, chroma 0.0717Step 8: L 0.62, multiplier 0.995, chroma 0.0848Step 9: L 0.52, multiplier 0.923, chroma 0.0789Step 10: L 0.47, multiplier 0.810, chroma 0.06910Step 11: L 0.42, multiplier 0.667, chroma 0.05711Step 12: L 0.37, multiplier 0.516, chroma 0.04412Step 13: L 0.32, multiplier 0.375, chroma 0.03213Step 14: L 0.9, multiplier 0.325, chroma 0.02814Step 15: L 1, multiplier 0.135, chroma 0.01115StepChroma0.000.040.08

The top of the chart is the anchor's own chroma, the most any step can have.

The generated scale

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15

Why OKLCH

OKLCH describes a colour with three numbers, and each of them matches one step of the generation. It is the polar form of the Oklab colour space, which was designed so that equal changes in the numbers look like roughly equal changes in colour.

Lightness (L)
From 0 (black) to 1 (white). Two colours with the same L look about equally light whatever their hue, which is what lets one lightness scale serve all seven hues. In HSL, by comparison, a yellow and a blue with the same lightness value look very different.
Chroma (C)
How colourful the colour is. 0 is grey; the most colourful anchor in Tokens Studio, Red, has chroma 0.23. The Gaussian curve scales this number, step by step.
Hue (H)
The angle on the colour wheel, from 0 to 360 degrees. A scale keeps the anchor's hue on every step.

OKLCH is the canonical form for EDS colour (ADR 0016, D9): the anchors are stored as OKLCH in Tokens Studio, and the published CSS uses oklch() values. The Theme Builder therefore shows colours in OKLCH by default. The OKLCH and HEX switch on the Palettes card changes every colour value on the page to HEX if you need it, and palettes are still stored in OKLCH.

Some OKLCH colours, mostly ones with high chroma, are outside the sRGB range that HEX can express. Their HEX value is brought inside sRGB, so it can look slightly less colourful than the OKLCH value.

Light and dark mode

The anchors are the same in both modes. What changes is the lightness of each step, the Gaussian curve and, for some tones, which hue the tone uses.

Lightness
Each mode has its own 15 hand-set values, shown in the table under The 15 steps. In dark mode the ladder mostly runs the other way, so the muted fills are dark and the emphasis fills and text are light.
Gaussian curve
The mean is 0.6 in light mode and 0.7 in dark mode. With the higher mean, the light steps of a dark scale keep more chroma. Step 9 in dark mode has L 0.82, and the dark curve gives it a multiplier of 0.84, where the light curve would give 0.55.
Hue per tone
The neutral tone uses Gray in light mode and North Sea in dark mode. The other tones use the same hue in both modes. Tokens Studio sets this in the scheme/light and scheme/dark sets.

All of these come from Tokens Studio, so the Theme Builder has no settings for them. The curve and the Try it demo above show what other curve settings would do.

Contrast requirements

Contrast is checked with APCA, the Accessible Perceptual Contrast Algorithm, as ADR 0016 sets out in Confirmation 5. APCA gives a contrast value called Lc, where a higher value means more contrast, and it takes into account whether the text is darker or lighter than its background. Lc 90 is the level APCA prefers for body text, and Lc 60 is its minimum for content text that is not body text, such as labels and helper text.

  • Text and icons are measured against background.surface (neutral step 15): Lc 90 for text.primary (step 13), and Lc 60 for text.secondary (step 8) and the interactive icons (steps 11 and 12).
  • Text on emphasis fills, text.on-emphasis.<tone> (step 15), is measured against the tone's default emphasis fill, background.interactive.<tone>.emphasis.default (step 9), at Lc 60.
  • Borders have no contrast requirement yet. ADR 0016 leaves them out because APCA has no agreed target for borders.

The Theme Builder checks each pair inside every palette. For palettes other than the neutral one, the palette's own step 15 stands in for background.surface; both have the same lightness. The WCAG 2.1 ratio is shown next to each requirement for reference, but the check is based on APCA.

Step 8 · selected pressed

background.interactive.accent.selected.pressed

Light mode: L = 0.620Dark mode: L = 0.760

Contrast requirements with:

Step 15 · on-emphasis

text.secondary on background.surface

APCA Lc 60:Minimum for content text that is not body/column/block text.
  • Labels, short copy, helper text: ≥24px/400 or ≥16px/700.
WCAG 4.5:1:Contrast for normal text
  • Normal text: <24px and <19px bold.

Step 11 · emphasis pressed

background.interactive.<tone>.emphasis.pressed

Light mode: L = 0.420Dark mode: L = 0.930

Contrast requirements with:

Step 15 · on-emphasis

icon.interactive.<tone>.default on background.surface

APCA Lc 60:Minimum for content text that is not body/column/block text.
  • Labels, short copy, helper text: ≥24px/400 or ≥16px/700.
WCAG 4.5:1:Contrast for normal text
  • Normal text: <24px and <19px bold.

Step 12 · on-muted

text.on-muted.<tone>

Light mode: L = 0.370Dark mode: L = 0.960

Contrast requirements with:

Step 15 · on-emphasis

icon.interactive.<tone>.hover on background.surface

APCA Lc 60:Minimum for content text that is not body/column/block text.
  • Labels, short copy, helper text: ≥24px/400 or ≥16px/700.
WCAG 4.5:1:Contrast for normal text
  • Normal text: <24px and <19px bold.

Step 13 · text primary

text.primary

Light mode: L = 0.320Dark mode: L = 0.990

Contrast requirements with:

Step 15 · on-emphasis

text.primary on background.surface

APCA Lc 90:Preferred for fluent/body text.
  • Body text: ≥14px/400 or heavier/larger.
  • Large fluent text: maximum Lc 90 when bold and >36px.
  • Small/medium text: no maximum.
WCAG 7:1:Contrast for normal text.
  • Normal text: <24px and <19px bold.

Step 15 · on-emphasis

text.on-emphasis.<tone>

Light mode: L = 1.000Dark mode: L = 0.100

Contrast requirements with:

Step 9 · emphasis

text.on-emphasis.<tone> on background.interactive.<tone>.emphasis.default

APCA Lc 60:Minimum for content text that is not body/column/block text.
  • Labels, short copy, helper text: ≥24px/400 or ≥16px/700.
WCAG 4.5:1:Contrast for normal text
  • Normal text: <24px and <19px bold.

Proposing a change to Tokens Studio

The Theme Builder starts with the seven Tokens Studio anchors. A palette stands for a Tokens Studio hue when it has the hue's name, for example Moss Green. That name is how the semantic tokens and component previews pick up your palette instead of the default, and how the download knows which anchor you changed. A palette with a new name is treated as a new hue.

  1. Change an anchor, or add a palette, on the Colour system tab. Every semantic token and the contrast of each text role update as you edit, and the Examples tab shows them on components. Check both light and dark mode in settings, because each mode has its own lightness values.
  2. Select Config and choose Tokens Studio anchors. The dialog compares each palette with Tokens Studio and marks it as changed, a new hue, or the same as Tokens Studio.
  3. Download the file. It holds only the changed and new anchors, in the shape of the Tokens Studio set input/palette, with OKLCH values written the way Tokens Studio writes them.
  4. The change takes effect when it is made in Tokens Studio. Tokens Studio then generates the 15 steps from the new anchor, and the next pull into packages/eds-tokens brings it to @equinor/eds-tokens and to this tool.

To keep your work without proposing it, use Share, which copies a link with your palettes in it, or Config and Palettes file, which downloads the palettes as a file. Config can also import a palettes file or an older palette config.

Tips

  • Give the anchor enough chroma

    The Gaussian curve can only lower the anchor’s chroma, never raise it, so the anchor’s chroma is the most any step can have. An anchor that looks muted gives a scale where every step is muted.

  • Look at the generated steps

    The anchor’s lightness is not used, so the colour you pick may not appear anywhere in the scale. Look at the steps that matter for the hue, usually the emphasis fills at steps 9 to 11 and the muted fills at steps 1 to 3.

  • Check both modes

    Light and dark mode have different lightness values and a different curve, so an anchor that works in one can fail a contrast requirement in the other. Switch mode in settings and look at the contrast results again.

  • Keep the hue’s name

    A palette named after a Tokens Studio hue, such as Moss Green, replaces that hue in the semantic tokens, the previews and the download. Renaming it makes it a new hue.

Learn more

EDS

Colour and contrast