feat: 优化主题色系统
1. 更新Light主题主色调为深蓝色(50, 50, 222) 2. 优化Dark主题主色调为亮蓝色(93, 135, 255) 3. 优化文本颜色系统 4. 增强Element Plus组件主题配置 5. 更新前端开发规范文档 6. 添加变更记录
This commit is contained in:
1 parent
afe3e234e9
commit
963e2f80d4
3 files changed
+203
-12
No files matched your search
@@ -682,3 +682,110 @@ test('用户列表页面', async ({ page }) => {
|
||||
await expect(page.locator('.user-list')).toBeVisible();
|
||||
});
|
||||
```
|
||||
|
||||
## 主题色规范
|
||||
|
||||
### 1. 基础主题色值
|
||||
|
||||
#### Light 主题
|
||||
|
||||
```scss
|
||||
// 主色调
|
||||
--art-primary: 50, 50, 222; // 深蓝色,用于主要按钮、链接等
|
||||
--art-secondary: 73, 190, 255; // 次要蓝色
|
||||
--art-success: 0, 167, 58; // 成功色
|
||||
--art-warning: 142, 91, 0; // 警告色
|
||||
--art-danger: 255, 77, 79; // 危险色
|
||||
--art-info: 0, 75, 178; // 信息色
|
||||
--art-error: 250, 137, 107; // 错误色
|
||||
|
||||
// 文本颜色
|
||||
--art-text-gray-600: #333333; // 主要文本
|
||||
--art-text-gray-700: #000000; // 强调文本
|
||||
```
|
||||
|
||||
#### Dark 主题
|
||||
|
||||
```scss
|
||||
// 主色调
|
||||
--art-primary: 93, 135, 255; // 亮蓝色
|
||||
--art-bg-color: #070707; // 背景色
|
||||
--art-main-bg-color: #161618; // 主要背景色
|
||||
```
|
||||
|
||||
### 2. 使用规范
|
||||
|
||||
1. **变量使用方式**
|
||||
|
||||
```scss
|
||||
// 正确用法
|
||||
color: rgb(var(--art-primary));
|
||||
background-color: rgb(var(--art-bg-primary));
|
||||
|
||||
// 错误用法
|
||||
color: var(--art-primary); // ❌ 缺少rgb()
|
||||
```
|
||||
|
||||
2. **Element Plus 组件主题**
|
||||
|
||||
```scss
|
||||
// 全局变量
|
||||
--el-color-primary: rgb(var(--art-primary)) !important;
|
||||
--el-text-color-regular: #000000 !important;
|
||||
```
|
||||
|
||||
3. **菜单组件样式**
|
||||
```scss
|
||||
--el-menu-hover-bg-color: rgb(var(--art-primary)) !important;
|
||||
--el-menu-active-color: rgb(var(--art-primary)) !important;
|
||||
```
|
||||
|
||||
### 3. 主题切换
|
||||
|
||||
1. **Light/Dark 主题切换**
|
||||
|
||||
- 通过添加/移除 `html.dark` 类实现
|
||||
- 自动继承对应主题的所有变量
|
||||
|
||||
2. **响应式设计**
|
||||
- 所有颜色必须使用 CSS 变量
|
||||
- 禁止使用硬编码的颜色值
|
||||
|
||||
### 4. 辅助工具类
|
||||
|
||||
```scss
|
||||
// 背景色
|
||||
.bg-primary {
|
||||
background-color: rgb(var(--art-bg-primary)) !important;
|
||||
}
|
||||
.bg-success {
|
||||
background-color: rgb(var(--art-bg-success)) !important;
|
||||
}
|
||||
.bg-warning {
|
||||
background-color: rgb(var(--art-bg-warning)) !important;
|
||||
}
|
||||
.bg-danger {
|
||||
background-color: rgb(var(--art-bg-danger)) !important;
|
||||
}
|
||||
|
||||
// 文本颜色
|
||||
.text-primary {
|
||||
color: rgb(var(--art-primary)) !important;
|
||||
}
|
||||
.text-success {
|
||||
color: rgb(var(--art-success)) !important;
|
||||
}
|
||||
.text-warning {
|
||||
color: rgb(var(--art-warning)) !important;
|
||||
}
|
||||
.text-danger {
|
||||
color: rgb(var(--art-danger)) !important;
|
||||
}
|
||||
```
|
||||
|
||||
### 5. 注意事项
|
||||
|
||||
1. 所有新增组件必须使用主题变量系统
|
||||
2. 禁止使用硬编码的颜色值
|
||||
3. 确保 Light/Dark 主题下都有良好的显示效果
|
||||
4. Element Plus 组件的主题配置必须通过全局变量覆盖
|
||||
Reference in new issue
Block a user