diff --git a/src/components/ThemeToggle.astro b/src/components/ThemeToggle.astro index 85a98a5..f252431 100644 --- a/src/components/ThemeToggle.astro +++ b/src/components/ThemeToggle.astro @@ -23,33 +23,24 @@ diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index e026ec7..f0a20d7 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -8,6 +8,35 @@ import "../styles/global.css";
+ + diff --git a/src/styles/global.css b/src/styles/global.css index e820d92..e73557b 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -3,6 +3,16 @@ @variant dark (&:where(.dark, .dark *)); +/* Prevent theme flash by hiding content until theme is applied */ +html:not(.theme-loaded) body { + display: none; +} + +/* Ensure smooth transitions between themes */ +html.theme-loaded body { + transition: background-color 0.3s ease, color 0.3s ease; +} + @font-face { font-family: "Literata Variable"; font-style: normal;