refactor(index): remove light mode

This commit is contained in:
z0x 2025-04-09 20:42:34 -04:00
parent 8b3c009de7
commit 18df241880
14 changed files with 190 additions and 748 deletions

View file

@ -33,27 +33,3 @@ import "@fontsource-variable/geist";
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<script src="/src/js/index.ts"></script>
<script is:inline>
const getThemePreference = () => {
if (typeof localStorage !== "undefined" && localStorage.getItem("theme")) {
return localStorage.getItem("theme");
}
return window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
};
const isDark = getThemePreference() === "dark";
document.documentElement.classList[isDark ? "add" : "remove"]("dark");
if (typeof localStorage !== "undefined") {
const observer = new MutationObserver(() => {
const isDark = document.documentElement.classList.contains("dark");
localStorage.setItem("theme", isDark ? "dark" : "light");
});
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"],
});
}
</script>