Guides
Dark Mode Guide
Make your HTML emails look good in dark mode across all email clients.
How email clients handle dark mode
Different clients apply dark mode differently:
- Color inversion , light backgrounds become dark, dark text becomes light
- Media queries ,
prefers-color-scheme: darkstyles are applied - Selective override , only certain elements are modified
- No change , the email content is left untouched by the client's dark mode
Testing dark mode with Emailens
import { transformForClient, simulateDarkMode } from "@emailens/engine";
const transform = transformForClient(html, "gmail-web");
const darkMode = simulateDarkMode(transform.html, "gmail-web");
// Check for dark-mode-specific warnings
console.log(darkMode.warnings);Or via the API , the response includes a darkMode object with variants for each client.
Best practices
Use prefers-color-scheme
Add dark mode styles in a media query:
<style>
@media (prefers-color-scheme: dark) {
.email-body { background-color: #1a1a1a !important; }
.email-text { color: #e0e0e0 !important; }
}
</style>This is respected by Apple Mail, Outlook 365, and some others.
Use transparent images
Logos and icons with transparent backgrounds work better in dark mode than those with white backgrounds.
Avoid hardcoded light backgrounds
Instead of background-color: white, consider using transparent or easily-invertible colors.
Add color-scheme meta
Tell email clients your email supports dark mode:
<head>
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">
</head>Test both variants
Always preview both light and dark mode. The Emailens web app shows both side by side, and the API returns both variants per client.
Client-specific behavior
| Client | Reads prefers-color-scheme | What happens in dark mode |
|---|---|---|
| Gmail (web) | No | Shows your light design |
| Gmail (iOS, Android) | No | Recolours light backgrounds and dark text itself |
| Outlook.com / Outlook 365 web | Yes | Recolours, overridable with [data-ogsc] / [data-ogsb] |
| Outlook (New) for Windows | Yes | Same engine as Outlook on the web |
| Outlook Classic | No | Recolours parts of the email |
| Outlook for Mac, iOS | Yes | Applies your dark styles |
| Apple Mail (all) | Yes | Applies your dark styles; inverts only without them |
| Yahoo Mail | No | Recolours |
| Samsung Mail | Yes | Applies your dark styles |
| Thunderbird | Not confirmed | Darkens message content since version 140 |
Support levels come from the same data as the dark mode email guide.