fix: keep light canvas for styled emails in dark mode

Styled HTML emails (newsletters, branded mail) declared color-scheme
'light dark' whenever the app theme was dark, so Chromium resolved the
iframe to the dark scheme and painted an opaque dark canvas under
emails that assume a white background, making their text unreadable.
Only opt into the dark scheme when the email actually adapts to the
app theme.
This commit is contained in:
hrsvrn 2026-06-11 13:32:28 +05:30 committed by arkml
parent 1632b16dfc
commit 610cb66d40

View file

@ -300,7 +300,10 @@ function buildEmailDocument(
opts: { theme: 'light' | 'dark'; adaptToTheme: boolean },
): string {
const useDark = opts.theme === 'dark' && opts.adaptToTheme
const colorScheme = opts.theme === 'dark' ? 'light dark' : 'light'
// Only opt into the dark color scheme when the email actually adapts to the
// theme — otherwise Chromium paints the canvas dark under emails that
// assume a white background.
const colorScheme = useDark ? 'light dark' : 'light'
const bodyColor = useDark ? '#d4d4d8' : '#202124'
const linkColor = useDark ? '#a78bfa' : '#1a73e8'
const quoteBorder = useDark ? '#2e2e35' : '#dadce0'