remeber darkmode pick

This commit is contained in:
gws 2024-11-13 11:52:42 +01:00
parent db5d01f04a
commit 62ff3ca28f

View file

@ -59,6 +59,7 @@
src="/flag-for-united-kingdom-svgrepo-com.svg" _="{{ hyper }}"></a>
{% endif %}
<div class='toggle-dark'>
<label>
<input type='checkbox' _="on click
@ -66,15 +67,16 @@
if me.checked
log('checked')
add .dark to the closest <body/>
window.localStorage.setItem('darkmode', 'true')
else
remove .dark from the closest <body/>
window.localStorage.setItem('darkmode', 'false')
end
log('darkmode') then log(window.localStorage.getItem('darkmode'))
end
on load
if (the first <body/> match .dark)
log('loaded as dark') then
set me.checked to true then
log(me)
if window.localStorage.getItem('darkmode') == 'true'
send click to me
">
<span class='slider'></span>
</label>