You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/dark-mode.md
+79-18Lines changed: 79 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,35 @@ Cerberus includes patterns for dark mode using the `prefers-color-scheme` media
12
12
13
13
## Overview
14
14
15
-
Cerberus defines dark mode styles in each template’s <head>. These styles can override styles for components (like buttons and text) and create utility classes that can be applied anywhere in a template’s HTML.
15
+
Cerberus defines dark mode styles in each template’s `<head>` in the form of immutable utility classes. These utility classes can be applied to HTML tags to override their default light mode CSS styles and apply new styles for dark mode.
Since `.svg` graphics are not well supported in email clients, email relies on raster images like `.png`, `.jpg`, and `.gif`. Since we can't use a single raster image and recolor it based on the color scheme preference, we include two separate image files (one for light mode and one for dark mode) and display one at a time using the `prefers-color-scheme` media feature.
Windows Outlook doesn't support the CSS to hide and display images using the <code>prefers-color-scheme</code> media feature, so it displays both light <i>and</i> dark mode images simultaneously. We can avoid this by <b>hiding</b> the second image file from Outlook using <code><!--[if !mso]><!--></code> tags. Unfortunately this means we can't swap light and dark mode images in Windows Outlook (at least I haven't found a way to do so yet).
0 commit comments