coyotte508 HF staff commited on
Commit
9c68297
1 Parent(s): 77c7055

🚸 Use default system theme (#80)

Browse files
Files changed (1) hide show
  1. src/app.html +4 -1
src/app.html CHANGED
@@ -16,7 +16,10 @@
16
  <div class="contents h-full">%sveltekit.body%</div>
17
  </body>
18
  <script>
19
- if (localStorage.theme === "dark") {
 
 
 
20
  document.documentElement.classList.add("dark");
21
  }
22
  </script>
 
16
  <div class="contents h-full">%sveltekit.body%</div>
17
  </body>
18
  <script>
19
+ if (
20
+ localStorage.theme === "dark" ||
21
+ (!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)
22
+ ) {
23
  document.documentElement.classList.add("dark");
24
  }
25
  </script>