mirror of
https://github.com/KevinMidboe/infra-map.git
synced 2026-03-11 08:25:57 +00:00
use prefered color scheme for dark/light mode
This commit is contained in:
@@ -10,15 +10,22 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
function updateBodyClass() {
|
||||
document.body.className = darkmode ? "dark" : "light";
|
||||
}
|
||||
|
||||
let darkmode = $state(false);
|
||||
const darkmodeToggleIcon = $derived(darkmode ? "🌝" : "🌚");
|
||||
|
||||
function toggleDarkmode() {
|
||||
darkmode = !darkmode;
|
||||
document.body.className = darkmode ? "dark" : "light";
|
||||
updateBodyClass()
|
||||
}
|
||||
|
||||
onMount(() => darkmode = systemDarkModeEnabled())
|
||||
onMount(() => {
|
||||
darkmode = systemDarkModeEnabled()
|
||||
updateBodyClass()
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="darkToggle">
|
||||
|
||||
Reference in New Issue
Block a user