Skip to content

Commit a6d7150

Browse files
PR Batch Testerclaude
andcommitted
fix(desktop): markdown and plain-text pages are readable in dark mode
Electron gives <webview> guests a transparent base background, and Chromium only paints a dark canvas for dark color-scheme pages over an opaque base. Plain-text documents (e.g. .md files) declare `color-scheme: light dark`, so in dark mode their text turned white over the white webview backing. Set an opaque white default background on each guest when the preview control session attaches, matching Chrome's behavior. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 5cc99e1 commit a6d7150

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎apps/desktop/src/preview/Manager.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,17 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
14181418
),
14191419
{ concurrency: "unbounded", discard: true },
14201420
);
1421+
// Electron gives `<webview>` guests a transparent base background, and
1422+
// Chromium only paints a dark canvas for dark color-scheme pages over an
1423+
// opaque base. Without this, dark-scheme pages with no background of
1424+
// their own (text/plain, e.g. .md files) render white text on white.
1425+
yield* attemptPromise(
1426+
{ operation: "initializeDebugger.defaultBackground", webContentsId: wc.id },
1427+
() =>
1428+
wcDebugger.sendCommand("Emulation.setDefaultBackgroundColorOverride", {
1429+
color: { r: 255, g: 255, b: 255, a: 1 },
1430+
}),
1431+
);
14211432
return [
14221433
control,
14231434
replaceMap(sessions, (copy) => {

0 commit comments

Comments
 (0)