Skip to content

Commit 6a6899f

Browse files
sugyanclaude
andauthored
fix: parse JSON theme value from localStorage in index.html (#233)
- localStorage stores theme as JSON string ("dark") via setStorageItem - index.html was comparing with raw string causing theme mismatch - Added JSON.parse with error handling for proper theme initialization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent a06eed8 commit 6a6899f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

frontend/index.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@
88
<script>
99
// Prevent flash of unstyled content by setting theme class early
1010
(function () {
11-
const theme = localStorage.getItem("claude-code-webui-theme");
11+
const storedTheme = localStorage.getItem("claude-code-webui-theme");
12+
let theme = null;
13+
try {
14+
theme = storedTheme ? JSON.parse(storedTheme) : null;
15+
} catch {
16+
// If parsing fails, fall back to null
17+
theme = null;
18+
}
19+
1220
if (
1321
theme === "dark" ||
1422
(!theme && window.matchMedia("(prefers-color-scheme: dark)").matches)

0 commit comments

Comments
 (0)