Skip to content

Commit

Permalink
fix(menu): Fix dark/light theme selector
Browse files Browse the repository at this point in the history
  • Loading branch information
coolapso committed May 21, 2023
1 parent 431fe26 commit 6929605
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const chosenTheme = window.localStorage && window.localStorage.getItem("theme");
const chosenThemeIsDark = chosenTheme == "dark";
const chosenThemeIsLight = chosenTheme == "light";


// Detect the color scheme the operating system prefers.
function detectOSColorTheme() {
if (chosenThemeIsDark) {
Expand All @@ -23,7 +24,6 @@ function detectOSColorTheme() {
}
}

// Switch the theme.
// Switch the theme.
function switchTheme(e) {
if (chosenThemeIsDark) {
Expand All @@ -42,10 +42,6 @@ function switchTheme(e) {
window.location.reload();
}

detectOSColorTheme();
window.location.reload();
}

// Event listener
if (themeToggle) {
themeToggle.addEventListener("click", switchTheme, false);
Expand Down

0 comments on commit 6929605

Please sign in to comment.