Color guidance#
Choose a color by its role, state, and background. A token name describes its purpose; it does not guarantee contrast with every other token.
Choose by role#
- Use semantic
--token-color-*tokens:textfor content,backgroundfor surfaces,strokefor borders, andiconfor icons.componenttokens are internal to Eufemia. - Let base tokens adapt to light and dark mode. Use
inverseon surfaces that reverse with the scheme,ondarkon fixed dark surfaces, andonlightwhere available on fixed light surfaces.staticfixes the value, not its contrast. - Use
text-neutral-alternativefor secondary text and placeholders. Avoidtext-neutral-subtlefor readable content. Disabled tokens belong only on inactive controls; read-only content still needs readable contrast. - Reserve decorative tokens for branded fills. Keep each decorative set together; use semantic tokens for text and states.
Text and background pairs#
Names below omit --token-color-. For example, text-neutral means var(--token-color-text-neutral).
These pairs follow Eufemia component styles and provide at least 4.5:1 with current tokens across DNB, Eiendom, and Sbanken light and dark modes, and Carnegie light. Start with neutral surfaces for mixed content.
| Background | Text |
|---|---|
background-page-backgroundbackground-neutralbackground-neutral-subtle | text-neutraltext-neutral-alternativetext-actiontext-errortext-positivetext-warning |
background-info-subtlebackground-positive-subtlebackground-warning-subtlebackground-error-subtlebackground-marketing-subtle | text-neutral in FormStatustext-action for links |
background-positive-subtle | text-positiveSubtle positive Badge |
background-warning-subtle | text-warningSubtle warning Badge |
background-neutral-base | text-neutralTag and neutral Badge |
background-selected-subtle | text-selectedChecked ToggleButton text-neutralSelected List items |
background-actionbackground-action-hoverbackground-action-pressedbackground-selectedbackground-positive | text-neutral-inverseSelected Dropdown options and positive Badge |
background-error | text-neutral-ondarkNegative/notification Badge |
background-warning | text-neutral-onlightWarning Badge |
decorative-first-bold-static | text-neutral-ondark in Sectiontext-action-ondark in Anchor |
For fixed dark surfaces, use surface="dark" where supported. Dark mode alone does not require ondark.
Strokes and icons#
These outlines provide at least 3:1 against the listed backgrounds. Check the outside surface too when it is needed to identify the control or state.
| Background | Stroke | Use |
|---|---|---|
background-neutral | stroke-actionstroke-action-hoverstroke-action-pressed | Input border and states |
background-neutral | stroke-action-alternative | Unchecked Checkbox border |
background-neutral | stroke-error | Input error border |
background-neutral | stroke-action-focus | Focus ring |
Card and Table use stroke-neutral-subtle for subtle separation. It is not a general control outline and does not guarantee 3:1.
Use icon-* for an icon's role, even when its SVG uses stroke. Choose it against its immediate fill: a symbol inside a filled shape may need an inverse color while the surrounding text uses an action color.
Status and interaction#
- Actions: Keep inline links underlined. Choose foreground and background together for default, hover, and pressed states.
- Status: FormStatus uses neutral message text, a subtle status background, and a matching status icon and optional outline. Input keeps its value neutral; its border and message carry errors. Include text or another visible cue alongside color.
- Focus: Use the shared focus outline and keep text, icons, and backgrounds unchanged. Input uses its own border treatment. Follow the focus guidance for surface variants and exceptions.
- Selection: Keep selected separate from pressed. ToggleButton retains its selected pair during hover and press. Selected Dropdown options retain inverse text as their fill changes.
Check the result#
Token names are not a contrast guarantee. In particular:
- Do not extend the table to other text roles. Secondary/error text can fail on neutral-base, alternative, bold, and subtle status fills.
- Avoid
text-action-inverseonbackground-action,text-erroronbackground-error-subtle, andtext-action-pressedonbackground-action-pressed-subtleas general text pairs. Each falls below 4.5:1 in some supported modes. - Check rendered components in every supported brand, mode, and state. The transitional Coconut theme is not covered by the tables. Brand overrides, opacity, overlays, images, and nested surfaces can change the result.
Text needs 4.5:1, or 3:1 for large text (at least 24 CSS px, or 18.67 CSS px bold). Meaningful icons and necessary control/state cues need 3:1 against adjacent colors. Decorative separators have no automatic 3:1 requirement. Do not round a failing value up.
More guidance#
- Browse current colors.
- Implement design tokens.
- Design for dark mode.
- Check accessibility and contrast.