A reliable UI color palette is easier to maintain when colors are organized by purpose rather than by appearance. This practical checklist explains how to name brand, surface, text, border, status, interaction, and dark-mode tokens, with a reusable table and CSS example you can adapt to a design system.
Overview
Color tokens are named values that connect a design decision to a reusable interface role. Instead of assigning a button a raw value such as #2563EB, you might assign it --color-action-primary. The name describes how the color is used, while the underlying value can change without requiring every component to be redesigned.
This distinction matters when a product gains a dark theme, adds a new brand expression, or supports several products from one shared system. A raw color name such as blue-600 can be useful inside a palette, but it does not explain whether that blue is intended for links, buttons, selected navigation, or decorative artwork. A semantic token does.
Raw color names versus semantic names
| Approach | Example | Best use | Limitation |
|---|---|---|---|
| Raw or scale-based | blue-600 | Building and documenting a color scale | The name does not describe interface meaning |
| Semantic or role-based | text-primary | Applying color to components and content | Requires clear role definitions |
A practical system often uses both layers. Keep raw values or palette steps as foundational tokens, then map them to semantic tokens. Components should normally consume semantic tokens, not the foundation directly.
A simple token hierarchy
- Foundation tokens: hue scales, neutral scales, spacing-independent color values, and theme-specific raw values.
- Semantic tokens: roles such as page background, primary text, focus ring, success, or destructive action.
- Component tokens: optional exceptions such as button-primary-background or input-border-focus.
Start with foundation and semantic layers. Add component-specific tokens only when a component genuinely needs behavior that cannot be expressed by the shared roles.
Checklist by scenario
1. Naming brand tokens
- Separate the brand identity from its interface role. Use names such as
brand-primary,brand-secondary, orbrand-accentfor approved identity colors. - Do not assume every brand color is suitable for text, borders, or small controls. Create separate semantic mappings such as
action-primaryorlink-defaultafter checking readability. - Record whether a token is intended for backgrounds, foregrounds, accents, or decorative use.
Brand tokens are the bridge between a brand color palette and a working UI color palette. For a broader contrast workflow, see How to Build an Accessible Brand Color Palette.
2. Naming surface tokens
- Define a clear base surface, such as
surface-page, for the main application background. - Add roles for raised or grouped areas, such as
surface-panel,surface-card, andsurface-inverse. - Use names that describe elevation or context rather than a color family. A card may change from white to a tinted neutral in dark mode without changing its role.
3. Naming text tokens
- Use a small, intentional set:
text-primary,text-secondary,text-muted,text-inverse, andtext-disabled. - Define where each role is appropriate. For example, muted text should not be the only way essential information is conveyed.
- Pair text roles with their expected surfaces in documentation and contrast checks.
4. Naming border and divider tokens
- Separate
border-default,border-subtle,border-strong, anddivider-defaultonly when they have distinct purposes. - Add a dedicated
border-focusorfocus-ringtoken instead of reusing a general accent automatically. - Check borders on both light and dark surfaces. A border that is visible on a page background may disappear inside a card.
5. Naming status tokens
- Group status roles consistently:
status-success,status-warning,status-error, andstatus-info. - Consider separate background, foreground, border, and icon roles when a status message contains several visual layers, for example
status-error-backgroundandstatus-error-text. - Do not rely on color alone. Pair status colors with text, icons, labels, or patterns where appropriate.
6. Naming interaction tokens
- Cover default, hover, pressed, selected, focus, visited, and disabled states where the component uses them.
- Use a consistent structure such as
action-primary-background-default,action-primary-background-hover, andaction-primary-background-pressed. - Keep interaction tokens semantic. Avoid names such as
dark-blue-hoverbecause the value may change during a refresh.
7. Naming dark-mode tokens
- Keep the semantic names stable across themes. The token
surface-pageshould remainsurface-pagein both light and dark mode. - Change the mapped values, not the component styles, wherever possible.
- Review hierarchy, contrast, borders, focus indicators, status colors, illustrations, and imagery as a group. Dark mode is not simply an inversion of every color.
Copyable token table
Use this starter table as a worksheet. Replace the sample values after testing them in the actual interface.
| Token | Purpose | Light value | Dark value |
|---|---|---|---|
brand-primary | Core identity color | #2563EB | #60A5FA |
surface-page | Main application background | #FFFFFF | #111827 |
surface-panel | Cards and grouped regions | #F8FAFC | #1F2937 |
text-primary | Main content | #111827 | #F9FAFB |
text-secondary | Supporting content | #475569 | #CBD5E1 |
border-default | Standard component boundary | #CBD5E1 | #475569 |
focus-ring | Keyboard and interaction focus | #7C3AED | #A78BFA |
status-success | Positive state | #15803D | #4ADE80 |
status-error | Error or destructive state | #B91C1C | #F87171 |
These values are illustrative starting points, not a finished accessible palette. Test each foreground and background pairing in context.
What to double-check
- Contrast: Check normal text, large text, icons that communicate meaning, controls, focus indicators, and meaningful borders. Review the accessibility criteria your product has adopted rather than assuming that a visually pleasing combination is sufficient.
- State coverage: Every interactive component should have a documented response for at least default, hover or pointer-over, focus, pressed or active, selected, and disabled states where relevant.
- Token scope: Ask whether a token is global, theme-specific, or component-specific. A global name should not hide a one-off exception.
- Color format: Choose a format that fits the workflow. HEX is familiar for handoff, while RGB, HSL, or OKLCH may be useful for particular editing or color-adjustment tasks. See HEX, RGB, HSL, and OKLCH Explained.
- Tool mapping: Confirm that names remain consistent between design-library variables, exported styles, documentation, and CSS. If a design tool uses collections, modes, or variables, map those concepts to the same semantic vocabulary.
- Real content: Test long labels, error messages, empty states, data tables, overlays, images, and user-generated content. Color relationships often change when content is not perfectly controlled.
:root {
--color-surface-page: #ffffff;
--color-surface-panel: #f8fafc;
--color-text-primary: #111827;
--color-text-secondary: #475569;
--color-border-default: #cbd5e1;
--color-focus-ring: #7c3aed;
--color-action-primary: #2563eb;
}
[data-theme="dark"] {
--color-surface-page: #111827;
--color-surface-panel: #1f2937;
--color-text-primary: #f9fafb;
--color-text-secondary: #cbd5e1;
--color-border-default: #475569;
--color-focus-ring: #a78bfa;
--color-action-primary: #60a5fa;
}
.button-primary {
background: var(--color-action-primary);
color: var(--color-text-inverse, #ffffff);
}Common mistakes
- Using palette values directly in components: This creates hidden dependencies and makes themes difficult to maintain. Map foundation values to roles first.
- Overloading one token: A token called
primarymay be used for links, buttons, headings, and illustrations even though those uses need different contrast and state behavior. Prefer precise names. - Encoding visual assumptions in names: Names such as
white-cardordark-borderbecome misleading when a theme changes. Describe function instead. - Creating too many near-duplicate roles: A long list of barely different grays makes adoption harder. Add a token when it represents a real design decision, not merely a small value difference.
- Treating dark mode as a filter: Reversing light and dark values can weaken hierarchy, make colored accents too bright, or reduce the visibility of borders and focus indicators. Review each role intentionally.
- Relying on color alone: Success, warning, error, and selection should remain understandable through labels, icons, placement, text, or other cues.
When to revisit
Review the token system before a seasonal planning cycle, a brand refresh, a redesign, or the launch of a new product area. Revisit it when a workflow or design tool changes, when a new theme is introduced, or when multiple products begin sharing components. It is also worth checking after adding complex components such as charts, tables, overlays, forms, or notification systems.
Use this short maintenance checklist:
- List new components and assign semantic roles before choosing raw values.
- Check whether any component bypasses the token layer with a hard-coded color.
- Test light and dark themes with real content and interaction states.
- Review contrast and non-color cues for text, controls, statuses, and focus.
- Remove duplicate or obsolete tokens and update the reference table.
- Confirm that design-library names, CSS variables, documentation, and exported assets still match.
Keep the token table beside the design-system documentation, not in a one-time project note. When colors are treated as named decisions rather than scattered swatches, a UI color palette can evolve with the product while remaining easier to understand, test, and reuse.