Skip to content

Instantly share code, notes, and snippets.

@skipshean
Created April 21, 2022 14:57
Show Gist options
  • Save skipshean/c3f44d124904d8be5eada45574445c71 to your computer and use it in GitHub Desktop.
Save skipshean/c3f44d124904d8be5eada45574445c71 to your computer and use it in GitHub Desktop.
Dark Mode snippet for emails
<!-- Source: https://litmus.com/community/snippets/233-dark-mode-support -->
<!-- Put both of these sections in the <head> of your email. -->
<!-- Enable Dark Mode Support -->
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark only">
<style type="text/css">
:root {
color-scheme: light dark;
supported-color-schemes: light dark;
}
<!-- Use this media query to adapt styles for Dark Mode. -->
@media (prefers-color-scheme: dark) {
<!-- Target elements as usual within the media query. -->
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment