fix: nightmode selector not updated when starting with a dark browser theme
This commit is contained in:
parent
c891a924cd
commit
7561329158
1 changed files with 5 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
<script lang="js">
|
<script lang="js">
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
let checked = false;
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const ROOT = document.querySelector(':root');
|
const ROOT = document.querySelector(':root');
|
||||||
|
|
@ -46,6 +47,9 @@
|
||||||
subtree: false,
|
subtree: false,
|
||||||
});
|
});
|
||||||
setScheme();
|
setScheme();
|
||||||
|
// adjust the theme selector
|
||||||
|
checked = globalScheme === DARK;
|
||||||
|
|
||||||
setContrast();
|
setContrast();
|
||||||
// Switch to dark scheme
|
// Switch to dark scheme
|
||||||
// ROOT.dataset.nuContrast = 'more';
|
// ROOT.dataset.nuContrast = 'more';
|
||||||
|
|
@ -66,7 +70,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label class="switch">
|
<label class="switch">
|
||||||
<input aria-label="Nightmode" type="checkbox" on:change={toggleTheme} />
|
<input aria-label="Nightmode" type="checkbox" bind:checked on:change={toggleTheme} />
|
||||||
<span class="slider round" />
|
<span class="slider round" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue