From fc4dd42af54c68917d9a02eabba5ee44f08e9420 Mon Sep 17 00:00:00 2001 From: NewsNIng Date: Sat, 11 Apr 2026 15:15:21 +0800 Subject: [PATCH] fix(docs): prevent theme reset to dark after user switches to auto/light Starlight removes the `starlight-theme` localStorage key when the user selects "auto" mode. The old init script checked that key, so every navigation or refresh re-forced dark theme. Use a separate `archon-theme-init` sentinel that persists across theme changes. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/docs-web/astro.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs-web/astro.config.mjs b/packages/docs-web/astro.config.mjs index cabfa83fd9..d4d0301cfe 100644 --- a/packages/docs-web/astro.config.mjs +++ b/packages/docs-web/astro.config.mjs @@ -15,7 +15,7 @@ export default defineConfig({ head: [ { tag: 'script', - content: `if(!localStorage.getItem('starlight-theme')){localStorage.setItem('starlight-theme','dark');document.documentElement.dataset.theme='dark';}`, + content: `if(!localStorage.getItem('archon-theme-init')){localStorage.setItem('archon-theme-init','1');localStorage.setItem('starlight-theme','dark');document.documentElement.dataset.theme='dark';}`, }, ], social: [{ icon: 'github', label: 'GitHub', href: 'https://github.com/coleam00/Archon' }],