From 4dc2b90daad654108e8dfc25fc60ddd6c7762567 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 5 Aug 2026 18:16:03 +0200 Subject: [PATCH] fix(web): prevent terminal loading flash - Paint the themed canvas background before font and WASM initialization --- apps/web/src/terminal/ghostty/surface.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/web/src/terminal/ghostty/surface.ts b/apps/web/src/terminal/ghostty/surface.ts index 8ff92c01c0c..55f64de62ac 100644 --- a/apps/web/src/terminal/ghostty/surface.ts +++ b/apps/web/src/terminal/ghostty/surface.ts @@ -642,6 +642,11 @@ export class GhosttyTerminalSurface { const context = canvas.getContext("2d", { alpha: false }); if (!context) throw new Error("Canvas 2D is unavailable"); + // An opaque canvas backing store initializes to solid black, and the font + // and WASM loads below leave it on screen for the whole setup window; paint + // the theme background first so the mount never flashes a black box. + context.fillStyle = `rgb(${options.theme.background.r}, ${options.theme.background.g}, ${options.theme.background.b})`; + context.fillRect(0, 0, canvas.width, canvas.height); const fontSize = terminalFontSize(options.font?.size); try { // Cell metrics must come from the faces that will render; measuring before