mirror of
https://github.com/Speyll/anemone.git
synced 2024-12-27 03:17:20 +00:00
10 lines
439 B
HTML
10 lines
439 B
HTML
|
<div class="themeSwitch">
|
||
|
<button class="themeButton light" onclick="setTheme('light')" title="Light mode">◐</button>
|
||
|
<button class="themeButton dark" onclick="setTheme('dark')" title="Dark mode">◑</button>
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
const setTheme=(theme)=>{document.documentElement.className=theme;localStorage.setItem('theme',theme)}
|
||
|
const getTheme=()=>{const theme=localStorage.getItem('theme');theme&&setTheme(theme)}
|
||
|
getTheme()
|
||
|
</script>
|