In short: inboxes handle dark mode in three different ways, and your dark styles only reach one of them. In React Email, add the color-scheme meta tags and a <style> block with @media (prefers-color-scheme: dark) rules inside <Head>, put class names on the parts that change colour, and add Outlook.com's [data-ogsc] and [data-ogsb] selectors. Then design the light version so it still looks right when Gmail or Outlook invert it for you: transparent logos with an outline, no white boxes baked into images, and real text rather than text in pictures.
React Email makes the HTML easy to write, but it can't change how inboxes treat it. Its preview (which has a dark mode switcher since version 5) shows your own dark styles; it doesn't show what Gmail or Outlook do when they recolour the email themselves.
The three ways inboxes do dark mode
- They use your dark styles. Apple Mail and iOS Mail apply your
prefers-color-schemerules. Outlook.com and the Outlook apps add their own attributes you can target. - They partly invert it. Light backgrounds become dark and dark text becomes light, but mid-tones and already-dark areas are left alone. Gmail on Android and Outlook.com behave like this when they don't use your styles.
- They fully invert it. Every colour is flipped, including ones you made dark on purpose. Gmail on iPhone and classic Outlook for Windows behave like this.
You can only fully control the first. For the other two, the job is making sure the inverted version is still readable and on-brand. Support changes often, so test in the inboxes your list actually uses.
Step 1: the meta tags and the dark styles
In React Email, put the meta tags and a style block inside <Head>. Styles in a <style> tag aren't inlined, which is what you want for media queries.
import { Html, Head, Body, Container, Heading, Text, Button } from '@react-email/components';
const dark = `
:root { color-scheme: light dark; supported-color-schemes: light dark; }
@media (prefers-color-scheme: dark) {
.bg { background-color: #0e1013 !important; }
.card { background-color: #171a20 !important; }
.ink { color: #f2f4f7 !important; }
.soft { color: #c7ccd5 !important; }
}
[data-ogsb] .bg { background-color: #0e1013 !important; }
[data-ogsb] .card { background-color: #171a20 !important; }
[data-ogsc] .ink { color: #f2f4f7 !important; }
[data-ogsc] .soft { color: #c7ccd5 !important; }
`;
export default function Welcome() {
return (
<Html lang="en">
<Head>
<meta name="color-scheme" content="light dark" />
<meta name="supported-color-schemes" content="light dark" />
<style>{dark}</style>
</Head>
<Body className="bg" style={{ backgroundColor: '#f2f3f5', margin: 0 }}>
<Container className="card" style={{ backgroundColor: '#ffffff', padding: '32px' }}>
<Heading className="ink" style={{ color: '#14161a' }}>Your spring order is on its way</Heading>
<Text className="soft" style={{ color: '#3d424b' }}>It should arrive on Thursday.</Text>
<Button href="https://example.com/track" style={{ backgroundColor: '#0f7a59', color: '#ffffff', padding: '14px 24px', borderRadius: '10px' }}>
Track your order
</Button>
</Container>
</Body>
</Html>
);
}
- Inline styles are the light version. Every inbox gets those.
- The class names (
bg,card,ink,soft) are what the dark rules hook onto. !importantis needed because the dark rules have to beat the inline styles.[data-ogsc]and[data-ogsb]are attributes Outlook.com adds in dark mode, for text colours and backgrounds.- Keep the button's colours the same in both modes unless your brand colour is too dark to read on a dark card.
Step 2: Tailwind's dark: variants
If you use React Email's <Tailwind> component, dark: classes compile to a prefers-color-scheme media query. Media queries can't be inlined, so React Email puts them in a style block in the head. That means your email must have a <Head>, and it means dark: only reaches the inboxes that read your dark styles (the first group above). It does nothing for the inboxes that invert, and it doesn't add the Outlook.com selectors, so add those yourself as in Step 1.
Step 3: design for the inboxes that ignore your styles
This is what makes dark mode "survive":
- Logos: a transparent PNG with dark lettering disappears on a dark background. Add a thin light outline or glow to the logo, or put it on a small light tile that stays light.
- Images with white backgrounds: a product cut-out on white becomes a bright white box in a dark email. Use a transparent PNG, or a photo that fills its space edge to edge.
- Text in images never changes colour, and inverted backgrounds can leave it unreadable. Use live text.
- Pure black and white: some teams use a slightly off-white background and off-black text, so a full inversion lands on softer greys rather than harsh black.
- Borders and dividers in light grey can vanish. Check them in the inverted views.
- Brand colours may be shifted by partial inversion. A colour that matters (a button, a sale badge) is safer as a solid background with white text than as coloured text.
Step 4: test all three
The React Email preview shows your own dark styles. To see the other two behaviours, send a test to the inboxes your list uses, or paste the rendered HTML into the free dark mode email checker, which shows the email in Apple Mail, Gmail and Outlook dark modes side by side and flags logos that vanish and text on background images. Rendering the template with React Email's render() gives you the HTML to paste.
If you send through Resend, the Resend email coding cheat sheet has the unsubscribe and personalisation tags for the same template.
Questions
Does React Email support dark mode?
Yes, in the sense that you can include dark mode styles: put prefers-color-scheme rules in a <style> tag inside <Head>, or use Tailwind dark: classes, which React Email outputs as a media query in the head. How it looks then depends on each inbox: some use your dark styles, others invert the colours themselves.
Why doesn't my React Email dark mode work in Gmail?
Gmail apps generally don't apply your prefers-color-scheme styles; they invert the colours themselves (partly on Android, fully on iPhone). Design the light version so it still works when inverted: transparent logos with an outline, no white boxes in images, and live text.
Do Tailwind dark: classes work in React Email?
They compile to a prefers-color-scheme media query that React Email keeps in a style block in the head, so your email needs a <Head>. They only reach inboxes that read your dark styles, and they don't add Outlook.com's [data-ogsc] selectors, so add those yourself.
How do I test dark mode in React Email?
The React Email preview shows your own dark styles. For inboxes that invert colours, send tests to real inboxes or paste the rendered HTML into a dark mode checker that shows partial and full inversion.
Sources
- React Email Tailwind component (media queries aren't inlined): React Email docs
- React Email 5 (dark mode switcher, Tailwind 4): Resend blog
- Dark mode support by email client: Can I email: prefers-color-scheme
*Checked on 9 November 2026. Inboxes change how they handle dark mode often: test with your own list's inboxes.*