Need help with dark-mode-email?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

tomayac
147 Stars 2 Forks Apache License 2.0 9 Commits 4 Opened issues

Description

This repo shows how to create emails that support dark mode.

Services available

!
?

Need anything else?

Contributors list

# 22,513
Chrome
javascr...
ecmascr...
webasse...
9 commits

🌒 Dark Mode Email

It is possible to send email 📧 that is sensitive to the user's

prefers-color-scheme
(☀️/🌒) setting.

Dark Mode Email Template

The below is a future-proof email template for dark mode:

<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;
  }
  body {
    background-color: #eee;
    color: #111;
  }
  @media (prefers-color-scheme: dark) {
    body {
      background-color: #111;
      color: #eee;
    }
  }
</style>


🖖 Hello Dark Mode!

Dark Mode Email Example

The screenshots below show a slightly more involved example that includes a dynamically switching image, because, why not… On email clients that currently don't support

prefers-color-scheme
, it silently falls back to light mode.

iOS Mail (dark mode)

iOS Mail (light mode)

iOS Gmail (fallback light mode)

Desktop Gmail (fallback light mode)

Who Made This

Made with HTML and CSS by 🐦 @tomayac.

Acknowledgements

Thanks to 🐦 @xeenon for the WWDC session video pointer.

License

Apache 2.0.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.