mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Fixing dark mode on load.
This commit is contained in:
parent
2e389309ce
commit
7b9e1cdaa2
1 changed files with 43 additions and 34 deletions
17
src/app.html
17
src/app.html
|
|
@ -1,6 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="description" content="Bored? Find a game! Bored Game!" />
|
<meta name="description" content="Bored? Find a game! Bored Game!" />
|
||||||
<link rel="icon" href="%sveltekit.assets%/favicon-bored.png" />
|
<link rel="icon" href="%sveltekit.assets%/favicon-bored.png" />
|
||||||
|
|
@ -10,6 +11,13 @@
|
||||||
const userTheme = localStorage.theme;
|
const userTheme = localStorage.theme;
|
||||||
const userFont = localStorage.font;
|
const userFont = localStorage.font;
|
||||||
|
|
||||||
|
const prefersDarkMode = window.matchMedia(
|
||||||
|
'prefers-color-scheme: dark'
|
||||||
|
).matches;
|
||||||
|
const prefersLightMode = window.matchMedia(
|
||||||
|
'prefers-color-scheme: light'
|
||||||
|
).matches;
|
||||||
|
|
||||||
// check if the user set a theme
|
// check if the user set a theme
|
||||||
if (userTheme) {
|
if (userTheme) {
|
||||||
htmlElement.dataset.theme = userTheme;
|
htmlElement.dataset.theme = userTheme;
|
||||||
|
|
@ -33,9 +41,10 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="svelte">%sveltekit.body%</div>
|
<div id="svelte">%sveltekit.body%</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in a new issue