Designing a Dark Theme Design System
Most design systems start with light mode and tack on dark mode as an afterthought. We went the other direction.
Pixel Guild's design system is dark-first. Every color decision, every contrast ratio and every shadow value was chosen for dark backgrounds first. This is how we approached it and what we learned.
Why dark-first
This isn't just an aesthetic choice. Our target audience of developers and designers overwhelmingly prefers dark interfaces. They spend their days in dark editors and terminals, and a bright white page is jarring next to them.
Designing dark-first also avoids the usual failure of bolted-on dark modes. When dark mode is an afterthought, it tends to be the light theme with its colors inverted. Shadows vanish, borders glow, and colors that looked calm on white become loud on black. Starting on the dark background means those problems get solved up front, when they are still design decisions.
A monochromatic slate palette
We chose a monochromatic slate palette deliberately. It's tempting to add accent colors, but restraint creates elegance.
Our entire UI uses shades of slate:
- Backgrounds sit at the dark end, at slate-950.
- Text runs up to slate-300.
- White is reserved for emphasis.
With no accent color to lean on, hierarchy has to come from contrast, size and spacing. That constraint is useful. It forces you to decide what actually matters on a page, because you can't make everything important by coloring it blue.
It also means that when white does appear, on a headline or a primary button, it carries real weight.
Readability without eye strain
The key challenge with dark themes is maintaining readability without causing eye strain.
The instinct is to put pure white text on a near-black background for maximum contrast. In practice that much contrast is tiring over long passages. Bright text on a dark background can appear to shimmer, and it gets worse the longer you read.
We use gray-400 for body text instead of pure white. It reduces contrast just enough to be comfortable during long reading sessions while still meeting WCAG AA standards. Headings and key phrases use lighter shades so they stand out against the body text around them.
The rule we follow: check every text and background pair against WCAG AA, then pick the softest option that still passes. Meeting the standard is the floor. Comfort is the goal.
Depth through layered cards
On a light background, depth usually comes from drop shadows. Shadows barely register on a dark background, so dark interfaces often fall back on hard borders and end up looking like a grid of boxes.
Our cards use a semi-transparent slate-800 with backdrop blur, creating subtle depth without harsh borders.
<div class="rounded-xl bg-slate-800/40 backdrop-blur-sm">
...
</div>
Because the card is translucent, whatever sits behind it shows through slightly. This layering effect is what makes the design feel three-dimensional rather than flat. Soft gradient shapes behind the content give the blur something to work with.
Implementing it with Tailwind CSS v4
Tailwind CSS v4 made implementing this system straightforward. We rely on three things:
- CSS custom properties for our color tokens.
- Utility classes for common patterns.
- The
@themedirective for type-safe theme values.
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
}
:root {
--background: #020617;
--foreground: #f3f4f6;
--card: rgba(30, 41, 59, 0.4);
}
Components then use names like bg-background and text-foreground, never raw color values. The benefit is that the palette lives in one place. Adjusting a shade, or adding a second theme later, means changing a token and nothing else.
What we'd pass on
- Pick your primary theme and design for it first. A second theme added later will be better for having a solid first one.
- Limit your palette. One hue family and a clear rule for emphasis go a long way.
- Soften body text. Pass WCAG AA, then choose comfort over maximum contrast.
- Build depth from translucency and blur where shadows don't work.
- Name your tokens by purpose, such as background, foreground and card, so components never depend on a specific color.
A design system is a set of decisions you only want to make once. Making them for the theme your audience actually uses is a good place to start. If you'd like a site built this way, see our services.