You build an email with a crisp white background and a dark logo. It looks perfect in your browser preview. Then a subscriber opens it on their phone at night and sees a black background, a logo that has vanished, and a button whose text no longer contrasts with its fill.
That's dark mode, and email clients handle it in very different ways. A dark mode email isn't a separate design you send to some people. It's your one email, as each client chooses to repaint it.
This guide covers what each major client does, the code email developers use to influence it, and the design habits that hold up when code can't help. The client behavior and code patterns here follow the published testing of Litmus and Email on Acid, two teams that test email rendering across clients for a living.
The three things a client can do to your email
Every client falls into one of three behaviors. Knowing which one you're dealing with explains most dark mode bugs. The grouping below follows Litmus's client chart from February 2025.
1. No color change. The app interface may go dark, but your email renders as coded. Gmail in a desktop browser, Yahoo Mail and AOL behave this way. Apple Mail also leaves your email alone, but only if you don't add the dark mode meta tags covered below.
2. Partial color inversion. The client darkens light backgrounds and lightens dark text, but mostly leaves areas that are already dark, like a dark button. Outlook.com, the Outlook apps for iOS and Android, and the Gmail app on Android work this way.
3. Full color inversion. The client inverts light and dark colors across the whole email, including dark colors you chose on purpose. The Gmail app on iOS, Outlook for Windows (Outlook 2021 and Office 365) and Windows Mail fall here. Litmus's developer guide is blunt about classic Outlook for Windows: there's no coding workaround.
Client behavior changes
Mail apps change their dark mode handling without announcing it, and even the testing sources disagree on some clients. Treat this as a starting point, and test your own email in the clients your subscribers use.
Step 1: Add the dark mode meta tags
Litmus and Email on Acid both recommend these two tags in the <head>:
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">They tell clients your email has been designed for both color schemes. They are required for your own dark styles to work in Apple Mail.
They also change Apple Mail's default behavior. Litmus notes that Apple Mail doesn't change an email's colors if the tags are absent, but if you add the tags without writing any dark styles, Apple Mail applies a partial inversion. So add the tags only together with Step 2.
Step 2: Write your dark styles with prefers-color-scheme
The prefers-color-scheme media query lets you define what your dark version looks like. Put it in an embedded <style> block in the <head>:
<style type="text/css">
@media (prefers-color-scheme: dark) {
.darkmode { background-color: #1a1a1a !important; }
h1, h2, h3, p, a, span { color: #f1f1f1 !important; }
}
</style>Add class="darkmode" to the tables or cells whose background should change. Note the !important: email HTML relies on inline styles, and an embedded rule can't override an inline style without it.
Email on Acid lists Apple Mail and Outlook for Mac as clients where this works well. Gmail does not support it, in either the apps or the web.
Step 3: Repeat the rules for Outlook.com and the Outlook apps
When Outlook.com and the Outlook mobile apps recolor an email, they add attributes to the elements they change: data-ogsc where they changed a text color and data-ogsb where they changed a background. You can target those attributes by copying your dark mode rules and prefixing each one:
<style type="text/css">
[data-ogsb] .darkmode { background-color: #1a1a1a !important; }
[data-ogsc] h1,
[data-ogsc] h2,
[data-ogsc] h3,
[data-ogsc] p,
[data-ogsc] a,
[data-ogsc] span { color: #f1f1f1 !important; }
</style>Two details catch people out:
Every selector needs its own prefix. Litmus's developer guide shows this mistake:
[data-ogsc] p, p aonly prefixes the first selector, sop abecomes a plain rule that applies in light mode too. Write[data-ogsc] p, [data-ogsc] p ainstead.There's a space after the attribute.
[data-ogsc] .darkmodetargets elements inside the recolored element, which is the pattern every source uses.
Litmus marks support in these Outlook clients as partial, so test before relying on it.
Step 4: Swap your logo for a dark version
A dark logo on a transparent background disappears in dark mode. The standard fix is to include two images, a light-mode logo and a dark-mode logo, and switch between them:
<img class="light-img" src="https://example.com/logo-dark-text.png"
alt="Your Brand" width="160" style="display:block;">
<!--[if !mso]><!-->
<img class="dark-img" src="https://example.com/logo-light-text.png"
alt="Your Brand" width="160" style="display:none;">
<!--<![endif]-->Then add the swap to both of your rule sets:
<style type="text/css">
@media (prefers-color-scheme: dark) {
.light-img { display: none !important; }
.dark-img { display: block !important; }
}
[data-ogsc] .light-img { display: none !important; }
[data-ogsc] .dark-img { display: block !important; }
</style>The <!--[if !mso]><!--> wrapper matters. Outlook for Windows doesn't reliably honor display:none, so without the wrapper it would show both logos. The wrapper hides the dark logo from Outlook for Windows entirely.
Expect the swap to work in Apple Mail and, per Email on Acid, Outlook.com, where Litmus notes the images need to be linked (hosted) rather than embedded. In Gmail, subscribers will see your light-mode logo, so it still needs to read on a dark background (see below).
Design habits for the clients code can't reach
Gmail and Outlook for Windows will recolor your email no matter what CSS you write. Your design has to survive that on its own.
Avoid pure white and pure black
Apple Mail inverts pure #ffffff and #000000 even when you've written dark styles. Email developers use near-identical shades to avoid this: Email on Acid suggests #FFFFFE and #000001, and Litmus suggests off-white shades like #FDFDFD for text you want to stay white.
Make logos and icons readable on both backgrounds
Since Gmail won't swap images, your main logo should work on light and dark. A common approach is a transparent PNG with a thin light outline or soft glow around dark shapes, so it reads on white and near-black.
Avoid putting important text in images. Clients don't invert images, so a dark headline baked into a JPG stays dark on a dark background.
Don't let color carry the meaning
Assume any color can be shifted. Give buttons enough contrast that they still read if the background inverts and the fill doesn't, and don't rely on color alone to signal an error or success state. Add a word or an icon.
Keep contrast accessible in both modes
Email on Acid's testing found that an email that's accessible in light mode can stop being accessible once a client inverts its colors. Body text should meet WCAG contrast guidance in both schemes, so check the dark rendering as carefully as the light one.
Test before you send
None of this code is safe to ship without testing it in real clients. Before sending, open your email in dark mode in the clients your subscribers use, either on real devices or with a rendering test tool such as Litmus or Email on Acid. At a minimum, check:
Apple Mail (iPhone and Mac): do your dark styles apply, and does the dark logo swap in?
Outlook.com and the Outlook apps: do your
[data-ogsc]and[data-ogsb]rules apply?Gmail app on iOS and Android: is all text readable after inversion? Does the logo still show?
Outlook for Windows: is the dark logo hidden? Is everything readable after full inversion?
Check your analytics to see which clients your subscribers use and prioritize those. A B2B list may be mostly Outlook; a consumer list may be mostly iPhone.
Bringing it together
You can't make every client show one perfect dark mode email. What you can do:
Add the
color-schemeandsupported-color-schemesmeta tags, together with real dark styles.Write those styles with
prefers-color-schemeand repeat them with[data-ogsc]/[data-ogsb]prefixes for Outlook.Swap logos with classes, and hide the dark logo from Outlook for Windows with a conditional comment.
Design so Gmail and Outlook for Windows can recolor the email without breaking it.
Dark mode is one part of a bigger problem: the same HTML renders differently across clients. For responsive HTML email that handles Outlook quirks and mobile layouts, see the EmailUX Email Builder. And once your design is ready, make sure it reaches the inbox with our SPF, DKIM and DMARC sender checklist.




