app.html 1.67 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
2
3
4
5
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<link rel="icon" href="%sveltekit.assets%/favicon.png" />
ntimo's avatar
ntimo committed
6
		<link rel="manifest" href="%sveltekit.assets%/manifest.json" />
Timothy J. Baek's avatar
Timothy J. Baek committed
7
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
tracer123's avatar
tracer123 committed
8
		<meta name="robots" content="noindex,nofollow" />
Timothy J. Baek's avatar
Timothy J. Baek committed
9
10
		<script>
			// On page load or when changing themes, best to add inline in `head` to avoid FOUC
11
12
13
14
15
16
17
18
19
20
21
22
23
			(() => {
				if (
					localStorage.theme === 'light' ||
					(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: light)').matches)
				) {
					document.documentElement.classList.add('light');
				} else if (localStorage.theme && localStorage.theme !== 'system') {
					localStorage.theme.split(' ').forEach((e) => {
						document.documentElement.classList.add(e);
					});
				} else if (localStorage.theme && localStorage.theme === 'system') {
					systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
					document.documentElement.classList.add(systemTheme ? 'dark' : 'light');
Danny Liu's avatar
Danny Liu committed
24
				} else {
25
26
					document.documentElement.classList.add('dark');
				}
27

28
29
30
31
32
33
34
35
36
				window.matchMedia('(prefers-color-scheme: dark)').addListener((e) => {
					if (localStorage.theme === 'system') {
						if (e.matches) {
							document.documentElement.classList.add('dark');
							document.documentElement.classList.remove('light');
						} else {
							document.documentElement.classList.add('light');
							document.documentElement.classList.remove('dark');
						}
37
					}
Danny Liu's avatar
Danny Liu committed
38
				});
39
			})();
Timothy J. Baek's avatar
Timothy J. Baek committed
40
41
		</script>

Timothy J. Baek's avatar
Timothy J. Baek committed
42
43
44
45
46
47
		%sveltekit.head%
	</head>
	<body data-sveltekit-preload-data="hover">
		<div style="display: contents">%sveltekit.body%</div>
	</body>
</html>