Dark Mode

Dark Mode Pattern Design: Techniques & Pitfalls

Design patterns that look stunning in both light and dark modes without duplicating SVG files or JavaScript complexity.

9 min read Jan 2026 3 PDF downloads

The Core Challenge

Light-mode patterns typically use a light background with a slightly darker or more saturated motif. Naively inverting these colours for dark mode produces washed-out or garish results. Effective dark-mode patterns require carefully chosen colours — not just inversions — and often different visual weights.

Strategy 1: Opacity-Based Patterns

The most versatile approach: design patterns where the foreground motif uses a neutral colour at low opacity (e.g., fill="white" fill-opacity="0.08"). On a light background, this gives a subtle light grey motif. In dark mode, you only need to change the background-color — the white-at-8% motif naturally becomes a light shimmer on dark. No SVG changes required.

Strategy 2: CSS Custom Properties

Define pattern colours as CSS variables, then override them in a dark-mode media query. Since CSS variables don't work directly inside base64 SVGs, pre-compute two data URIs (light and dark) and swap them via @media (prefers-color-scheme: dark). More maintenance overhead than Strategy 1, but gives full control over both appearances.

:root {
  --pattern-url: url('data:image/svg+xml;base64,LIGHT_VERSION');
  --pattern-bg:  #f5f5ff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --pattern-url: url('data:image/svg+xml;base64,DARK_VERSION');
    --pattern-bg:  #1e1b4b;
  }
}
.section {
  background-image: var(--pattern-url);
  background-color: var(--pattern-bg);
}

Dark Mode Colour Principles

Dark backgrounds should not be pure black (#000000) — use very dark tinted values like #0f172a (dark blue), #111111 (warm near-black), or #0a0a0a (neutral dark). Pattern motifs on dark backgrounds should be 10–25% lighter than the background — not white. Saturated colours on dark backgrounds should be slightly desaturated to avoid vibrating.

Testing Dark Mode Patterns

Test patterns in four states: light mode (light system), dark mode (dark system), light mode high contrast, dark mode high contrast. Chrome DevTools lets you emulate all four with keyboard shortcuts. Also test in Windows High Contrast mode — it overrides all custom colours and replaces them with system colours, making patterns disappear entirely (which is usually the correct behaviour).

Avoiding Dark Mode Pitfalls

Common dark-mode mistakes: (1) Inverting colours mathematically — produces eye-straining combinations. (2) Using the same saturation on dark as on light — saturated colours on dark backgrounds glow and vibrate. (3) Pure black backgrounds — creates harsh contrast. (4) Ignoring border visibility — patterns that rely on border-colour contrast become invisible in dark mode if borders aren't also adjusted.

Dark Patterns for Hero Sections

Dark hero patterns work best when the pattern is very subtle (5–10% opacity) and the background has a slight coloured tint rather than being neutral grey. The best dark-mode hero patterns use: deep indigo, dark teal, or dark navy as the base, with barely-visible geometric motifs at 6–12% opacity white, and a radial gradient overlay to create depth and focus.