first commit

This commit is contained in:
Justin Visser 2026-03-02 20:09:27 +01:00
commit b47f825d54
83 changed files with 10016 additions and 0 deletions

View file

@ -0,0 +1,30 @@
import { ref, watch } from "vue";
const isDark = ref(false);
// Initialize from localStorage or system preference
const stored = localStorage.getItem("dark_mode");
if (stored !== null) {
isDark.value = stored === "true";
} else {
isDark.value = window.matchMedia("(prefers-color-scheme: dark)").matches;
}
// Apply class to <html>
function applyClass() {
document.documentElement.classList.toggle("dark", isDark.value);
}
applyClass();
watch(isDark, () => {
applyClass();
localStorage.setItem("dark_mode", String(isDark.value));
});
export function useDarkMode() {
function toggle() {
isDark.value = !isDark.value;
}
return { isDark, toggle };
}