Skip to content
ZeroServer.tools

CSS Dark Mode Generator

Generate CSS custom properties and a JavaScript toggle for a complete light/dark mode theme system.

Light mode

Background
Surface
Text
Text Muted
Primary
Border

Dark mode

Background
Surface
Text
Text Muted
Primary
Border

How CSS custom properties enable dark mode

CSS custom properties (variables) are the cleanest approach to dark mode — define all colors once in :root and override them in a [data-theme="dark"] selector. The prefers-color-scheme media query auto-applies dark colors for system-preference users, while the localStorage-backed JS toggle respects explicit user overrides.

Private & free — this tool runs entirely in your browser.

Recommended: Kinsta Fast managed hosting — up to $500 + 10% recurring.affiliate

Related Design & CSS tools