From a20e1f1fb5a0a89080615dd4aa40da920d31296b Mon Sep 17 00:00:00 2001 From: amosblomqvist Date: Thu, 17 Sep 2026 18:43:35 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20dark=20native=20chrome=20=E2=80=94=20no?= =?UTF-8?q?=20white=20flash=20on=20resize=20or=20first=20paint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Live-resize frame lag: the native window surface resizes before the compositor has a frame at the new size; the gap showed Electron's default WHITE window background — glaring on a dark app, at the edges on shrink. The standard treatment, all three: - BrowserWindow backgroundColor '#141414' fills the lag with the app bg - show: false + ready-to-show — the window appears only after the page has rendered (kills the first-paint white window) - color-scheme: dark — native widgets and scrollbars render dark Owner resize-verified in the Electron dev shell. --- app/globals.css | 1 + electron/main.cjs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/app/globals.css b/app/globals.css index 53558b0..f9594c6 100644 --- a/app/globals.css +++ b/app/globals.css @@ -18,6 +18,7 @@ /* Palette (owner's hexes): main #141414, raised #1C1C1C, edges #434343. Mono chrome = JetBrains Mono; prose = Source Sans 3; titles = CMU Serif. */ :root { + color-scheme: dark; --radius: 8px; --background: #141414; --foreground: #e6e6e6; diff --git a/electron/main.cjs b/electron/main.cjs index d48177c..eec87d8 100644 --- a/electron/main.cjs +++ b/electron/main.cjs @@ -200,6 +200,15 @@ function createWindow(url) { sandbox: true, nodeIntegration: false, }, + // Live-resize + first-paint flash (owner, 2026-09-17): during a resize + // the native window surface changes size before Chromium's compositor + // has a frame at the new size, and the gap shows the window's NATIVE + // background — Electron's default is white, glaring on a dark app. + // The app background (#141414) fills the lag instead. `show: false` + + // ready-to-show is the same treatment for first paint: the window + // appears only once the page has actually rendered. + backgroundColor: "#141414", + show: false, }); const allowedOrigin = () => new URL(url).origin; @@ -226,6 +235,7 @@ function createWindow(url) { }); void win.loadURL(url); + win.once("ready-to-show", () => win.show()); return win; }