dark mode design tips Key Takeaways
Implementing the right dark mode design tips helps you cater to users with visual sensitivities, such as photophobia or astigmatism, who often find bright white backgrounds painful.
- Use true black (#000000) sparingly; dark grays like #121212 reduce eye fatigue better.
- Maintain WCAG AA contrast ratios (4.5:1 for text) to ensure readability in dark mode.
- Allow users to toggle between light and dark modes, respecting their system preference when possible.

Why Dark Mode Design Tips Matter for User Experience
Dark mode has moved from a niche preference to a core accessibility feature. Over 80% of users say they prefer dark mode for late-night browsing, and major platforms like macOS, Android, and Windows now offer system-wide dark themes. For web designers, ignoring dark mode means missing a major opportunity to enhance user satisfaction and retention. For a related guide, see 10 Web Accessibility Best Practices Every Developer Must Follow.
Implementing the right dark mode design tips helps you cater to users with visual sensitivities, such as photophobia or astigmatism, who often find bright white backgrounds painful. Moreover, dark mode can reduce screen glare in low-light environments, making your site more comfortable to use during long reading sessions.
Below, we break down ten actionable tips to help you design a dark mode that is both beautiful and functional.
1. Start with a Dark Gray Background, Not Pure Black
One of the most common dark mode design tips is to avoid pure black (#000000) for backgrounds. True black creates harsh contrast against text colors, leading to eye strain. Instead, use a dark gray like #121212 (recommended by Material Design) or a slightly warmer tone such as #1e1e2e.
Dark gray backgrounds also reduce the “halation” effect—where text appears to glow on pure black—improving readability. For OLED screens, a very dark gray still saves battery power, often outperforming pure black in user comfort tests.
Code Snippet: CSS for a Dark Background
body.dark-mode { background-color: #121212; color: #e0e0e0; }
2. Maintain Sufficient Color Contrast for Readability
In dark mode, text and UI elements must meet WCAG AA contrast ratios—at least 4.5:1 for normal text and 3:1 for large text. White text (#ffffff) on a dark gray background often falls below this threshold if the background is too light. Test your color combinations using tools like WebAIM’s contrast checker.
A good rule of thumb: use off-white text (#e0e0e0 or #f5f5f5) instead of pure white. This subtle shift reduces glare and feels more natural to the eye.
3. Avoid High-Saturation Colors on Dark Backgrounds
Bright, saturated colors like pure red (#ff0000) or electric blue (#0000ff) can appear to vibrate on a dark screen, tiring users quickly. Instead, desaturate your brand colors by 20–30% for dark mode. For example, a vibrant blue (#2563eb) can be softened to a muted blue (#3b82f6) that pops without causing discomfort. For a related guide, see 9 Reasons Astro Is Becoming Popular for Modern Websites.
This is especially important for links, buttons, and call-to-action elements where you still want emphasis without sacrificing usability.
4. Use Subtle Shadows and Elevation Instead of Borders
In light mode, shadows and borders help distinguish elements from the background. In dark mode, dark shadows on a dark surface disappear. Replace box shadows with lighter “shadows” or use thin borders with a semi-transparent white layer to create depth.
For instance, a card can use box-shadow: 0 2px 8px rgba(255,255,255,0.1); to imply elevation without adding harsh lines. This maintains a clean, modern aesthetic that aligns with dark mode UI best practices.
5. Offer a Manual Toggle and Respect System Preferences
Users expect control. Always include a visible toggle (e.g., a moon/sun icon) that lets users switch between modes manually. Additionally, use CSS media query prefers-color-scheme to automatically match the user’s system setting.
Code Snippet: Media Query for System Preference
@media (prefers-color-scheme: dark) { body { background-color: #121212; color: #e0e0e0; } }
Combine this with a JavaScript toggle that overrides the media query when the user flips the switch. Store the preference in localStorage to persist across sessions.
6. Pay Attention to Image and Icon Treatment
Images designed for light mode—especially those with transparent backgrounds—may look jarring in dark mode. Apply a filter: brightness(0.8) or a subtle darker overlay to images to blend them better. For icons, use SVG files with CSS fill colors so they adapt to both themes.
Alternatively, load separate image assets optimized for dark mode using the
7. Test Typography Weight and Spacing
Thin fonts (light weight, 300) can appear too faint on dark backgrounds. Increase your base font weight to 400 (regular) or 500 (medium) for body text. Also, increase line-height by 0.1em compared to your light mode to compensate for the reduced visual contrast.
Good typography in dark mode also means avoiding pure white on deep black—use a lighter gray for body text and reserve white for headings or high-priority content.
8. Keep Primary Actions Visually Prominent
Call-to-action buttons should stand out in both modes. Use a bright, saturated (though still comfortable) accent color for primary buttons—think green (#10b981) or blue (#3b82f6). For secondary actions, use outlined buttons with a subtle white border and transparent background.
Avoid using color as the only visual cue; include text labels or icons to ensure accessibility for colorblind users.
9. Use a CSS Custom Properties Approach for Scalability
Managing two color schemes efficiently requires CSS custom properties (variables). Define all color values in :root for light mode, then override them in a [data-theme="dark"] selector. This approach makes your code cleaner and easier to maintain as your site grows.
Code Snippet: Using CSS Variables for Theme Switching
:root { –bg-color: #ffffff; –text-color: #333333; –accent: #2563eb; } [data-theme="dark"] { –bg-color: #121212; –text-color: #e0e0e0; –accent: #3b82f6; }
10. Continuously Test with Real Users and Devices
The final of our dark mode design tips is to test early and often. Dark mode can look very different across monitors, phones, and tablets. Use browser dev tools to simulate system preference, and collect feedback from a small group of testers before launch.
Pay special attention to forms, modals, and tooltips—these are common places where dark mode implementations break. Fix issues like invisible placeholder text or unreadable error messages before they reach production.
Common Pitfalls to Avoid in Modern Website Dark Mode
Even experienced designers make mistakes. Here are two of the most frequent errors:
Ignoring Images with Transparent Backgrounds
Logos and icons designed for light mode often become invisible or ugly when placed on dark backgrounds. Always provide a fallback—either a white stroke or a dedicated dark variant.
Using Pure Black (#000) for Backgrounds
As mentioned earlier, pure black creates excessive contrast and eye fatigue. Stick to dark grays for a more comfortable reading experience.
| Element | Light Mode | Dark Mode |
|---|---|---|
| Background | #ffffff | #121212 |
| Body text | #333333 | #e0e0e0 |
| Primary button | #2563eb | #3b82f6 |
| Shadow | rgba(0,0,0,0.1) | rgba(255,255,255,0.08) |
Useful Resources
Dive deeper into dark mode UI best practices with these authoritative guides:
- Material Design Dark Theme Guidelines – Comprehensive official guidelines from Google on implementing dark mode.
- WCAG 2.1 Contrast Minimum Specification – Read the official standard for color contrast to ensure your dark mode is accessible.
Frequently Asked Questions About dark mode design tips
What is the best background color for dark mode?
The best background color for dark mode is a dark gray, such as #121212, rather than pure black (#000000). This reduces eye strain and is recommended by Material Design and Apple’s Human Interface Guidelines.
How do I toggle dark mode on my website?
You can add a button that toggles a class (e.g., “dark-mode”) on the body element, then use CSS to switch styles. For automatic detection, use the prefers-color-scheme media query.
Does dark mode save battery life?
Yes, on OLED and AMOLED screens, dark mode can significantly reduce power consumption because black pixels are essentially turned off. The effect is less noticeable on LCD screens.
What contrast ratio should text have in dark mode?
WCAG AA requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Always test your color combinations with a contrast checker.
Can I use pure white text in dark mode?
Using pure white (#ffffff) on a dark background can cause glare and eye strain. Instead, use an off-white like #e0e0e0 or #f5f5f5 for body text to improve readability.
Should I use shadows or borders in dark mode?
Use shadows with a slight white tint (e.g., rgba(255,255,255,0.1)) instead of borders to create depth. Dark borders on dark backgrounds can look harsh.
How do I handle images in dark mode?
Apply filters like brightness(0.8) to images so they blend with the dark background. For logos and icons with transparent backgrounds, provide separate dark-mode assets.
What CSS property do I use for dark mode detection?
Use the CSS media query @media (prefers-color-scheme: dark) to detect the user’s system preference and apply your dark mode styles automatically.
How do I store the user’s dark mode preference?
Save the user’s choice in localStorage (e.g., localStorage.setItem('theme', 'dark')) and read it on page load to persist the preference across visits.
Is dark mode better for accessibility?
Dark mode can be more accessible for users with photophobia, migraines, or certain visual impairments. However, it is not a one-size-fits-all solution; always offer a toggle.
What colors work best for buttons in dark mode?
Use slightly desaturated accent colors like teal (#0d9488) or muted blue (#3b82f6). Avoid highly saturated colors that can cause vibration or eye strain on dark backgrounds.
How do I test dark mode on different devices?
Use browser DevTools to simulate system color schemes, then test on real devices (phone, tablet, laptop) in low-light environments to verify readability and contrast.
Can I use CSS variables for dark mode?
Yes, CSS custom properties make it easy to switch themes. Define all colors in :root and override them in a [data-theme="dark"] or class-based selector.
Do I need to implement dark mode on my e-commerce site?
Implementing dark mode can improve the shopping experience for late-night browsers and may reduce cart abandonment. It also signals that your brand stays current with UX trends.
What is the difference between dark mode and night mode?
Dark mode typically refers to an interface-wide color scheme, while night mode is often a specific reading mode with reduced blue light. In web design, the terms are frequently used interchangeably.
How do I handle forms in dark mode?
Ensure form fields have visible borders (using white tints) and that placeholder text uses a lighter gray (#888888) that still meets contrast guidelines. Test error states in both modes.
Should I use blue light filter in dark mode?
You don’t need a separate blue light filter—dark mode already reduces overall blue light emission. For added comfort, consider a warmer color temperature option in your toggle.
Can dark mode improve SEO?
Dark mode does not directly affect SEO rankings, but it can improve user engagement metrics (time on page, bounce rate) which may indirectly boost your search performance.
What font weight should I use for dark mode body text?
Increase your base font weight to 400 (regular) or 500 (medium) to ensure text appears bold enough against the dark background. Avoid font-weight: 300 for body copy.
How do I implement dark mode in WordPress?
You can use a WordPress plugin like WP Dark Mode or add custom CSS and JavaScript to your theme. Many modern page builders like Elementor also offer built-in dark mode options.
