Skip to content

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#

  1. Use semantic --token-color-* tokens: text for content, background for surfaces, stroke for borders, and icon for icons. component tokens are internal to Eufemia.
  2. Let base tokens adapt to light and dark mode. Use inverse on surfaces that reverse with the scheme, ondark on fixed dark surfaces, and onlight where available on fixed light surfaces. static fixes the value, not its contrast.
  3. Use text-neutral-alternative for secondary text and placeholders. Avoid text-neutral-subtle for readable content. Disabled tokens belong only on inactive controls; read-only content still needs readable contrast.
  4. 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.

BackgroundText
background-page-background
background-neutral
background-neutral-subtle
text-neutral
text-neutral-alternative
text-action
text-error
text-positive
text-warning
background-info-subtle
background-positive-subtle
background-warning-subtle
background-error-subtle
background-marketing-subtle
text-neutral in FormStatus
text-action for links
background-positive-subtletext-positive
Subtle positive Badge
background-warning-subtletext-warning
Subtle warning Badge
background-neutral-basetext-neutral
Tag and neutral Badge
background-selected-subtletext-selected
Checked ToggleButton
text-neutral
Selected List items
background-action
background-action-hover
background-action-pressed
background-selected
background-positive
text-neutral-inverse
Selected Dropdown options and positive Badge
background-errortext-neutral-ondark
Negative/notification Badge
background-warningtext-neutral-onlight
Warning Badge
decorative-first-bold-statictext-neutral-ondark in Section
text-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.

BackgroundStrokeUse
background-neutralstroke-action
stroke-action-hover
stroke-action-pressed
Input border and states
background-neutralstroke-action-alternativeUnchecked Checkbox border
background-neutralstroke-errorInput error border
background-neutralstroke-action-focusFocus 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-inverse on background-action, text-error on background-error-subtle, and text-action-pressed on background-action-pressed-subtle as 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#

Suggest an edit
Eufemia · /web/styling-and-themes/color-guidance/ · Version 11.18.1