Skip to content

Commit

Permalink
set default theme to dark
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoqih committed Dec 8, 2024
1 parent f64454b commit 8de6652
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ document.addEventListener('DOMContentLoaded', () => {

// 设置初始主题
function setInitialTheme() {
if (localStorage.getItem('theme')) {
document.documentElement.setAttribute('data-theme', localStorage.getItem('theme'));
updateIcon(localStorage.getItem('theme'));
} else if (prefersDark.matches) {
document.documentElement.setAttribute('data-theme', 'dark');
updateIcon('dark');
}
// if (localStorage.getItem('theme')) {
// document.documentElement.setAttribute('data-theme', localStorage.getItem('theme'));
// updateIcon(localStorage.getItem('theme'));
// } else if (prefersDark.matches) {
// }
document.documentElement.setAttribute('data-theme', 'dark');
updateIcon('dark');
}

// 更新图标
Expand Down

0 comments on commit 8de6652

Please sign in to comment.