Fixed issue with theme
pull/241/head
James Montemagno 2023-10-11 14:31:47 -07:00 committed by GitHub
commit 0b587ff6bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}
}