From 34c55fccb9a45f091cd9a00b5f44051c063defa6 Mon Sep 17 00:00:00 2001 From: spleenftw Date: Fri, 29 May 2026 16:34:40 +0200 Subject: [PATCH] fix whitescreen when switching pages. --- css/style.css | 2 ++ index.php | 5 +++++ php/head.php | 26 +++++++++++++++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index 30a9bf0..1c8b4be 100644 --- a/css/style.css +++ b/css/style.css @@ -217,6 +217,8 @@ html { position: relative; min-height: 100%; scroll-behavior: smooth; + background-color: var(--bg-body); + transition: background-color 0.25s ease; } body { diff --git a/index.php b/index.php index 0f3adeb..6df044e 100644 --- a/index.php +++ b/index.php @@ -140,6 +140,11 @@ function apply(theme) { root.setAttribute('data-theme', theme); try { localStorage.setItem(STORAGE_KEY, theme); } catch (e) {} + // Keep the inline html background/color-scheme in sync (set early + // in head.php to prevent a white flash between page loads). + var bg = window.BLOWDIT_THEME_BG || {}; + if (bg[theme]) { root.style.backgroundColor = bg[theme]; } + root.style.colorScheme = (theme === 'light') ? 'light' : 'dark'; syncIcon(theme); } diff --git a/php/head.php b/php/head.php index 3034208..27e5c79 100644 --- a/php/head.php +++ b/php/head.php @@ -2,17 +2,29 @@ - +