Colours
Colours in MDS are grouped into roles. Each colour role is represented by design tokens and has one job. Choose the role by what the colour needs to do, not by how it looks.
Colours in components
When you use MDS components, you don’t need to work with the colour tokens. A component exposes its colour role through its appearance property, so you choose the role, such as primary or error, and the component applies the right tokens for the brand and theme.
Use the tokens directly only when you build something that is not an MDS component, such as a custom layout or a chart.
Choosing a colour
| Role | Use it for | Do not use it for |
|---|---|---|
| Primary | The main action in a view, and selected states | Decoration (use Neutral), several equal actions, UI that needs a strong brand colour (use Secondary), status (use Status) |
| Secondary | One key element that needs a strong brand colour | Everyday actions (use Primary or Neutral), more than one element in a view, status (use Status) |
| Neutral | Surfaces, backgrounds, borders, dividers and text | Drawing attention to an action (use Primary or Secondary), status (use Status) |
| Status | The state of something: error, success, warning or info. Also chart fills, lines and bands that are a status | Decoration or emphasis (use Neutral, Primary or Secondary) |
| Extended | Data series in charts, and telling items apart when the other roles are not enough | Status (use Status), buttons, links and other UI the user acts on (use Primary or Secondary) |
Reading the colour tokens
Every token name follows the same pattern, for example brand_appearance_primary_default_background-color. It names the role, the shade and the property. In CSS the variable has the prefix --mds_.
The property says what the colour is for:
- Border: lines and outlines.
- Background: the fill of an element.
- On background: text and icons that sit on the matching background. Always use it with its own background, so the contrast is correct.
- Text: text that sits on the page surface. For text on a coloured background, use the on-background token instead.
- Link: link text. Only Primary has a link token.
The shade says how much emphasis the colour has. The shades are weakest, weak, default, strong and strongest, and default is the standard shade. For example, brand_appearance_neutral_weak_border-color is the weak shade of the Neutral border. Inverse shades are for surfaces that flip, such as a dark panel in a light theme. Not every role has every shade.
The tables on the colour role pages show the Maersk brand in the light and dark themes. The values for every brand and theme are in Themes and tokens.