fix: Check user's theme preference during page load (#156)

This commit is contained in:
Alessio Cappa
2025-09-23 15:43:36 +02:00
committed by GitHub
parent d2f631ec5c
commit 2716fad72c
3 changed files with 8 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
<script>
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.setAttribute("data-theme", "dark");
}
</script>