KT-personal-website/public/assets/js/app-min.js

1 line
475 B
JavaScript
Raw Normal View History

2024-10-22 12:26:08 +02:00
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);