用户报告了以下主题相关的问题:
标注页面 Header Bar 颜色不受主题控制
bg-primary-background、border-neutral-border 等项目列表页面标题在深色模式下显示不佳
任务数量徽章在深色模式下显示不佳
badgeInactive 样式在深色模式下不够明显Header bar 使用了 Tailwind 类,不受主题系统控制:
<div className="flex items-center justify-between p-comfortable border-b border-neutral-border bg-primary-background">
在 annotation-view.module.scss 中添加主题感知的样式类:
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 24px;
border-bottom: 1px solid var(--theme-border);
background: var(--theme-background);
}
.headerLeft {
display: flex;
align-items: center;
gap: 24px;
}
.headerRight {
display: flex;
align-items: center;
gap: 12px;
}
.taskInfo {
display: flex;
flex-direction: column;
gap: 4px;
}
.taskName {
font-size: 16px;
font-weight: 600;
color: var(--theme-headline);
margin: 0;
}
.taskMeta {
font-size: 13px;
color: var(--theme-paragraph-subtle);
margin: 0;
}
在 TSX 文件中替换为 CSS 模块类:
<div className={styles.header}>
<div className={styles.headerLeft}>
{/* ... */}
<div className={styles.taskInfo}>
<h1 className={styles.taskName}>{currentTask.name}</h1>
<p className={styles.taskMeta}>项目: {currentProject.name} | 进度: {currentTask.progress}%</p>
</div>
</div>
<div className={styles.headerRight}>
{/* ... */}
</div>
</div>
与标注页面相同,使用了 Tailwind 类。
添加相同的样式类到 editor-test.module.scss:
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 24px;
border-bottom: 1px solid var(--theme-border);
background: var(--theme-background);
}
.headerLeft {
display: flex;
align-items: center;
gap: 24px;
}
.headerRight {
display: flex;
align-items: center;
gap: 12px;
}
.headerInfo {
display: flex;
flex-direction: column;
gap: 4px;
}
.headerTitle {
font-size: 16px;
font-weight: 600;
color: var(--theme-headline);
margin: 0;
}
.headerSubtitle {
font-size: 13px;
color: var(--theme-paragraph-subtle);
margin: 0;
}
badgeInactive 在深色模式下对比度不够:
.badgeInactive {
background: var(--theme-background-secondary);
color: var(--theme-paragraph-subtle);
}
使用更深的背景色和更明显的文本色,并添加边框:
.badgeInactive {
background: var(--theme-background-tertiary);
color: var(--theme-paragraph);
border: 1px solid var(--theme-border);
}
这样在三种主题下都有更好的对比度:
SCSS 警告:需要同时定义标准属性 line-clamp
.projectDescription {
font-size: 13px;
color: var(--theme-paragraph-subtle);
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
line-clamp: 1; // 添加标准属性
overflow: hidden;
}
所有修复都使用了主题系统的 CSS 变量:
--theme-background - 主背景色--theme-background-secondary - 次要背景色--theme-background-tertiary - 第三级背景色--theme-headline - 标题文本色--theme-paragraph - 正文文本色--theme-paragraph-subtle - 次要文本色--theme-border - 边框颜色--theme-button - 按钮背景色--theme-button-text - 按钮文本色web/apps/lq_label/src/views/annotation-view/annotation-view.module.scss - 添加 header 相关样式web/apps/lq_label/src/views/editor-test/editor-test.module.scss - 添加 header 相关样式web/apps/lq_label/src/views/annotation-view/annotation-view.tsx - 替换 Tailwind 类为 CSS 模块web/apps/lq_label/src/views/editor-test/editor-test.tsx - 替换 Tailwind 类为 CSS 模块web/apps/lq_label/src/views/project-list-view/project-list-view.module.scss - 优化 badgeInactive 样式切换主题测试
项目列表测试
任务列表测试
本次修复确保了所有页面元素都正确使用主题系统的 CSS 变量,实现了:
✅ 标注页面 header bar 完全受主题控制 ✅ 编辑器测试页面 header bar 完全受主题控制 ✅ 项目列表页面在所有主题下都有良好的对比度 ✅ 任务数量徽章在深色模式下更加明显 ✅ 修复了 CSS 警告
所有修改都遵循了主题系统的设计原则,确保在三种主题模式下都有良好的视觉效果和可读性。