fixed issue with theme

pull/235/head
trba1810 2023-08-25 03:01:39 +02:00
parent 28ede256cd
commit 03710de7f8
1 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,14 @@
const theme = localStorage.getItem('theme')
?? matchMedia('(prefers-color-scheme: dark)').matches
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);
}
if (theme === 'Dark') {
document.body.setAttribute('data-theme', theme);
}
}