The eight functional color roles
A professional UI needs about eight functional color roles. Not eight colors — eight roles, each of which expands into a full scale of tints and shades.
| Role | Purpose | Typical usage |
|---|---|---|
| Primary | Main brand action | Primary buttons, active links, key emphasis |
| Secondary | Secondary action | Secondary buttons, tertiary emphasis |
| Accent | Highlight | Badges, callouts, special emphasis |
| Success | Positive state | Confirmations, valid fields |
| Warning | Caution state | Degraded states, non-critical alerts |
| Error | Failure state | Validation errors, destructive actions |
| Info | Neutral context | Tooltips, help text, informational badges |
| Neutral | Structure | Backgrounds, borders, text, disabled states |
Hierarchy through lightness
The single most important rule in UI color: use lightness for hierarchy, use hue for meaning.
Lightness (how bright or dark a color is) determines how much visual weight it carries. Dark text is heavier than light text. Darker buttons are more prominent than lighter buttons. This is why neutral scales dominate professional UIs — they provide a full gradient of lightness without any competing hue signal.
Hue (red vs blue vs green) should be reserved for meaning. If blue means "action", then a blue button means "click this". If every color on the page had its own hue, hue would stop meaning anything.
The standard UI state model
Every interactive element needs to handle at least six visual states, and color plays a role in each:
- Default — the resting state. Uses the role's base color.
- Hover — 10–15% darker than default. Signals "clickable".
- Active — 20% darker than default, or with a pressed transform. Signals "being clicked".
- Focus — an outline or ring in the accent color at 2px+ with 3:1 contrast against the surrounding background. Required for keyboard users.
- Disabled — 60–70% lighter (or a neutral tone at reduced opacity). Signal "unavailable" without looking broken.
- Selected — the primary color at low opacity as a background, with a full-strength accent border. Signals "chosen".
Backgrounds and surfaces
Modern UI is built on layered backgrounds. A common scheme:
| Layer | Typical lightness | Example (light mode) |
|---|---|---|
| Page background | Very light neutral | #F9FAFB |
| Card / panel | White or near-white | #FFFFFF |
| Elevated surface | Slightly darker than card | #F3F4F6 |
| Interactive surface | Subtle brand tint | #DCE9E3 |
| Modal backdrop | Black at 40% opacity | rgba(0,0,0,0.4) |
In dark mode, invert the direction: page background is darkest, cards are slightly lighter, elevated surfaces are lighter still. Keep the same layering logic — it's just vertically flipped.
Text color hierarchy
Text color is where hierarchy lives. A common scale:
- Headings — darkest neutral, typically
#111827or#202A27. Near-black without being pure black. - Body text — one step lighter than headings, e.g.
#374151. Reads well over long passages. - Secondary text — a mid neutral, e.g.
#6B7280. Used for captions, metadata, help text. - Placeholder — a lighter neutral, e.g.
#9CA3AF. Must still pass 4.5:1 if it's a real input field's text. - Disabled text — very light neutral, e.g.
#D1D5DB. Not required to pass contrast (it's inactive), but should be visually distinct from active text. - Inverse text — text on dark backgrounds. Use the lightest neutral (
#F9FAFB) or pure white.
Feedback and validation states
Color feedback is critical in forms and interactions:
- Success — green border, green background at low opacity, green check icon. Don't rely on color alone.
- Warning — amber border, amber icon, amber background. Reserved for non-destructive warnings.
- Error — red border (2px, not 1px), red icon, red message below the field. Reserved for actual errors.
- Info — blue border or background. Neutral context, not requiring action.
Always pair color with a non-color signal (icon, text, position). This is required by WCAG 1.4.1 (Use of Color) and by good practice for users with color vision deficiency.
The 60-30-10 rule
Borrowed from interior design, this is the practical rule for how much of each color to use in a typical screen:
- 60% neutral — backgrounds, borders, whitespace.
- 30% secondary — cards, surfaces, secondary text, subdued brand color.
- 10% primary — CTAs, key actions, primary emphasis, brand moments.
The percentages don't have to be exact. The principle does: if everything is colorful, nothing stands out. Restraint is what makes the primary color feel like a "primary" color.
Dark mode considerations
Dark mode is not just "invert the palette". Specifically:
- Don't use pure black.
#0D0D0Dis the practical minimum. Pure black on OLED causes smearing and feels harsh on LCD. - Don't use pure white text. Use
#F5F5F5or similar — pure white creates too much contrast against dark backgrounds, which causes eye strain. - Desaturate brand colors slightly. Saturated colors vibrate uncomfortably on dark backgrounds. Reduce saturation by 5–15% for dark mode.
- Elevate via lightness, not shadow. In dark mode, shadows are nearly invisible. Elevation is communicated by making surfaces lighter, not darker.
- Redesign, don't invert. Some color relationships need entirely different treatment. Take the time to design the dark palette as its own thing.
Accessibility for every state
Every state combination must pass WCAG 2.2 AA:
- Default text on backgrounds: 4.5:1.
- Button labels on button backgrounds: 4.5:1.
- Borders and focus rings: 3:1.
- Disabled state visually distinct from default: perceptible, not necessarily 4.5:1.
- Interactive icons: 3:1.
Use our Contrast Checker for every combination and our WCAG Checker for full compliance reports.