darkmode
This commit is contained in:
@@ -3,6 +3,20 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script>
|
||||
// apply the persisted theme before first paint to avoid a flash
|
||||
try {
|
||||
var theme = JSON.parse(localStorage.getItem('theme') || '"system"');
|
||||
if (
|
||||
theme === 'dark' ||
|
||||
(theme === 'system' && matchMedia('(prefers-color-scheme: dark)').matches)
|
||||
) {
|
||||
document.documentElement.classList.add('dark');
|
||||
}
|
||||
} catch (e) {
|
||||
/* ignore */
|
||||
}
|
||||
</script>
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
|
||||
Reference in New Issue
Block a user