Dark Mode Email: How to Fix Outlook and Gmail Rendering Problems
Dark mode is the single most reliable way to break an HTML email that tested perfectly everywhere else. Your logo vanishes, a white button turns charcoal, body text drops to 2:1 contrast, and the campaign has already gone out to 40,000 people. The cause is not your CSS being wrong. It is that email clients rewrite your colours after your CSS has done its job, and every client rewrites them differently. This guide covers the three inversion behaviours you are actually coding against, and the copy-paste fixes for each.
The three dark mode behaviours you are coding against
Every email client falls into one of three buckets. Knowing which bucket a client is in tells you exactly which fix applies.
| Behaviour | What the client does | Representative clients |
|---|---|---|
| No inversion | Renders your colours as written; may darken only the surrounding chrome | Apple Mail on macOS and iOS when color-scheme is declared |
| Partial inversion | Flips light backgrounds and dark text; leaves already-dark colours alone | Gmail apps on Android and iOS, Gmail webmail |
| Full inversion | Recalculates every colour in the email, including ones you set explicitly | Outlook.com, Outlook mobile apps, Outlook on Windows |
Full inversion is where designs die. Outlook on Windows is the worst offender because it renders through Microsoft Word's engine rather than a browser engine, so it applies its own colour logic aggressively and ignores most of the CSS you would use to stop it. Treat the three behaviours as three separate test cases, not one.
Fix 1: Declare that your email supports both schemes
This is the first thing to add to every template. It tells clients your email is dark-mode aware, which stops several of them from applying naive automatic inversion on top of your design.
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">
<style>
:root {
color-scheme: light dark;
supported-color-schemes: light dark;
}
</style>
Both the meta tags and the :root declaration matter, because clients differ on which one they read. This alone fixes a surprising share of Apple Mail complaints. It does not stop Outlook.
Fix 2: Style the dark variant where media queries are supported
For clients that honour prefers-color-scheme, mainly Apple Mail on macOS and iOS, you can style the dark variant properly instead of accepting whatever the client calculates.
<style>
@media (prefers-color-scheme: dark) {
.email-bg { background-color: #1a1a1a !important; }
.email-card { background-color: #242424 !important; }
.text-body { color: #e8e8e8 !important; }
.text-muted { color: #a8a8a8 !important; }
.btn-primary {
background-color: #1e8a8a !important;
color: #ffffff !important;
}
}
</style>
The !important flags are not optional here. Inline styles win the cascade in email, so a media query without !important loses to the inline attribute on the same element every time.
Be realistic about coverage: prefers-color-scheme is reliable in Apple Mail, partially honoured in some Outlook builds, and unreliable in Gmail. It is one layer of the strategy, never the whole strategy.
Fix 3: Target Outlook.com with the attributes it injects
When Outlook.com inverts an email, it rewrites your colours and stores the originals in two attributes it adds to the markup: data-ogsc for the original text colour and data-ogsb for the original background. Those attributes are also a hook you can select against, which is the only reliable way to correct Outlook.com's output.
<style>
[data-ogsc] .text-body { color: #e8e8e8 !important; }
[data-ogsc] .text-heading { color: #ffffff !important; }
[data-ogsb] .email-card { background-color: #242424 !important; }
[data-ogsb] .btn-primary {
background-color: #1e8a8a !important;
color: #ffffff !important;
}
</style>
Note that these selectors only apply once inversion has happened, which is exactly what you want: in light mode they never match, so there is no risk of them leaking into the default rendering.
Fix 4: Force a predictable result in Outlook on Windows
Classic Outlook on Windows ignores most of the above. The pragmatic approach is to stop fighting for a designed dark variant there and instead force a legible, consistent light rendering, using an MSO conditional block that only Outlook parses.
<!--[if mso]>
<style type="text/css">
body, table, td, div, p, a {
background-color: #ffffff !important;
color: #111111 !important;
}
</style>
<![endif]-->
Pair that with the bgcolor HTML attribute alongside your inline CSS on every table and cell that carries a background. Word's engine reads the attribute more consistently than the style declaration, and having both costs you nothing.
<td bgcolor="#ffffff" style="background-color:#ffffff; color:#111111;">
Readable in every inversion mode.
</td>
Fix 5: Stop your logo from disappearing
This is the most common dark mode support ticket, and it is not a CSS problem. A dark wordmark exported as a transparent PNG becomes invisible the moment a client puts a dark background behind it. Three fixes, in order of reliability:
- Give the logo its own solid background. Place it in a container with an explicit light background colour and generous padding, so it never sits directly on an inverted surface. Least elegant, most bulletproof.
- Swap two image versions. Ship a dark-background version and a light-background version, showing one and hiding the other inside the
prefers-color-schemeblock. Works where media queries are supported, so always keep the default visible one as the safe fallback. - Add a light stroke or halo to the mark itself. A one or two pixel outline keeps the shape legible on either background without any client-specific code at all.
The same logic applies to any transparent PNG in the template: icons, dividers, and decorative shapes all disappear the same way.
Design rule that removes most of the work: never use pure #000000 or pure #ffffff.
Near-black on off-white inverts gracefully. Pure black on pure white inverts into a harsh, low-contrast mess in every client that touches it.
The colour choices that survive inversion
Because you cannot control every client, choose colours that degrade acceptably even when a client recalculates them without asking.
- Body text:
#1a1a1ato#2b2b2brather than#000000 - Backgrounds:
#f5f5f5or#fafafarather than#ffffff - Brand colours: check contrast against both a light and a dark surface before you commit; mid-tone brand colours survive inversion best because they are altered least
- Buttons: avoid white or near-white fills, which invert into dark buttons with dark text and become unreadable
- Borders and dividers: use a mid-grey that stays visible on both surfaces instead of a very light grey that vanishes on dark
Aim for at least 4.5:1 contrast in both directions. If a colour pairing only clears the threshold in light mode, it will fail somewhere. Our free colour contrast checker is useful for testing pairings before you build.
A dark mode QA checklist before you send
color-schemeandsupported-color-schemesdeclared in both meta tags and:rootprefers-color-schemeblock present with!importanton every override[data-ogsc]and[data-ogsb]rules present for Outlook.com- MSO conditional forcing legible colours in classic Outlook
bgcolorattributes set alongside inline background CSS- No pure black or pure white anywhere in the palette
- Every transparent PNG checked against a dark surface
- Button fills and their label colours verified in all three inversion modes
- Render tested across dark mode variants in Litmus or Email on Acid
- Confirmed on at least one real device per major client
That last point matters more than it sounds. Client behaviour shifts between versions, so a technique that was verified a year ago deserves a re-test before a significant campaign. Our wider guide to making email code work on every platform and our responsive email best practices cover the rest of the compatibility surface.
Why this is worth the effort
Dark mode is no longer a minority setting. It is the default on a large share of mobile devices, which means a meaningful proportion of your list is seeing the inverted version of every email you send, and you are almost certainly not one of them, because you check your own campaigns on a desktop in light mode. The gap between what you approved and what subscribers received is invisible from where you are standing.
If you would rather not maintain this yourself, we hand-code every template dark-mode ready and render tested across 90+ clients. See design to email template conversion from $109 per template with 24 to 48 hour turnaround, or our email development service for ongoing ESP and campaign work.
Final Thoughts
Dark mode email is not a styling problem, it is a control problem. You are writing colours that a third party will rewrite before anyone sees them, and no single technique covers every client. What works is layering: declare support so the well-behaved clients stand down, style the dark variant where media queries are honoured, correct Outlook.com through the attributes it injects, force something legible in classic Outlook, and choose a palette that survives inversion even where none of your code applies.
Do those five things and dark mode stops being the reason a campaign gets rebuilt at midnight. It becomes just another rendering case you already covered.
Some FAQ
Frequently Asked Questions About Dark Mode Email
01. Why does my HTML email look broken in dark mode?
Because email clients apply their own colour inversion on top of your CSS. Clients fall into three groups: no inversion, partial inversion (light backgrounds and dark text are flipped, dark ones are left alone), and full inversion (every colour is recalculated). A design that only accounts for the first group breaks in the other two.
02. How do I stop Outlook from inverting my email colours?
Declare color-scheme and supported-color-schemes so the client knows your email handles both themes, then target Outlook.com with the [data-ogsc] and [data-ogsb] attribute selectors it injects during inversion. For classic Outlook on Windows, wrap explicit background and text colours in an MSO conditional block and set bgcolor attributes on table cells as well as inline CSS.
03. Does prefers-color-scheme work in email?
It works reliably in Apple Mail on macOS and iOS, and in some Outlook builds. It is unreliable in Gmail, which is why prefers-color-scheme alone is not a complete dark mode strategy. Combine it with the color-scheme declaration, Outlook attribute selectors, and colour choices that survive inversion.
04. Why does my logo disappear in dark mode?
Dark logos saved as transparent PNGs vanish against an inverted dark background. Fix it by supplying a light version of the mark, swapping the two with prefers-color-scheme where supported, and adding a subtle outline or a solid-colour container so the fallback stays visible in clients that ignore the swap.
05. Should I design a separate dark mode version of the email?
No. Build one email whose colours survive inversion. Pure black text on pure white inverts harshly, while near-black text such as #1a1a1a on an off-white background such as #f5f5f5 produces acceptable results in every inversion mode. A separate dark version doubles the QA surface and still cannot control which mode the client applies.
06. How do I test dark mode email rendering?
Use a render-testing service such as Litmus or Email on Acid, which capture dark mode variants across clients, and confirm on at least one real device per major client. Client behaviour changes between versions, so a technique verified last year should be re-tested before a major campaign.