Contents

Documenting colors is one of the most effective ways to keep a lightweight design system consistent across products and teams. A clear color documentation strategy turns an ad hoc palette into a reusable set of named tokens, makes accessibility checks repeatable, and reduces the risk of off-brand colors appearing in shipped interfaces. This guide explains how to structure system tokens and role-based theme tokens, and how to verify text and background color combinations against WCAG contrast requirements. It is written for readers solving color documentation challenges, not for teams building a documentation site itself.
Color Tokens and System Architecture
A lightweight design system benefits from separating color values from the roles they play. Instead of hard-coding hex values directly into components, teams can define a small set of system tokens that capture the raw palette, then reference those values through role-based theme tokens that describe how colors should be used.
According to the U.S. Web Design System (USWDS), color tokens can be organized into theme tokens, state tokens, and System tokens, with project tokens forming a role-based subset. In practice, this means a lightweight system might start with base system tokens for brand colors, neutrals, and functional colors, then map those values to theme tokens such as primary, secondary, surface, background, inverse, and focus. State tokens can handle hover, active, disabled, and selected variations without duplicating base values.
Readers organizing their own tokens should consider a structure like this:
- System tokens: raw color values such as brand blue, brand green, gray-100, gray-900, and error red.
- Theme tokens: semantic names such as color-primary, color-background, color-surface, and color-text-primary that point to system tokens.
- State tokens: interaction values such as color-primary-hover, color-button-disabled, and color-focus-ring.
- Project or component tokens: role-based names scoped to a product, such as color-navbar-background or color-card-border.
This separation makes brand updates easier. If a brand color changes, the team updates the system token once and every theme token that references it inherits the new value. It also makes theming more manageable: a dark mode theme can point the same role-based tokens to different system values without changing component code.
When documenting tokens, include the token name, the intended usage, the source system token, and the output format used by your build process. For lightweight systems, a simple JSON or CSS custom properties file may be enough. Avoid inventing capabilities such as automatic syncing, plugin support, or export formats unless your tooling explicitly provides them. If you are unsure whether your tooling supports a specific token structure, check your design tool or build configuration before adopting it.
Practical steps for naming and grouping tokens
Start by listing every color your product actually uses across buttons, text, backgrounds, borders, and interactive states. Group raw values into system tokens by visual category rather than by component. Then assign each component color to a theme token that describes its role, not its appearance. For example, use color-button-primary-background instead of color-brand-blue-button so the same token can remain meaningful if the brand blue changes.
State tokens should capture deliberate interaction changes. A primary button might use color-primary-background in its default state, color-primary-hover when a pointer rests on it, and color-primary-disabled when the action is unavailable. Each state token references the appropriate system value without repeating the raw hex code in component styles.
Project-scoped tokens help large teams avoid collisions. If multiple products share a design system, product-specific names such as color-checkout-background or color-dashboard-card-border make ownership clear. Keep these tokens thin; they should point to existing theme or system tokens whenever possible instead of introducing new raw values.
Documentation fields to include
For each token, record at least the following:
- Token name and category (system, theme, state, or project)
- Intended usage and applicable components
- Source token it references, if any
- Raw value or fallback value
- Output format, such as CSS custom property, JSON entry, or design-tool variable
A lightweight system does not require complex tooling. A JSON file or CSS custom properties file can serve as the single source of truth, with build scripts generating platform-specific files. Verify your current tooling before assuming it can consume token files, apply aliases automatically, or export to multiple formats. Unsupported assumptions can create documentation that drifts from implementation.
Questions to ask before finalizing your token structure
- Do your design tool and codebase both support the same token naming convention?
- Which roles are genuinely needed, and which are being added speculatively?
- How will dark mode or high-contrast themes map to existing tokens?
- Who owns changes to system tokens versus theme tokens?
Answering these questions early helps keep the system lightweight and prevents token sprawl as the product grows.
Contrast Verification and Accessibility
Contrast verification ensures that text remains readable against its background for people with low vision and in challenging viewing conditions. The Web Content Accessibility Guidelines define contrast ratios that compare the relative luminance of two colors.
WCAG sets different thresholds depending on text size and conformance level. For normal text, the common requirement is a contrast ratio of at least 4.5:1 against its background. Large text, generally defined as text at least 18 points or 14 points bold, can meet requirements with a contrast ratio of at least 3:1. These thresholds apply to text and images of text under WCAG Level AA. Enhanced requirements under Level AAA call for at least 7:1 for normal text and at least 4.5:1 for large text.
Because exact size thresholds and conformance obligations can vary by jurisdiction and content type, readers should verify which level applies to their product before finalizing a palette.
A practical workflow for verifying contrast includes these steps:
- Identify each text and background pairing in your design system, including body text, headings, links, buttons, captions, and form labels.
- Convert your token values to a form your contrast checker accepts, such as hex, RGB, or HSL.
- Check each pairing against the applicable normal-text or large-text threshold.
- Document pass or fail results next to the relevant theme token so developers and designers can see which combinations are approved.
- Recheck combinations whenever a token value changes or a new theme is added.
Readers should not assume that a palette that looks balanced to the eye meets accessibility requirements. Some color combinations that appear distinct can still fail contrast checks, especially light grays on white or yellow text on light backgrounds. If a pairing fails, adjust the foreground or background token, choose a darker or lighter variant from the system palette, or restrict the combination to large text only where appropriate.
Token-level documentation
Store contrast results alongside each color token rather than in a separate checklist. A token record can include the token name, hex value, intended background color, text size category, measured contrast ratio, pass status for Level AA and Level AAA, and the date of the last verification. Designers and developers can reference this record before using the token in components.
Role-based contrast groups
Organize verification by token role instead of checking every color against every other color one by one. Common groups include primary text on light backgrounds, primary text on dark backgrounds, link text on neutral backgrounds, button labels, disabled text, captions, and form labels. Role-based groups reduce redundant checks while covering the most frequently used combinations.
When to recheck
Recheck contrast after any of these changes: a brand token is lightened or darkened, a new dark mode or high-contrast theme is introduced, component text size changes, or background images or gradients are added behind text. Versioning contrast results with design tokens helps teams track which combinations remain approved across releases.
Choosing alternatives when a pairing fails
If a combination does not meet the required ratio, consider selecting a darker foreground color or a lighter background color from the existing palette, introducing a new accessible variant within the same hue family, increasing text weight or size if large-text criteria apply, or limiting the combination to decorative elements rather than essential text. Each alternative should be rechecked before documentation.
Tool verification
Contrast checkers accept color values such as hex, RGB, or HSL and return a measured ratio against a chosen background. The tool does not guarantee compliance by itself; readers must confirm that the tool’s calculation method matches the WCAG version and conformance level required for their product. Outputs should be interpreted alongside official accessibility guidance rather than treated as legal certification.
For linked official guidance on using color in design systems, readers can consult the U.S. Web Design System color overview page: https://designsystem.digital.gov/design-tokens/color/overview/. This reference discusses color token organization and usage, but readers should confirm current WCAG requirements through the applicable accessibility standard for their region.

