feat(css): 优化主题切换图标显示逻辑
- 调整图标显示规则,确保日夜模式下图标正确隐藏 - 移除重复的图标隐藏样式定义 - 删除已弃用的MBTI标签渐变色样式 - 保持样式代码结构清晰一致
This commit is contained in:
@@ -182,7 +182,7 @@ class ThemeManager {
|
||||
|
||||
init() {
|
||||
let theme = getStoredTheme();
|
||||
if (theme === 'night') this.root.setAttribute('data-theme', 'night');
|
||||
if (theme) this.root.setAttribute('data-theme', theme);
|
||||
$('#theme-btn').toggleClass('is-active', theme === 'night');
|
||||
const langForTitle = getStoredLanguage();
|
||||
const titleText = theme === 'night' ? (langForTitle === 'zh' ? '白天模式' : 'Day') : (langForTitle === 'zh' ? '黑夜模式' : 'Night');
|
||||
@@ -191,7 +191,7 @@ class ThemeManager {
|
||||
$('#theme-btn').on('click', () => {
|
||||
const curr = this.root.getAttribute('data-theme');
|
||||
const next = curr === 'night' ? 'day' : 'night';
|
||||
if (next === 'night') this.root.setAttribute('data-theme', 'night');
|
||||
if (next) this.root.setAttribute('data-theme', next);
|
||||
else this.root.removeAttribute('data-theme');
|
||||
setStoredTheme(next)
|
||||
$('#theme-btn').toggleClass('is-active', next === 'night');
|
||||
|
||||
Reference in New Issue
Block a user