mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2026-06-14 17:36:40 +00:00
14 lines
485 B
HTML
14 lines
485 B
HTML
<button class="theme-toggle" onclick="toggleTheme()">🌓</button>
|
|
<script>
|
|
function toggleTheme(){
|
|
const html=document.documentElement;
|
|
const current=html.getAttribute("data-theme")||"dark";
|
|
const next=current==="dark"?"light":"dark";
|
|
html.setAttribute("data-theme",next);
|
|
localStorage.setItem("theme",next)
|
|
}
|
|
(function(){
|
|
const saved=localStorage.getItem("theme")||"dark";
|
|
document.documentElement.setAttribute("data-theme",saved)
|
|
})();
|
|
</script>
|