mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 06:32:03 +00:00
Default to the dark theme for a fresh visitor
With no stored preference the app now resolves to dark instead of tracking the OS. An explicit choice still wins: light/dark persist as before, and "system" is now persisted verbatim rather than as a cleared key, so an explicit OS-tracking choice stays distinguishable from a never-chosen state and survives a reload. The first-paint bootstrap script mirrors the same resolution so a fresh visitor sees no flash to light.
This commit is contained in:
1 parent
74a245a29c
commit
f0b26141ed
2 files changed
+15
-7
No files matched your search
+1
-1
@@ -90,7 +90,7 @@ export const viewport: Viewport = {
|
||||
};
|
||||
|
||||
// Inline script to apply theme before first paint (prevents FOUC)
|
||||
const themeScript = `(function(){try{var t=localStorage.getItem("healthlog-theme");var c=(t==="light"||t==="dark")?t:(window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light");document.documentElement.classList.add(c)}catch(e){document.documentElement.classList.add("dark")}})()`;
|
||||
const themeScript = `(function(){try{var t=localStorage.getItem("healthlog-theme");var c=(t==="light"||t==="dark")?t:(t==="system"?(window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light"):"dark");document.documentElement.classList.add(c)}catch(e){document.documentElement.classList.add("dark")}})()`;
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
|
||||
Reference in new issue
Block a user