1 line
475 B
JavaScript
1 line
475 B
JavaScript
|
function switchTheme(e){let t=document.documentElement.getAttribute("data-theme");return null===t||"light"===t?(document.documentElement.setAttribute("data-theme","dark"),localStorage.setItem("theme","dark")):(document.documentElement.setAttribute("data-theme","light"),localStorage.setItem("theme","light")),!1}const currentTheme=localStorage.getItem("theme")?localStorage.getItem("theme"):null;currentTheme&&document.documentElement.setAttribute("data-theme",currentTheme);
|