
A good dark mode color palette uses dark gray (not pure black) backgrounds, off-white text, lighter versions of your brand colors and clear surface layers for depth. Simply inverting a light theme rarely works: saturated colors can look harsh, shadows disappear and contrast can break. This guide gives you a complete, contrast-checked dark palette and the reasoning behind each choice.
A Complete Dark Mode Palette
| Role | Color | Contrast on #121212 |
|---|---|---|
| Background | #121212 | — |
| Surface (cards) | #1E1E1E | — |
| Raised surface (menus, modals) | #2A2A2A | — |
| Primary text | #E5E7EB | 15.13:1 |
| Secondary text | #A1A1AA | 7.30:1 |
| Brand accent | #A78BFA | 6.88:1 |
| Info / links | #60A5FA | 7.36:1 |
| Success | #4ADE80 | 10.75:1 |
| Warning | #FBBF24 | 11.22:1 |
| Error | #F87171 | 6.77:1 |
Ratios were calculated with the WCAG 2 formula and rounded down. Every text and accent color above passes WCAG AA (4.5:1) on the background.
1. Use Dark Gray, Not Pure Black
Many dark themes use a dark gray like #121212 instead of #000000. Pure black with pure white text creates very harsh contrast that some readers find tiring, and it leaves no room to show depth with lighter surfaces. Dark gray softens the look while keeping text very readable.
2. Show Depth With Lighter Surfaces
In light mode, shadows separate layers. In dark mode, shadows are hard to see, so elevated elements get slightly lighter backgrounds instead: background #121212, cards #1E1E1E, menus #2A2A2A. A faint border such as rgba(255, 255, 255, 0.08) can help too.
3. Soften Your Text
Off-white text like #E5E7EB is easier on the eyes than pure white while still reaching 15.13:1. Use a mid-gray like #A1A1AA for secondary text — it still passes at 7.30:1.
4. Lighten and Desaturate Brand Colors
A brand color designed for white backgrounds may fail on dark ones. Our violet #6C5CE7 scores only 3.85:1 on #121212 — below the 4.5:1 minimum for text — while its lighter tint #A78BFA reaches 6.88:1. As a rule, use lighter, slightly less saturated versions of your accents in dark mode. Learn how in Tint vs Shade vs Tone.
5. Adjust Status Colors
Success, warning and error colors also need lighter versions. Pair them with icons or labels so meaning never depends on color alone.
Implementing Dark Mode in CSS
:root {
--bg: #FFFFFF; --surface: #F8FAFC; --text: #111827; --muted: #6B7280; --accent: #4F46E5;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #121212; --surface: #1E1E1E; --text: #E5E7EB; --muted: #A1A1AA; --accent: #A78BFA;
}
}
body { background: var(--bg); color: var(--text); }
.card { background: var(--surface); }
a { color: var(--accent); }
Using CSS variables means each component only references a role (like --surface), and the theme swaps automatically.
Alternative Dark Bases
Not every dark theme has to be neutral gray. Navy and charcoal bases create a different mood:
#0B1F3A · #172554 · #E5E7EB · #FBBF24
#2B2D31 · #3F3F46 · #F3F4F6 · #2DD4BF
Explore more in our navy and gray guides, and for bold accent ideas see neon color palettes.
Checklist
- Background is dark gray, not pure black (unless that is a deliberate style).
- Surfaces get lighter as they rise.
- Body text ≥ 4.5:1; check with the Contrast Checker.
- Accents are lighter versions of brand colors.
- Status colors have icons or text labels.
- Images and logos are tested on dark backgrounds.
Why Dark Mode Matters
Dark mode has moved from a niche preference to a standard feature. Operating systems, browsers, social apps, code editors and many websites now offer a dark theme. People choose dark mode for several reasons:
- Comfort in low light. Bright white screens can feel harsh in dark rooms or late at night.
- Reduced glare. Some users with light sensitivity or certain visual conditions find dark backgrounds easier to view.
- Battery savings. On OLED and AMOLED screens, dark pixels use less power, which can extend battery life on phones.
- Aesthetic preference. Many people simply like the sleek, focused look of dark interfaces.
It is worth noting that dark mode is not better for everyone. Some people, including many with astigmatism, find light text on dark backgrounds harder to read for long periods. That is why the best approach is to offer both themes and respect the user’s system preference.
Understanding Elevation in Dark Interfaces
In light interfaces, shadows show which elements sit above others. On dark backgrounds, shadows are hard to see, so dark themes use lighter surface colors to indicate elevation. The higher an element sits, the lighter its surface becomes.
- Base background:
#0F1115— the page itself. - Level 1 surface:
#171A21— cards and sections. - Level 2 surface:
#1F232C— dropdowns and popovers. - Level 3 surface:
#272C37— modals and dialogs.
Each step is only slightly lighter, but together they create a clear sense of depth. Some design systems achieve this by layering a semi-transparent white overlay on top of the base color, with higher elevations receiving more opacity.
Choosing Text Colors for Dark Mode
Text hierarchy works differently on dark backgrounds. Instead of using different shades of gray as you would in light mode, many dark themes use white text with different opacity levels:
- High emphasis (headings, body text): white at about 87–90% opacity, or a solid light gray such as
#E6E8EC. - Medium emphasis (secondary text, captions): white at about 60–70% opacity, or
#A3A9B5. - Disabled or hint text: white at about 38–45% opacity, or
#6B7280.
Avoid pure white #FFFFFF for long passages of text on very dark backgrounds. The extreme contrast can cause a glowing halo effect and eye fatigue. Slightly softer light grays are more comfortable while still easily passing accessibility contrast requirements.
Adapting Brand Colors for Dark Mode
Brand colors designed for white backgrounds often look wrong on dark ones. Deep colors lose contrast, and very saturated colors seem to vibrate. Here is how to adapt them:
- Lighten the color. A primary blue of
#1D4ED8on white might become#60A5FAon dark surfaces. - Reduce saturation slightly. Highly saturated colors can feel neon in the dark. Lowering saturation by 10–20% makes them calmer.
- Check contrast both ways. If a button has white text in light mode, it may need dark text in dark mode once the button color is lightened.
- Keep the hue. Changing lightness and saturation is fine, but keep the hue close to the original so the brand remains recognizable.
Examples
- Brand green
#15803D→ dark mode#4ADE80 - Brand purple
#6D28D9→ dark mode#A78BFA - Brand red
#B91C1C→ dark mode#F87171 - Brand orange
#C2410C→ dark mode#FB923C
Images, Illustrations and Logos in Dark Mode
Colors are not the only thing that needs attention in a dark theme.
Photos
Bright photos can feel glaring against a dark interface. Some websites reduce image brightness slightly in dark mode using a CSS filter such as filter: brightness(.9). Use this carefully so images do not look dull.
Illustrations
Illustrations with white backgrounds stand out as bright boxes in dark mode. Use transparent backgrounds or provide alternative versions designed for dark surfaces.
Logos
Dark logos can disappear on dark backgrounds. Prepare a light or reversed version of the logo and switch it when dark mode is active. The picture element with a prefers-color-scheme media query makes this simple.
Icons
If icons are SVGs that use currentColor, they automatically follow the text color and adapt to dark mode without extra work.
Common Dark Mode Mistakes
- Simply inverting colors. Automatic inversion turns images into negatives and produces strange brand colors. Design dark mode intentionally.
- Using pure black everywhere. Pure black backgrounds make elevation impossible to show and can cause smearing on some OLED screens when scrolling.
- Keeping light mode shadows. Dark shadows on dark surfaces are invisible. Use lighter surfaces or subtle borders instead.
- Forgetting form controls. Inputs, checkboxes and select menus may still render with white backgrounds unless you set
color-scheme: darkor style them explicitly. - Too many saturated colors. Bright accents look much stronger in the dark. Use them sparingly.
- Not testing in real conditions. Check dark mode at night with low screen brightness, which is how many people actually use it.
Letting Users Choose
The best dark mode experience respects user choice. A common pattern offers three options: Light, Dark and System. The System option follows the operating system setting, while the other two override it. Store the user’s choice so it persists between visits.
:root { color-scheme: light dark; }
[data-theme="dark"] {
--bg: #0F1115;
--surface: #171A21;
--text: #E6E8EC;
}
Setting color-scheme also tells the browser to style scrollbars and built-in form controls appropriately for the current theme.
Ready-to-Use Dark Mode Palettes
Midnight Blue (professional)
#0B1220 background, #131C2E surface, #E2E8F0 text, #94A3B8 secondary text, #60A5FA accent. A calm, trustworthy palette for dashboards and business apps.
Graphite (neutral)
#121212 background, #1E1E1E surface, #EDEDED text, #A1A1A1 secondary text, #22D3EE accent. Clean and minimal, suitable for almost any product.
Warm Night (reading)
#1A1714 background, #24201C surface, #EDE6DD text, #B5A99A secondary text, #F59E0B accent. Warm tones reduce the cold feeling of dark mode and are pleasant for blogs and e-readers.
Forest (nature)
#0E1512 background, #16201B surface, #E3EDE7 text, #9FB3A7 secondary text, #4ADE80 accent. Fresh and calm for wellness or outdoor brands.
Deep Purple (creative)
#13111C background, #1C1928 surface, #ECE9F5 text, #A9A3BD secondary text, #A78BFA accent. Stylish and modern for creative tools and entertainment.
Dark Mode for Charts and Data
Charts need special care in dark themes. Grid lines should be subtle, such as white at 8–12% opacity, so they guide the eye without adding clutter. Data colors should be lighter and slightly less saturated than their light-mode versions so lines and bars stand out clearly against the dark background. Make sure every series has at least 3:1 contrast with the background, and use labels or patterns so the chart does not depend only on color.
Tooltips and legends should follow the same surface and text rules as the rest of the interface. A tooltip on a level 2 surface with high-emphasis text keeps information readable and consistent.
Testing Your Dark Theme
- Check every text and background pair with a contrast checker.
- Review every page, not just the homepage; forms, tables, error pages and emails often get forgotten.
- Test on OLED phones and standard LCD laptops, as dark colors render differently.
- Switch themes while a page is open to confirm everything updates correctly.
- Ask a few real users to try dark mode at night and share feedback.
Dark Mode on WordPress Websites
If your website runs on WordPress, there are a few ways to add a dark theme. Some themes include a built-in dark mode toggle with color settings you can customize. Page builders often let you define global colors, which you can switch with a small amount of custom CSS using the prefers-color-scheme media query. Dedicated dark mode plugins are another option, but many rely on automatic color inversion, which can produce odd results with brand colors and images.
The most reliable approach is to define all colors as global variables, create a second set of values for dark mode and test each page template. This gives you full control and keeps your brand consistent in both themes.
Dark Mode in Emails
Many email apps now apply their own dark mode, sometimes inverting colors automatically. To keep emails looking good, use transparent PNG logos with a subtle outline or provide a light version, avoid pure black text on pure white backgrounds that may be inverted harshly, and test emails in popular clients with dark mode enabled.
Step-by-Step: Converting a Light Palette to Dark Mode
- List every color role in your light theme: page background, surfaces, borders, primary text, secondary text, links, buttons and status colors.
- Choose a dark base such as
#0F1115or a slightly tinted dark that matches your brand hue. - Create three surface levels by lightening the base in small steps.
- Set text colors to soft light grays for primary and secondary text.
- Lighten brand and status colors and reduce their saturation slightly.
- Replace shadows with subtle borders or lighter surfaces.
- Check contrast for every pair and adjust where needed.
- Swap logos and images that do not work on dark backgrounds.
Following this process role by role ensures nothing is forgotten and the dark theme feels as polished as the light one.
Tinted Dark Backgrounds
Neutral grays are safe, but a dark background with a subtle tint of your brand hue can make a dark theme feel more distinctive. A blue brand might use #0D1321, a green brand #0C1512 and a purple brand #120F1A. The tint is barely noticeable on its own, yet it harmonizes the background with accent colors and gives the interface a richer, more intentional mood. Keep the tint very subtle so text contrast and readability remain excellent.
With thoughtful surfaces, softened text, adapted brand colors and careful testing, your dark mode palette will feel comfortable, modern and fully on-brand, giving visitors a great experience whichever theme they prefer.
Borders and Dividers in Dark Mode
Light gray borders that work on white become harsh on dark backgrounds. Use borders that are only slightly lighter than the surface, such as white at 8–12% opacity, for subtle separation.
Frequently Asked Questions
What is the best background color for dark mode?
A dark gray around #121212 is a popular choice. It is softer than pure black and allows lighter surfaces to show depth.
Should dark mode use pure white text?
Off-white such as #E5E7EB is often more comfortable while still providing very high contrast.
Why do my brand colors look wrong in dark mode?
Colors designed for light backgrounds can be too dark or too intense on dark ones. Use lighter, slightly desaturated versions and re-check contrast.
Do shadows work in dark mode?
Not very well. Use lighter surface colors and subtle borders to show elevation instead.
How do I switch automatically to dark mode?
Use the CSS media query prefers-color-scheme: dark to apply dark theme variables when the user’s device is set to dark mode.
Final Thoughts
Great dark mode is designed, not inverted. Start with a dark gray base, layer lighter surfaces, soften text, lighten your accents and verify contrast. Build and test your palette with the Palette Generator and Contrast Checker.