fixed bug

This commit is contained in:
Vaica committed 2026-01-31 21:27:06 +08:00
1 parent 54b18039e3
commit 8c3232fadf
16 files changed
+1134 -97

No files matched your search

+13
View File
@@ -52,6 +52,19 @@
}
}
document.documentElement.setAttribute('data-theme', theme);
// Listen for system changes
if (window.matchMedia) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
// Only switch if user hasn't manually set a preference
// Or maybe we should respect system change if user hasn't explicitly locked it?
// Common behavior: manual override sticks.
if (!localStorage.getItem('theme')) {
var newTheme = event.matches ? "dark" : "light";
document.documentElement.setAttribute('data-theme', newTheme);
}
});
}
} catch (e) {}
})();
</script>