Dark Mode Converter

Convert your light mode colors to dark mode with smart role-aware conversion

Automatically convert a light mode palette to dark mode with smart role-aware conversion (background, surface, primary, secondary, text). Fine-tune results manually, analyze WCAG contrast, and export ready-to-use CSS.

Light Mode

Background
Surface
Primary
Secondary
Text

Dark Mode

Background
Surface
Primary
Secondary
Text

Contrast Analysis (Dark Mode)

Text on Background

13.92:1

AAA

Text on Surface

12.39:1

AAA

Text on Primary

2.34:1

Fail

Text on Secondary

2.03:1

Fail

Primary on Background

8.02:1

AAA

Comparative Preview

Light Mode
Brand
HomeAbout

Sample Title

This is sample text to see how your colors will look in both modes. Contrast and readability are essential.

ActionSecondary
Dark Mode
Brand
HomeAbout

Sample Title

This is sample text to see how your colors will look in both modes. Contrast and readability are essential.

ActionSecondary

Elevation Scale

In dark mode, use lighter surfaces instead of shadows to indicate elevation.

Base#121212
+1#1a1a1a
+2#212121
+3#292929
+4#313131
+5#383838

Dark Mode Tips

  • • Maintain adequate contrast (minimum 4.5:1 for text per WCAG AA)
  • • Slightly reduce saturation in dark mode to avoid visual fatigue
  • • Use dark grays (#121212) instead of pure black (#000000)
  • • Indicate elevation with lighter surfaces, not shadows
  • • Avoid pure black: it creates too much contrast with white text and causes eye strain
  • • Test your design on different devices and lighting conditions

How it works

Dark mode isn't simply inverting colors. It requires careful adjustments to luminosity, saturation, and contrast to maintain readability, visual hierarchy, and WCAG accessibility.

Dark mode principles

  • Background: Use dark grays (#121212), never pure black (#000)
  • Surface: Elevate with lighter backgrounds, not shadows
  • Colors: Reduce saturation of bright colors by 10-20%
  • Text: Use white/light gray (#E0E0E0), not pure white
  • Contrast: Maintain minimum 4.5:1 for text (WCAG AA)

🎨 Semantic Role System

This tool converts each color based on its UI role:

  • Background → Main background (#121212, L≈7%)
  • Surface → Cards and elevated surfaces (#1E1E1E, L≈12%)
  • Primary → Brand color: lightened if dark, desaturated if too vivid
  • Secondary → Accent color: similar treatment to primary
  • Text → Text: inverted to light, saturation neutralized

📐 Elevation System (Material Design)

In dark mode, elevation is indicated by lighter surfaces, not shadows:

  • Level 0: #121212 — Base background
  • Level 1: #1E1E1E — Cards, drawers
  • Level 2: #232323 — Modals, menus
  • Level 3: #282828 — Tooltips, snackbars
  • Level 4: #2D2D2D — Focused elements

💡 Practical Use Cases

Case 1: Adapt corporate palette

Your brand uses blue #2563EB on white background.

→ Dark background: #121212
→ Adjusted blue: #60A5FA (lighter, less saturated for readability)

Case 2: Elevated cards

In light mode you use shadows (box-shadow) to elevate cards.

→ In dark mode: use lighter backgrounds instead of shadows
→ Base: #121212 → Card: #1E1E1E → Elevated card: #2D2D2D

Case 3: Error/success states

Error red #DC2626 is too intense in dark.

→ Reduce saturation: #F87171
→ Keep semantic meaning but reduce visual fatigue

Case 4: CSS Implementation

Use prefers-color-scheme and CSS variables for automatic switching:

:root { --bg: #FFFFFF; --text: #212121; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #121212; --text: #E0E0E0; }
}

Frequently Asked Questions

Why not use pure black (#000)?
Pure black creates extreme contrast with white text (21:1), causing eye strain. Google Material Design recommends #121212 as the base background for a more comfortable contrast ratio (~15.4:1).
Should I invert all colors?
No. Brand colors (primary/secondary) should be adjusted in lightness and saturation but keep their identity. Only backgrounds and text need full inversion.
What minimum contrast does text need in dark mode?
WCAG AA requires a minimum ratio of 4.5:1 for normal text and 3:1 for large text (>18px). In dark mode, #E0E0E0 text on #121212 background offers ~13.8:1, meeting AAA.
How to handle elevation in dark mode?
Instead of shadows (invisible on dark backgrounds), use lighter surfaces. Each elevation level adds ~3% lightness: Base #121212, Level 1 #1E1E1E, Level 2 #232323.
Can I fine-tune the generated dark colors?
Yes. Click any color in the dark palette to edit it manually. A yellow border indicates a customized color. You can reset individually or all at once.
What does the Export CSS button do?
It generates a CSS file with custom properties for both modes (light and dark), using @media (prefers-color-scheme: dark) and [data-theme="dark"] for maximum compatibility.