Colors in UI Design

Color in a user interface isn't decoration — it's a functional tool for establishing hierarchy, signalling state and guiding attention. This guide covers the practical patterns that work in real products.

By COOLOUR Editorial Team Published Updated

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.

RolePurposeTypical usage
PrimaryMain brand actionPrimary buttons, active links, key emphasis
SecondarySecondary actionSecondary buttons, tertiary emphasis
AccentHighlightBadges, callouts, special emphasis
SuccessPositive stateConfirmations, valid fields
WarningCaution stateDegraded states, non-critical alerts
ErrorFailure stateValidation errors, destructive actions
InfoNeutral contextTooltips, help text, informational badges
NeutralStructureBackgrounds, 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:

LayerTypical lightnessExample (light mode)
Page backgroundVery light neutral#F9FAFB
Card / panelWhite or near-white#FFFFFF
Elevated surfaceSlightly darker than card#F3F4F6
Interactive surfaceSubtle brand tint#DCE9E3
Modal backdropBlack at 40% opacityrgba(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 #111827 or #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. #0D0D0D is the practical minimum. Pure black on OLED causes smearing and feels harsh on LCD.
  • Don't use pure white text. Use #F5F5F5 or 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.

FAQ

How many colors should a UI use?
About 6–8 functional roles layered over a 9–11 step neutral scale. That's the practical minimum for a professional UI.
Should primary buttons and links use the same color?
Often yes — using the same primary color for both creates a consistent "this is actionable" language. But links usually need a darker variant so they pass 4.5:1 as text.
How do I test every state for accessibility?
List every state (default, hover, active, focus, disabled) for every component, then run each text/background pair through our Contrast Checker. Also test keyboard-only navigation for focus states.