From 610cb66d4088eaf0002b9ba3629c257cd2aaa118 Mon Sep 17 00:00:00 2001 From: hrsvrn Date: Thu, 11 Jun 2026 13:32:28 +0530 Subject: [PATCH] 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. --- apps/x/apps/renderer/src/components/email-view.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/x/apps/renderer/src/components/email-view.tsx b/apps/x/apps/renderer/src/components/email-view.tsx index 86f79fa7..7d5c5f1d 100644 --- a/apps/x/apps/renderer/src/components/email-view.tsx +++ b/apps/x/apps/renderer/src/components/email-view.tsx @@ -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'