chore: minor changes
This commit is contained in:
+8
-1
@@ -5,7 +5,14 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script>
|
||||
const theme = localStorage.getItem("color-scheme") || "auto"
|
||||
function safeParseString(str) {
|
||||
try {
|
||||
return JSON.parse(str)
|
||||
} catch {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
const theme = safeParseString(localStorage.getItem("color-scheme")) || "auto"
|
||||
const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||
if (theme === "auto" ? isDark : theme === "dark") {
|
||||
document.documentElement.classList.add("dark")
|
||||
|
||||
Reference in New Issue
Block a user