Design Tokens Color

Color

Web Awesome's color system is made up of three layers: a color palette that gives you a full spectrum of hues, variant colors that define semantic color variations (like success and danger), and colors for themed elements that apply specific tints from your palette and variant colors to the elements that make up a theme.

For an overview of how theming works across the library, see Theming .

Color Palette

Link to This Section

Color palettes give you a full spectrum of colors to use in your project and are the lowest-level color tokens. Each color palette includes 10 different hues, each with 11 numeric tints that make up a color scale from light to dark — 95 is near white, 05 is near black.

These numeric tints help ensure accessible color contrast per WCAG 2.1 success criteria:

Core Colors

Link to This Section

In addition to numeric tints, each hue has a core color — the most colorful, vibrant tint in the scale. The exact tint varies by palette. Use --wa-color-{hue} when you want a representative color for a hue without specifying a tint.

The tint for each core color is stored as an integer in --wa-color-{hue}-key. These tokens are used internally to determine a compatible text color when using the core color as a background and are not used directly by components.

Using this key, the color system derives a paired on color guaranteed to meet WCAG 2.1 AA contrast when placed on top of the corresponding core color. If the core tint is light (≥ 60), the on color is a dark shade of that hue; otherwise it is white. Use --wa-color-{hue}-on any time you render text or icons on a core color background.

Variant Colors

Link to This Section

Variant colors are aliases for specific hues in your color palette to give them an extra layer of semantic meaning. These variants are familiar, meaningful hues that reinforce a specific message or intended use:

Variant Use Default
Brand Product recognition blue
Neutral Generic and ordinary content gray
Success Validity or confirmation green
Warning Caution or uncertainty yellow
Danger Errors or risk red

Brand and neutral are used by nearly every element, component, and pattern across the library. Success, warning, and danger are used selectively by components that could benefit from semantic reinforcement, such as buttons and callouts.

Each variant color is an alias for a palette color and follows the same token format: --wa-color-{variant}-{tint}.

Core Colors

Link to This Section

Just like the hues in your color palette, each variant has a core color — an alias for the most colorful, vibrant tint in the color scale selected for your variant. Use --wa-color-{variant} when you want a representative color for a variant without specifying a tint.

Each core color also has a paired on color (--wa-color-{variant}-on) guaranteed to meet WCAG 2.1 AA contrast when placed on top of it. Use on color tokens any time you render text or icons on a core color background.

Changing Variant Colors

Link to This Section

Any hue from your color palette can be assigned to any variant without redefining the tokens in your own stylesheet. To use a different hue, simply apply the class "wa-{variant}-{hue} to the <html> element.

<html class="wa-brand-purple wa-success-cyan"></html>

All ten palette hues — red, orange, yellow, green, cyan, blue, indigo, purple, pink, and gray — are available for every variant.

Color for Themed Elements

Link to This Section

These tokens apply specific tints from your color palette and variant colors to the elements and components that make up a theme. They're named for the role they play rather than their appearance, and adapt to light and dark modes.

Surfaces

Link to This Section

Surfaces are background layers that content rests on. They convey elevation hierarchy — raised is closest to the user (e.g., dialogs) and lowered is farthest away (e.g., wells).

Text

Link to This Section

Text colors are used for readable content. We recommend a minimum 4.5:1 contrast ratio against surface colors for text colors.

Overlays

Link to This Section

Overlays provide a backdrop that isolates content, often with some transparency so background context shows through.

Shadow

Link to This Section

A single color is used for all drop shadows. Use it alongside the shadow tokens to construct realistic shadows.

Interactions

Link to This Section

These tokens power the consistent hover, active, and focus feedback you see across interactive components. The --wa-color-focus token sets the color of the keyboard focus ring. The --wa-color-mix-hover and --wa-color-mix-active tokens are overlays — they're mixed into a component's background via color-mix() to subtly shift it on hover and press, so every interactive component reacts consistently without each one defining its own hover/active palette.

Semantic Variants

Link to This Section

Semantic variants use the --wa-color-{variant}-{tint} tokens from your variant colors to power the variant="" attribute shared by buttons, badges, callouts, and many other components. Each variant is a complete, self-contained color system built from five groups — brand, success, neutral, warning, and danger — each defining fills, borders, and on colors at three attention levels.

Tokens follow the format --wa-color-{variant}-{role}-{attention}. The three roles are:

The three attention levels are quiet, normal, and loud — from least to most visually prominent.