Colour
Contrast and differentiation
Colour tokens are named for the role of the element they colour, such as text, a surface or a control. Every semantic colour has a light and a dark value.
Our colour system is rooted in the GLA brand palette. The GLA Brand palette consists of 12 different colours. Using these colours as 'seeds' the design system defines a set of colours that balance the requirements of GLA brand recognition, colour differentiation, contrast and interoperability between light and dark themes.
Note Throughout the documentation we use the British spelling 'colour'. In code we use the international spelling 'color' as this is the accepted standard.
Use
The components use the colour tokens already. In your own markup, use the custom property for the role of the element:
.summary {
background: var(--color-surface);
border: 1px solid var(--color-border-wash);
color: var(--color-text);
}
.summary-note {
color: var(--color-text-muted);
}Text on a surface
Secondary text, such as a source
If your app uses Tailwind, as the component library does, the preset makes each colour token a utility, such as bg-color-surface, border-color-border-wash and text-color-text-muted.
For buttons and links, use the components. Each one uses the interactive tokens for its emphasis and state:
<Button emphasis="primary">Apply filters</Button>
<Button emphasis="secondary" variant="outline">Clear</Button>To use a colour in JavaScript, for example to pass it to a chart library, use theme from @ldn-viz/ui. It returns the value for the current mode:
import { theme } from '@ldn-viz/ui';
const background = theme.tokenNameToValue('surface');
const note = theme.tokenNameToValue('text.muted');How it works
Light and dark
Colours are available in two sets specially tuned for light or dark themed applications. Modes explains how an app switches between them.
Choosing a colour
Colours should be referenced using token names. Hex values are provided here only for reference. Choose a token by the role of the element:
| Group | Tokens | Use for |
|---|---|---|
| Text | --color-text, --color-text-muted | Text, in decreasing emphasis |
| Label | --color-label, --color-label-muted | Labels on controls |
| Canvas | --color-canvas, --color-canvas-muted | The page background |
| Surface | --color-surface and --color-surface-{role}, each with a -muted version | Cards, panels and status areas |
| Border | --color-border, --color-border-muted, --color-border-wash | Borders, in decreasing emphasis |
| Interactive | --color-interactive-* | Controls, links and their states |
| Inverse | --color-inverse-* | Content on an inverse background |
| Static | --color-static-white, --color-static-black, --color-static-brand, --color-static-gla-{hue} | Colours that don't change with the mode |
| Data | --color-data-* | Chart and map data |
| Chart | --color-chart-surface, -axis, -grid, -label, -label-muted | Chart backgrounds, axes, grid lines and labels |
| Geo | --color-geo-* | Maps |
The data, chart and geo colours are described in Data visualisation.
Text and labels
Text has two levels of emphasis: --color-text for most text, and --color-text-muted for secondary text such as a source or a placeholder. Labels on controls use --color-label and --color-label-muted.
<p style="color: var(--color-text)">Text</p>
<p style="color: var(--color-text-muted)">Secondary text, such as a source</p>Text
Secondary text, such as a source
Canvas and surface
The canvas is the page background. A surface is a card or panel on it. The two have the same value in each mode, and elevation sets a surface apart from the canvas. --color-surface-muted sets a region apart inside a surface.
<div class="elevation-2" style="background: var(--color-surface)">
<p>A panel</p>
<div style="background: var(--color-surface-muted)">A region inside the panel</div>
</div>A panel
The surface roles are accent, alpha, beta, positive, negative, caution, neutral and empty. Each has a -muted version. The Callout component uses the muted version as its fill and the role colour as its border:
<Callout status="positive">
{#snippet title()}Filters saved{/snippet}
{#snippet body()}Your filters will be applied next time you open the dashboard.{/snippet}
</Callout>Borders
Borders have three levels of emphasis, from --color-border, the strongest, to --color-border-wash. --color-border-muted is the edge of a control, such as a field or a checkbox, and keeps a contrast of 3:1 on --color-surface. --color-border-wash is for dividers and the edges of containers.
Interactive colours
Interactive tokens are chosen by intent, then emphasis, then state: --color-interactive-{intent}[-muted][-{state}]. The intents are primary, secondary, positive, negative and caution. The states are hover and active.
Text and icons on a filled control use --color-inverse-text. The exception is primary, whose fill stays dark in both modes. Its text uses --color-static-white.
--color-interactive-primary-text, with hover and active states, is for links and text buttons. The selection and availability states, such as --color-interactive-selected and --color-interactive-error, are tokens of their own. Disabled text and icons use --color-interactive-disabled, and a disabled fill uses --color-interactive-disabled-muted.
Focus has one colour, --color-interactive-focus. Accessibility describes how focus is shown.
Inverse and static colours
Content on an inverse background uses the inverse tokens, such as --color-inverse-text on --color-inverse-surface. Design tokens shows how they change between modes.
static colours don't change with the mode. They are for content that must look the same in both modes: --color-static-white, --color-static-black, --color-static-brand, and the GLA brand hues as --color-static-gla-{hue}.
Palette
The colour palette consists of 10 colours, each available in 11 different tints and shades: (color-100 to color-1100).
Perceptual uniformity is maintained within each hue in the colour palette. As a result, colours like blue-600 and darkPink-600 have nearly identical contrast ratios when paired with the same colour.
The palette is used only for a quantitative scale in a chart or map, described in Quantitative colour. For any other colour, use a semantic token.
Do:
p {
color: var(--color-text);
}Don't:
p {
color: var(--color-palette-grey-900);
}Contrast
Text needs a contrast of at least 4.5:1 with its background, and large text 3:1. Controls and the parts of a chart that show data need 3:1. Accessibility lists the exceptions.
Reference
These tables list the colour tokens for interfaces, with their light and dark values. The data, chart and geo tokens are in the Design tokens reference.
Palette
The swatches show the palette in the current mode.
Grey
Blue
Green
Yellow
Orange
Red
Pink
Dark pink
Purple
Turquoise
Canvas
| Token | Light | Dark |
|---|---|---|
--color-canvas | #ffffff | #0e1316 |
--color-canvas-muted | #f7f8f9 | #151b1e |
Surface
| Token | Light | Dark |
|---|---|---|
--color-surface | #ffffff | #0e1316 |
--color-surface-accent | #0067b4 | #4c9fea |
--color-surface-accent-muted | #e6f2fd | #003162 |
--color-surface-negative-muted | #ffede9 | #6b0000 |
--color-surface-positive-muted | #e9f4eb | #003b12 |
--color-surface-caution-muted | #ffece4 | #631400 |
--color-surface-neutral-muted | #f0f1f2 | #192023 |
--color-surface-empty-muted | #f0f1f2 | #192023 |
--color-surface-muted | #f0f1f2 | #192023 |
--color-surface-alpha-muted | #ffecef | #69001f |
--color-surface-beta-muted | #e6f2fd | #003162 |
--color-surface-alpha | #c9004a | #d80053 |
--color-surface-beta | #007acc | #007acc |
--color-surface-neutral | #d6d8da | #2b3338 |
--color-surface-negative | #cd0000 | #ff695f |
--color-surface-positive | #007534 | #51ac6e |
--color-surface-caution | #b83700 | #fc6f38 |
--color-surface-empty | #bdc0c2 | #3d454b |
Text
| Token | Light | Dark |
|---|---|---|
--color-text | #353d43 | #ffffff |
--color-text-muted | #5f666b | #c5c8ca |
--color-text-wash | #5f666b | #c5c8ca |
Label
| Token | Light | Dark |
|---|---|---|
--color-label | #353d43 | #ffffff |
--color-label-muted | #5f666b | #c5c8ca |
Border
| Token | Light | Dark |
|---|---|---|
--color-border | #5f666b | #c5c8ca |
--color-border-muted | #8c9295 | #676e73 |
--color-border-wash | #d6d8da | #52595e |
Interactive
| Token | Light | Dark |
|---|---|---|
--color-interactive-selected | #0067b4 | #006fc0 |
--color-interactive-on | #0067b4 | #006fc0 |
--color-interactive-off | #8c9295 | #676e73 |
--color-interactive-dragged | #3c96e4 | #006fc0 |
--color-interactive-primary | #0067b4 | #006fc0 |
--color-interactive-primary-active | #003c74 | #004582 |
--color-interactive-primary-muted | #e6f2fd | #001f42 |
--color-interactive-primary-muted-hover | #b9dbfd | #003162 |
--color-interactive-primary-muted-active | #90c5f9 | #004582 |
--color-interactive-primary-hover | #005194 | #0059a2 |
--color-interactive-primary-text | #0067b4 | #4c9fea |
--color-interactive-primary-text-hover | #005194 | #75b6f5 |
--color-interactive-primary-text-active | #003c74 | #9dccfb |
--color-interactive-secondary | #5f666b | #adb2b4 |
--color-interactive-secondary-hover | #495157 | #c5c8ca |
--color-interactive-secondary-active | #353d43 | #e0e1e2 |
--color-interactive-secondary-muted | #d6d8da | #2b3338 |
--color-interactive-secondary-muted-hover | #bdc0c2 | #3d454b |
--color-interactive-secondary-muted-active | #a4a8ac | #52595e |
--color-interactive-negative | #cd0000 | #ff695f |
--color-interactive-negative-hover | #a50000 | #ff9387 |
--color-interactive-negative-active | #7f0000 | #ffb6ab |
--color-interactive-negative-muted | #ffede9 | #6b0000 |
--color-interactive-negative-muted-hover | #ffccc4 | #8f0000 |
--color-interactive-negative-muted-active | #ffaa9e | #b50000 |
--color-interactive-positive | #007534 | #51ac6e |
--color-interactive-positive-hover | #005d24 | #7ac08d |
--color-interactive-positive-active | #004617 | #a2d4ae |
--color-interactive-positive-muted | #e9f4eb | #003b12 |
--color-interactive-positive-muted-hover | #bde0c5 | #003b12 |
--color-interactive-positive-muted-active | #94cda2 | #00501d |
--color-interactive-caution | #b83700 | #fc6f38 |
--color-interactive-caution-hover | #972700 | #ff956b |
--color-interactive-caution-active | #751a00 | #ffb898 |
--color-interactive-caution-muted-hover | #ffcdb6 | #831f00 |
--color-interactive-caution-muted-active | #ffac88 | #a42d00 |
--color-interactive-caution-muted | #ffece4 | #631400 |
--color-interactive-disabled | #8c9295 | #959b9e |
--color-interactive-disabled-muted | #d6d8da | #3d454b |
--color-interactive-focus | #0067b4 | #006fc0 |
--color-interactive-error | #cd0000 | #ff695f |
Inverse
| Token | Light | Dark |
|---|---|---|
--color-inverse-canvas | #0e1316 | #ffffff |
--color-inverse-canvas-muted | #151b1e | #f7f8f9 |
--color-inverse-text | #ffffff | #2b3338 |
--color-inverse-text-muted | #bdc0c2 | #676e73 |
--color-inverse-text-wash | #bdc0c2 | #676e73 |
--color-inverse-surface | #13181c | #f9f9f9 |
--color-inverse-surface-muted | #353d43 | #e0e1e2 |
--color-inverse-chart-label | #ffffff | #2b3338 |
--color-inverse-chart-label-muted | #bdc0c2 | #676e73 |
--color-inverse-chart-axis | #ffffff | #2b3338 |
--color-inverse-chart-grid | #232a2e | #e0e1e2 |
--color-inverse-chart-surface | #0e1316 | #ffffff |
--color-inverse-geo-feature | #ffffff | #2b3338 |
--color-inverse-geo-feature-muted | #8c9295 | #676e73 |
--color-inverse-geo-interactive | #0067b4 | #4c9fea |
--color-inverse-geo-interactive-hover | #005194 | #75b6f5 |
--color-inverse-geo-interactive-selected | #fff200 | #fff200 |
--color-inverse-geo-interactive-focus | #0067b4 | #4c9fea |
--color-inverse-geo-interactive-disabled | #8c9295 | #959b9e |
--color-inverse-geo-interactive-error | #cd0000 | #ff695f |
--color-inverse-geo-label | #ffffff | #2b3338 |
--color-inverse-geo-label-muted | #bdc0c2 | #676e73 |
--color-inverse-geo-annotation | #ffffff | #2b3338 |
--color-inverse-geo-annotation-muted | #bdc0c2 | #676e73 |
--color-inverse-border | #ffffff | #2b3338 |
--color-inverse-border-muted | #8c9295 | #676e73 |
--color-inverse-border-wash | #52595e | #d6d8da |
Static
| Token | Light | Dark |
|---|---|---|
--color-static-brand | #007acc | #007acc |
--color-static-white | #ffffff | #ffffff |
--color-static-black | #000000 | #000000 |
--color-static-gla-darkblue | #00577d | #00577d |
--color-static-gla-blue | #007acc | #007acc |
--color-static-gla-cyan | #00aeef | #00aeef |
--color-static-gla-green | #008743 | #008743 |
--color-static-gla-yellow | #fff200 | #fff200 |
--color-static-gla-mustard | #dca000 | #dca000 |
--color-static-gla-orange | #e85713 | #e85713 |
--color-static-gla-red | #eb001b | #eb001b |
--color-static-gla-pink | #e7135d | #e7135d |
--color-static-gla-darkpink | #9e0059 | #9e0059 |
--color-static-gla-purple | #ae4ac6 | #ae4ac6 |
--color-static-gla-grey | #353d42 | #353d42 |
The full rules for colour are in the specification.