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 @@ - +