Skip to content

Commit

Permalink
Fixed themeing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
XengShi committed Dec 5, 2023
1 parent ca5bfe0 commit 1ae3eca
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,22 @@ document.addEventListener("DOMContentLoaded", () => {
localStorage.setItem("selectedSearchEngine", selectedOption);
});
});
// -----The stay changed even if user reload the page---
// 🔴🟠🟡🟢🔵🟣⚫️⚪️🟤
const storedTheme = localStorage.getItem(themeStorageKey);
if (storedTheme) {
applySelectedTheme(storedTheme);
const selectedRadioButton = document.querySelector(`.colorPlate[value="${storedTheme}"]`);
if (selectedRadioButton) {
selectedRadioButton.checked = true;
}
}

});


// Function to apply the selected theme
// let themeButton = document.getElementById("themeButton")
// themeButton.onclick = () => {
// document.getElementById("colorsContainer").classList.toggle("showColorPlate")
// }

// 🔴🟠🟡🟢🔵🟣⚫️⚪️🟤
const radioButtons = document.querySelectorAll('.colorPlate');
const themeStorageKey = 'selectedTheme';

Expand Down

0 comments on commit 1ae3eca

Please sign in to comment.