Dark Mode Generator

Convert your light theme colors into a dark mode palette with contrast checks

Light Theme Colors

Options

85%

Preview

Dashboard
Welcome back
StatusActive
Credits2,450
Light Mode
Dashboard
Welcome back
StatusActive
Credits2,450
Dark Mode

Color Tokens

TokenLightDarkContrast
Background
#ffffff
#262626
-
Surface
#f5f5f5
#333333
-
Surface Variant
#ffffff
#404040
-
Primary
#4a90e2
#4691e7
-
Primary Variant
#77ace9
#94bae6
-
Text Primary
#1a1a1a
#e6e6e6
12.13:1 AAA
Text Secondary
#666666
#b3b3b3
7.22:1 AAA
Text Disabled
#9e9e9e
#737373
3.19:1 AA Large
Border
#e0e0e0
#4d4d4d
-
Divider
#eeeeee
#404040
-
Error
#e53935
#ea312e
-
Success
#43a047
#57c15d
-
Warning
#fb8c00
#ff981a
-

CSS Variables

:root {
  /* Light Theme */
  --color-background: #ffffff;
  --color-surface: #f5f5f5;
  --color-primary: #4a90e2;
  --color-text-primary: #1a1a1a;
  --color-border: #e0e0e0;
}

[data-theme="dark"] {
  --color-background: #262626;
  --color-surface: #333333;
  --color-surface-variant: #404040;
  --color-primary: #4691e7;
  --color-primary-variant: #94bae6;
  --color-text-primary: #e6e6e6;
  --color-text-secondary: #b3b3b3;
  --color-text-disabled: #737373;
  --color-border: #4d4d4d;
  --color-divider: #404040;
  --color-error: #ea312e;
  --color-success: #57c15d;
  --color-warning: #ff981a;
}

SCSS Variables

// Dark Mode SCSS Variables
$dark-background: #262626;
$dark-surface: #333333;
$dark-surface-variant: #404040;
$dark-primary: #4691e7;
$dark-primary-variant: #94bae6;
$dark-text-primary: #e6e6e6;
$dark-text-secondary: #b3b3b3;
$dark-text-disabled: #737373;
$dark-border: #4d4d4d;
$dark-divider: #404040;
$dark-error: #ea312e;
$dark-success: #57c15d;
$dark-warning: #ff981a;

Tailwind Config

// tailwind.config.js
module.exports = {
  darkMode: 'class',
  theme: {
    extend: {
      colors: {
        dark: {
          bg: '#262626',
          surface: '#333333',
          'surface-variant': '#404040',
          primary: '#4691e7',
          'primary-variant': '#94bae6',
          'text-primary': '#e6e6e6',
          'text-secondary': '#b3b3b3',
          border: '#4d4d4d',
          divider: '#404040',
        }
      }
    }
  }
}

Dark Mode Design Tips

Avoid Pure Black

Use dark grays (#121212-#1e1e1e) instead of #000000 to reduce eye strain and allow elevation shadows

Desaturate Colors

Bright saturated colors on dark backgrounds cause visual vibration. Desaturate and lighten for comfort

Use Elevation

Lighter surfaces appear closer to the user. Use multiple surface levels to create depth hierarchy

Check Contrast

Ensure text meets WCAG AA (4.5:1) or AAA (7:1) contrast ratios against dark backgrounds

Best Practices

  • Use CSS custom properties (variables) for easy theme switching
  • Test on OLED screens where true black saves battery
  • Respect the user's system preference with prefers-color-scheme media query
  • Reduce white text font weight slightly - light text on dark appears heavier
  • Use semi-transparent overlays instead of solid colors for adaptive surfaces
  • Always provide a manual toggle alongside system-level detection