Colors in UI Design

By COOLOURPublished 2026-11-2111 min read

Every UI component needs a color, and every color needs a role. Here's how to assign them.

Backgrounds

Most of the screen is background. Use near-white (#FAFAFA) for pages, white (#FFFFFF) for cards on top, and a slightly darker tint (#F3F4F6) for hover states.

Text

Primary text: #111827 (near-black). Secondary text: #4B5563. Placeholder: #9CA3AF. Never use pure black #000000 for body text — it's too harsh.

Borders and dividers

Borders need to be visible but not attention-grabbing. #E5E7EB for subtle dividers, #D1D5DB for input borders, #9CA3AF for focused borders.

Buttons

  • Primary: brand color at 600 level (e.g. #2563EB). Hover: 700 (#1D4ED8).
  • Secondary: white with border, or brand at 100 level.
  • Destructive: red 600 (#DC2626), hover red 700.
  • Disabled: gray 300 with gray 500 text.

Semantic states

  • Success: #16A34A (green-600)
  • Warning: #D97706 (amber-600)
  • Error: #DC2626 (red-600)
  • Info: #0284C7 (sky-600)

Focus states

Focus must always be visible. Use 2px offset ring in brand color at 500 level. Test keyboard navigation on every component.

Dark mode

Dark mode isn't inverted light mode. Backgrounds: #0F172A to #1E293B. Text: #F1F5F9. Primary: brand 400 instead of 600. Reduce shadows; increase border visibility.

Related tools