Merge pull request #391 from Morpheus0x/fix-theme-toggle
Fixed first time theme change from dark mode
This commit is contained in:
commit
1505ba0fa7
1 changed files with 7 additions and 1 deletions
|
@ -27,9 +27,15 @@ function detectOSColorTheme() {
|
|||
function switchTheme(e) {
|
||||
if (chosenThemeIsDark) {
|
||||
localStorage.setItem("theme", "light");
|
||||
} else if (chosenThemeIsLight) {
|
||||
localStorage.setItem("theme", "dark");
|
||||
} else {
|
||||
if (document.documentElement.getAttribute("data-theme") == "dark") {
|
||||
localStorage.setItem("theme", "light");
|
||||
} else {
|
||||
localStorage.setItem("theme", "dark");
|
||||
}
|
||||
}
|
||||
|
||||
detectOSColorTheme();
|
||||
window.location.reload();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue