bugfix theme/css
This commit is contained in:
@@ -2,6 +2,11 @@ function toggleTheme() {
|
||||
const theme = "theme-dark";//localStorage.getItem('theme');
|
||||
const root = document.querySelector(":root");
|
||||
root.classList.toggle(theme);
|
||||
if (root.classList.contains(theme)) {
|
||||
localStorage.setItem('theme', theme);
|
||||
} else {
|
||||
localStorage.setItem('theme', "theme-light");
|
||||
}
|
||||
}
|
||||
|
||||
function setTheme(themeName) {
|
||||
@@ -23,12 +28,11 @@ function detectTheme() {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (window.matchMedia('(prefers-color-scheme: light)').matches) {
|
||||
// setTheme('theme-light');
|
||||
// return;
|
||||
// }
|
||||
if (window.matchMedia('(prefers-color-scheme: light)').matches) {
|
||||
setTheme('theme-light');
|
||||
return;
|
||||
}
|
||||
|
||||
// setTheme('theme-light');
|
||||
setTheme('theme-light');
|
||||
}
|
||||
detectTheme();
|
||||
|
||||
|
Reference in New Issue
Block a user