File size: 1,376 Bytes
50bebf4 6426ece 50bebf4 6426ece 50bebf4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<style>
body {
background: white;
}
body.dark {
background: #101828;
}
</style>
<script>
(function () {
const urlParams = new URLSearchParams(window.location.search);
const theme = urlParams.get('_theme');
let systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
function updateTheme() {
if (theme === 'dark') {
document.body.classList.add('dark');
} else if (theme === 'light') {
document.body.classList.remove('dark');
} else if (theme === 'system' || theme === null || theme === undefined) {
if (systemPrefersDark) {
document.body.classList.add('dark');
} else {
document.body.classList.remove('dark');
}
}
}
// Initial theme update
updateTheme();
// Listen for system preference changes
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (event) => {
systemPrefersDark = event.matches;
updateTheme();
});
})();
</script>
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
|