Skip to content

Commit e994461

Browse files
committed
fix: MD3 Dark css
1 parent 5e0b4f6 commit e994461

File tree

2 files changed

+80
-75
lines changed

2 files changed

+80
-75
lines changed

exam/Scripts/colorSystem.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ class MaterialYouColorSystem {
114114
};
115115

116116
if (isDark) {
117+
// Dark mode colors - 使用源色的高lightness值作为文字颜色
118+
const lightTextColor = createColor(85); // 浅蓝色,用于暗色背景上的文字
119+
const mediumColor = createColor(55); // 中等颜色,用于 outline
120+
const darkBgColor = createColor(15); // 深蓝色,用于 background
121+
117122
return {
118123
primary: createColor(80),
119124
onPrimary: createColor(20),
@@ -127,14 +132,14 @@ class MaterialYouColorSystem {
127132
onTertiary: createColor(20),
128133
tertiaryContainer: createColor(30),
129134
onTertiaryContainer: createColor(90),
130-
background: '#121212',
131-
onBackground: '#E1E1E1',
132-
surface: '#1A1A1A',
133-
onSurface: '#E1E1E1',
134-
surfaceVariant: '#49454F',
135-
onSurfaceVariant: '#CAC7D0',
136-
outline: '#938F99',
137-
outlineVariant: '#49454F',
135+
background: darkBgColor, // ← 基于源色的深蓝色背景
136+
onBackground: lightTextColor, // ← 基于源色的浅蓝色文字
137+
surface: darkBgColor, // ← 基于源色的深蓝色surface
138+
onSurface: lightTextColor, // ← 基于源色的浅蓝色文字
139+
surfaceVariant: createColor(25), // ← 深蓝色变体
140+
onSurfaceVariant: lightTextColor, // ← 浅蓝色
141+
outline: mediumColor, // ← 基于源色的中等蓝色
142+
outlineVariant: createColor(30), // ← 深蓝色变体
138143
error: '#F2B8B5',
139144
onError: '#601410',
140145
errorContainer: '#8C1D18',

0 commit comments

Comments
 (0)