修复主题切换闪烁问题

This commit is contained in:
Zuoling Rong
2025-05-03 13:34:22 +08:00
parent 867d5d8adf
commit e97fb43159
3 changed files with 100 additions and 43 deletions

View File

@@ -55,6 +55,30 @@ body.light-theme {
--gradient-color-simple: linear-gradient(135deg, #4a9eff 0%, #a855f7 100%);
}
/* 预加载主题 - 在JS完全加载前显示正确的主题 */
html.theme-preload body {
background-color: #e0e0d8; /* 明亮主题背景色 */
color: #333333; /* 明亮主题文本色 */
}
/* 预加载侧边栏状态 - 在JS完全加载前显示正确的侧边栏宽度 */
html.sidebar-collapsed-preload .sidebar {
width: var(--sidebar-collapsed-width);
}
html.sidebar-collapsed-preload .content {
margin-left: var(--sidebar-collapsed-width);
}
/* 控制页面预加载状态 */
html.preload .layout {
opacity: 0;
}
html.preload * {
transition: none !important;
}
/* 主题切换按钮 */
.theme-toggle {
position: fixed;