ampproject / ampproject/amphtml

Support `prefers-color-scheme` media query in AMP emails (Dark Mode)

Open
#40,256 3 comments 11 reactions 1 assignee Claimed by @erwinmombay View on GitHub
needs sizing Type: Feature Request WG: amp4email
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

Gmail's automatic dark mode for emails can be hit or miss, and I think AMP has the potential to improve on it by supporting dark mode media queries like this:

```css
@media (prefers-color-scheme: dark) {
/* dark-mode-only CSS */
}
```

For example, I use images to display the trash icon and plus button in the email below:

| Light Mode | Dark Mode |
|------------|------------|
| ![Image](https://github.com/user-attachments/assets/48cfebed-f845-4be8-8cee-69e651068c73) | ![Image](https://github.com/user-attachments/assets/eae9cba9-88ca-4520-88d6-83aa37b162a2) |

But these images automatically get inverted on dark mode, making them appear invisible.

I wish I had more control over how dark mode renders my emails.

### Alternatives Considered

An alternative (for my use case, anyway) would be allowing `

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.