The repo tracks work progress for ura.design website redesign
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
567 B

3 years ago
const themeToggle = document.querySelector("#theme-toggle");
const currentTheme = localStorage.getItem("theme");
var pageTheme = document.body;
let isDark = true
if (currentTheme == "dark") {
pageTheme.classList.add("accessibility-contrast");
}
function themeMode() {
isDark = !isDark;
pageTheme.classList.toggle("accessibility-contrast");
let theme = "light";
if (pageTheme.classList.contains("accessibility-contrast")) {
theme = "dark";
}
localStorage.setItem("theme", theme);
}
themeToggle.addEventListener("click", themeMode)