fixed issue with theme
parent
28ede256cd
commit
03710de7f8
|
@ -1,6 +1,14 @@
|
|||
const theme = localStorage.getItem('theme')
|
||||
?? matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? 'Dark' : 'Light';
|
||||
if (theme === 'Dark') {
|
||||
document.body.setAttribute('data-theme', theme);
|
||||
const choice = localStorage.getItem('theme');
|
||||
if (choice != null) {
|
||||
document.body.setAttribute('data-theme', choice)
|
||||
}
|
||||
else {
|
||||
const theme = localStorage.getItem('theme')
|
||||
?? matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? 'Dark' : 'Light';
|
||||
if (theme === 'Dark') {
|
||||
document.body.setAttribute('data-theme', theme);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue