Dark Mode UI Best Practices

10 Dark Mode UI Design Best Practices, Tips & Examples

Part of our Visual Hierarchy Design Series

Quick Summary

Dark mode works best when it is designed as its own theme, not a flipped copy of light mode. Pick a dark gray base, soft text and calm accent colors, then check every pair for readable contrast. Respect the user’s choice: follow the system setting and offer a simple light/dark toggle.

To design a good dark mode UI, use dark gray surfaces such as #121212 instead of pure black or pure white. You should desaturate accent colors, and create depth with lighter surfaces instead of shadows. Also, make sure every design decision you make meets WCAG contrast ratios. Always build dark mode as a custom color palette instead of simply inverting a light theme, and test it in real-world lighting before launch.

Dark mode is a display setting that shows light text and interface elements on a dark background.

You will find 10 best practices below, along with a starter dark mode color palette with hex values, steps to implement dark mode on the web, real examples and the cases where dark mode is the wrong choice.

10 Dark Mode UI Design Best Practices

Here are the 10 practices, in the order most teams should apply them:

  1. Use dark gray, not pure black, for backgrounds.
  2. Desaturate accent and brand colors.
  3. Use off-white text, not pure white.
  4. Build a branded dark theme.
  5. Design a separate dark palette instead of inverting the light one.
  6. Show depth with lighter surfaces, not shadows.
  7. Meet WCAG contrast ratios for text and UI elements.
  8. Keep keyboard focus indicators visible.
  9. Adapt images, icons and illustrations.
  10. Let users choose, and test in real lighting.

1. Use Dark Gray, Not Pure Black

Dark gray background colors to use in dark mode instead of pure black

Use a dark gray (#121212) as the main background instead of using pure black (#000000). White text on pure black has the maximum possible contrast of 21:1, which can make text appear to glow or vibrate for many readers.

As per Google’s Material Design dark theme, #121212 can be considered as the default dark surface.

Dark gray also gives you room to show depth: surfaces can get slightly lighter as they rise, which is impossible when the background is already the darkest possible color.

2. Desaturate Accent and Brand Colors

Saturated versus desaturated colors on a dark background in dark mode UI

Use lighter, less saturated versions of your accent colors on dark surfaces. Fully saturated colors vibrate against dark backgrounds, cause visual fatigue and often fail contrast checks. Material Design suggests lighter tones (around the 200 tone of a color palette) for dark themes.

For example, a bright brand blue that works on white often needs to shift toward a softer, lighter blue such as #8AB4F8 in dark mode. Desaturated, muted colors are covered in more depth in our guide to muted colors in UI design.

3. Use Off-White Text, Not Pure White

Off-white and gray text levels for readable dark mode typography

Go for off-white text (#E0E0E0) for body copy instead of pure white (#FFFFFF). Off-white still gives strong contrast (about 14:1 on #121212) without the glare of pure white.

Create a clear text hierarchy with three levels:

  • High emphasis (headings and body): white at about 87% opacity, or #E0E0E0.
  • Medium emphasis (secondary text): white at about 60% opacity, or #A0A0A0.
  • Disabled text: white at about 38% opacity.

Thin font weights tend to break up on dark backgrounds, so use regular or medium weights for body text and avoid very light weights.

4. Build a Branded Dark Theme

Branded dark mode using a dark shade of the brand color instead of black

Instead of choosing a neutral gray color theme, use a branded dark theme with dark primary brand color (like deep navy, forest green or plum). It protects readability, keeps the interface recognizable and preserves brand identity.

Also, try to keep the brand tint subtle. Test all text and accent combinations to ensure they pass contrast checks.

5. Design a Separate Dark Palette, Not an Inverted One

Do not create dark mode by inverting your light theme. Inversion can cause harsh contrast, distorts brand colors, and turns shadows into awkward glows.

To do it properly, first define a dedicated set of dark mode design tokens: background, surface levels, text levels, borders, accent colors and states such as hover, error and success. Simply map each light-mode token to its dark-mode counterpart so components switch themes smoothly on their own.

6. Show Depth With Lighter Surfaces, Not Shadows

Lighter surface levels showing depth and elevation in dark mode UI

Traditional drop shadows do not generally appear in dark mode design, so show depth by making surfaces lighter as they rise. A card sits on a slightly lighter surface than the background, a menu or dialog above it is lighter still.

Material Design applies a semi-transparent white overlay to raise surfaces. The approximate values on a #121212 background are:

ElevationWhite overlayApproximate colorTypical use
0 dp0%#121212Background
1 dp5%#1E1E1ECards, sheets
2 dp7%#232323Raised cards, buttons
4 dp9%#272727Top app bar
8 dp12%#2E2E2EMenus, side sheets
24 dp16%#383838Dialogs

Use thin, low-contrast borders only where surfaces are too close in tone to separate.

7. Meet WCAG Contrast Ratios

Dark mode must meet the same accessibility standards as light mode. The WCAG contrast minimum requires:

  • contrast ratio of at least 4.5:1 for normal text,
  • 3:1 for large text, and
  • 3:1 for meaningful UI components (like input borders and icons).

Check text against every surface level, not just the base background. Secondary gray text that passes on #121212 can fail on a lighter dialog surface. A tool such as the WebAIM contrast checker makes this quick.

8. Keep Focus Indicators Visible

Visible keyboard focus indicators in dark mode UI design

Focus indicators are visual indicators that “highlight” the design elements selected by the user. WCAG 2.4.7 (Focus Visible) requires one, and a dark focus ring that works in light mode can disappear completely on a dark background.

Design a dedicated dark mode focus style, such as a light or brand-colored outline with an offset, and confirm it has at least 3:1 contrast against the surrounding surface.

9. Adapt Images, Icons and Illustrations

Images, logos, and illustrations meant for white backgrounds often fail in dark mode. Transparent PNGs hide dark details, and images with solid white backgrounds look like glaring boxes.

How do you prepare images for dark mode?

  • Start by supplying dark-mode versions of logos and key illustrations.
  • Slightly reduce photo brightness to avoid glare.
  • Then, combine the <picture> element with the prefers-color-scheme media query so browsers load the matching image automatically.

10. Let Users Choose, and Test in Real Lighting

Follow the user’s operating system setting by default, and give them a clear in-app toggle with light, dark, and system options that saves their choice across sessions. Before shipping, test dark mode on real OLED and LCD devices at low and high brightness. Also, check how it looks in a dark room, under office lighting, and outdoors.

Dark Mode Color Palette: A Starter Set of Values

A good dark mode color palette uses a dark gray background, two or three lighter surface levels, off-white and gray text levels and desaturated accent colors. This starter palette meets WCAG AA for text on the base background:

RoleHex valueContrast on #121212
Background#121212Base
Surface (cards)#1E1E1ESurface
Surface (menus, dialogs)#2E2E2ESurface
Primary text#E0E0E014.2:1
Secondary text#A0A0A07.2:1
Accent (desaturated blue)#8AB4F88.9:1
Accent (desaturated purple)#BB86FC7.1:1
Error#CF66795.2:1

Contrast ratios were calculated with the WCAG relative luminance formula. Swap the accent colors for lighter, desaturated versions of your own brand colors, and recheck contrast on each surface.

How to Implement Dark Mode on the Web

On the web, dark mode is built with CSS that responds to the user’s system setting, plus design tokens that switch every color in one place:

  1. Define color tokens as CSS custom properties, such as --color-bg and --color-text, for both themes.
  2. Detect the system setting with the prefers-color-scheme media query, which reports whether the user has chosen a light or dark theme.
  3. Declare support with the color-scheme CSS property or meta tag, so browsers render form controls and scrollbars in the right theme. A guide to the color-scheme property explains the setup.
  4. Use the light-dark() function in modern browsers to set both values in a single declaration.
  5. Save the user’s choice and apply it before the page renders to avoid a flash of the wrong theme.

How We Approached a Dark Interface for WSC Spades

From our work at Design Studio UI/UX: For the WSC Spades mobile game, our team (UX researcher and UI designers) created a premium, casino-inspired card game over four to five months. There were few existing references for a dark, casino-grade card game, so we built the visual system from scratch: deep backgrounds, layered surfaces, considered lighting effects and typography that reads clearly on dark screens.
The hardest part was keeping a sophisticated dark look from becoming confusing, so we mapped every user flow before designing screens and kept the visual system consistent from the lobby to the championship bracket.

Dark Mode UI Design Examples

Dark mode went mainstream in 2019, when Android 10 and iOS 13 added system-wide dark themes and apps began following the device setting. These examples show how major products adopted it.

X (formerly Twitter) dark mode UI example

X (formerly Twitter) offers two dark options: Dim, a dark blue-gray theme, and Lights out, a near-black theme for OLED screens. Offering both lets users choose between comfort and maximum battery savings.

Microsoft Word and Facebook dark mode UI examples

Microsoft Word and Facebook both added dark modes across their apps and desktop experiences. Word goes further by offering a dark document canvas, not just dark toolbars, for users who write for long periods.

Halo game interface using a dark UI

Games such as Halo have long used dark interfaces. Dark backgrounds make artwork and key actions stand out and suit long play sessions in low light.

Stack Overflow dark mode UI example

Stack Overflow launched dark mode in 2020 after it became one of the most requested features from its developer community, a good example of letting user demand drive a theme.

WhiteHouse.gov dark mode accessibility toggle example

WhiteHouse.gov added a dark mode toggle in 2021 alongside other accessibility options, showing that dark mode is an important accessibility feature.

For more dark-first products in context, browse our SaaS design trends guide, where dark mode and theme control are a core trend.

Dark mode UI design is popular because it feels more comfortable in low light, saves OLED battery, keeps attention on content, and offers visual customization.

  • Comfort in low light: Dark screens emit less light, so dimmer screens feel much gentler for users.
  • Battery savings on OLED screens: A Purdue University study found that switching to dark mode saved 39% to 47% of battery power at 100% screen brightness, but only 3% to 9% at the 30% to 50% brightness most people use.
  • Focus on content: Dark interfaces also minimize distractions, which is why streaming, coding, and design apps use them by default.
  • User choice: Preferences are split. In a Nielsen Norman Group survey of 115 mobile users, roughly one-third used dark mode, one-third light mode and one-third switched between both.

When Should You Not Use Dark Mode?

Avoid making dark mode the only option. Always give users a choice, especially for long-form reading in bright environments. Light text on dark backgrounds can look blurry and be harder to read for some people with astigmatism.

You also need extra testing for dark mode when brand logos lose contrast, HTML emails render unpredictably, or inverted QR codes stop scanning. Always test these elements deliberately or stick to light mode as your default.

Dark mode is one part of a clear visual system. Our guide to visual hierarchy principles explains how contrast, size and spacing guide attention in any theme, and color psychology in web design covers how color choices shape the way users feel.

Where to Start With Your Dark Mode Design

Great dark mode UI design starts with dark gray surfaces, off-white text, desaturated accents and depth shown through lighter surfaces, then proves itself with WCAG contrast checks and testing in real lighting. Treat dark mode as its own palette and design system, not an inverted light theme.

If you want a dark mode that is accessible and on brand, our UI/UX design services cover design systems, theming and accessibility.

As a UI/UX design agency, Design Studio UI/UX can help you design and test both themes before launch.

Summarize this article with AI

FAQs

Is dark mode better for your eyes?

Right Arrow

Not universally. Dark mode can feel more comfortable in dim rooms and at night, but in bright light many people read dark-on-light text more easily. Some people (including some with astigmatism) find light text on dark backgrounds blurry. That is why the best products let users choose.

No, the safest default is to follow the user’s operating system setting, then offer an in-app toggle. Make dark the default only when your product is used mainly in low light or around media.

Yes, with dark tones in the largest share. Use about 60% dark background and surfaces, 30% secondary surfaces and text, and 10% desaturated accent color for buttons, links and highlights. Keep the accent sparing so it still draws attention against the dark interface.

Email clients apply their own dark modes and can invert colors unpredictably. Use transparent logos with light outlines, avoid text inside images, set explicit background and text colors, and test in Gmail, Apple Mail and Outlook in both themes before sending a campaign.

Check every text and component color against each surface level with a contrast checker, then navigate the interface by keyboard to confirm focus states stay visible. Emulate the dark color scheme in browser developer tools, and test on real devices at low and high brightness.

About the Author

Sneh Sagar

Co-Founder & CTO, Design Studio UI/UX

Sneh Sagar is the co-founder of Design Studio UI/UX, a UX design agency with clientele spanning across different industries, domains, startups, companies in the growth phase, and large enterprises on a global scale. With 10+ years of experience and 350+ projects in his portfolio, he has built digital products for healthcare, SaaS, among other industries (most of them at a stage where the product no longer aligned with the business perspective). His impressive portfolio is the intersection of research, system thinking, and interface design to help teams by creating products with high usability and scalability.

Recent Articles

Looking for UX/UI research

or product branding?

user
Envelope
Phone

350+ Projects Delivered — And Counting