21 lines
1.2 KiB
HTML
21 lines
1.2 KiB
HTML
<script type="text/javascript">
|
|
const currentTheme = localStorage.getItem("theme");
|
|
if (currentTheme == "light") {
|
|
document.body.classList.add("light");
|
|
}
|
|
|
|
function themetoggle() {
|
|
document.body.classList.toggle("light");
|
|
|
|
if (document.body.classList.contains("light")) {
|
|
theme = "light";
|
|
} else {
|
|
theme = "dark"
|
|
}
|
|
|
|
localStorage.setItem("theme", theme);
|
|
};
|
|
</script>
|
|
|
|
<svg onclick="themetoggle()" class="theme-toggle button tool" title="Toggle theme" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="background:var(--background)"><path d="M12 7a5 5 0 0 0-3 9v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a5 5 0 0 0-3-9z" fill="var(--primary)"/><path d="M12 6a1 1 0 0 0 1-1V3a1 1 0 0 0-2 0v2a1 1 0 0 0 1 1z" fill="var(--primary)"/><path d="M21 11h-2a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2z" fill="var(--primary)"/><path d="M5 11H3a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2z" fill="var(--primary)"/><path d="M7.66 6.42L6.22 5a1 1 0 0 0-1.39 1.47l1.44 1.39a1 1 0 0 0 .73.28 1 1 0 0 0 .72-.31 1 1 0 0 0-.06-1.41z" fill="var(--primary)"/><path d="M19.19 5.05a1 1 0 0 0-1.41 0l-1.44 1.37a1 1 0 0 0 0 1.41 1 1 0 0 0 .72.31 1 1 0 0 0 .69-.28l1.44-1.39a1 1 0 0 0 0-1.42z" fill="var(--primary)"/></svg>
|