theme setup

This commit is contained in:
2026-02-05 12:21:59 +00:00
parent a8988b8fd0
commit c47d8ac516
4 changed files with 115 additions and 1 deletions

View File

@@ -5,6 +5,22 @@
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ob248.com</title>
<script>
(() => {
try {
const stored = localStorage.getItem("theme");
const theme =
stored === "light" || stored === "dark" ? stored : "system";
const isDark =
theme === "dark" ||
(theme === "system" &&
window.matchMedia("(prefers-color-scheme: dark)").matches);
if (isDark) document.documentElement.classList.add("dark");
} catch (_error) {
document.documentElement.classList.remove("dark");
}
})();
</script>
</head>
<body>
<div id="root"></div>