CSS Dark Mode Generator
Edit light and dark CSS theme colors or derive a dark palette. Inspect text and border contrast before exporting.
Enabling local controls…
Theme workflow
Jump to preview and exportSettings
Preview and export
Light theme
Changes take effect at your next sign-in.
View settings
Update available
Dark theme
Changes take effect at your next sign-in.
View settings
Update available
Light theme contrast · 10/10 pairs pass
| Color pair | Ratio | WCAG AA |
|---|---|---|
| Text / Background | 17.063:1 | PassNormal text 4.5:1 |
| Text / Surface | 17.853:1 | PassNormal text 4.5:1 |
| Muted text / Background | 7.243:1 | PassNormal text 4.5:1 |
| Muted text / Surface | 7.578:1 | PassNormal text 4.5:1 |
| Primary / Background | 7.554:1 | PassNormal text 4.5:1 |
| Primary / Surface | 7.903:1 | PassNormal text 4.5:1 |
| Accent / Background | 5.231:1 | PassNormal text 4.5:1 |
| Accent / Surface | 5.473:1 | PassNormal text 4.5:1 |
| Border / Background | 4.548:1 | PassNon-text 3:1 |
| Border / Surface | 4.759:1 | PassNon-text 3:1 |
Dark theme contrast · 10/10 pairs pass
| Color pair | Ratio | WCAG AA |
|---|---|---|
| Text / Background | 17.063:1 | PassNormal text 4.5:1 |
| Text / Surface | 13.982:1 | PassNormal text 4.5:1 |
| Muted text / Background | 12.024:1 | PassNormal text 4.5:1 |
| Muted text / Surface | 9.853:1 | PassNormal text 4.5:1 |
| Primary / Background | 8.955:1 | PassNormal text 4.5:1 |
| Primary / Surface | 7.338:1 | PassNormal text 4.5:1 |
| Accent / Background | 12.068:1 | PassNormal text 4.5:1 |
| Accent / Surface | 9.889:1 | PassNormal text 4.5:1 |
| Border / Background | 6.963:1 | PassNon-text 3:1 |
| Border / Surface | 5.705:1 | PassNon-text 3:1 |
Add the stylesheet to your site and apply the colors with var(--color-*). The device preference applies by default and the root data-theme attribute overrides it.
To offer a theme selector, place the HTML control on your page and load the optional script in the head. It stores the visitor’s selection on your own site.
CSS
:root {
--color-background: #f8fafc;
--color-surface: #ffffff;
--color-text: #0f172a;
--color-muted: #475569;
--color-primary: #4338ca;
--color-border: #64748b;
--color-accent: #0f766e;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme]) {
--color-background: #0f172a;
--color-surface: #1e293b;
--color-text: #f8fafc;
--color-muted: #cbd5e1;
--color-primary: #a5b4fc;
--color-border: #94a3b8;
--color-accent: #5eead4;
}
}
:root[data-theme="dark"] {
--color-background: #0f172a;
--color-surface: #1e293b;
--color-text: #f8fafc;
--color-muted: #cbd5e1;
--color-primary: #a5b4fc;
--color-border: #94a3b8;
--color-accent: #5eead4;
}
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }How to use this tool
Edit HEX values or load a preset, compare the two themes, and export CSS, JSON or a standalone theme selector.
When not to use it
Derived colors are starting points. Contrast covers solid color pairs shown in the report. The tool holds edits in the page; the optional exported script can store a preference on your site.
Read the guide →