@agentscope-ai/design 1.0.22 → 1.0.23-beta.1767091755248

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +1,61 @@
1
1
  /**
2
- * 主题生成器 - Theme Generator
2
+ * Theme Generator
3
3
 
4
- * 核心功能:
5
- * 1. 颜色空间转换(HEX/RGB/HSL)
6
- * 2. 颜色调整和生成
7
- * 3. 完整主题配置生成(支持浅色/暗色模式)
4
+ * Generates a complete theme configuration based on input primary color, background color, and text color.
5
+ * Supports both light and dark modes.
8
6
  *
9
- * 设计原则(参考 Radix Colors):
10
- * - 浅色模式:背景 95-99% 亮度,边框 80-90% 亮度,文本 15-25% 亮度
11
- * - 暗色模式:背景 0-10% 亮度,边框使用透明度,文本 85-95% 亮度
12
- * - 状态色和装饰色在暗色模式下使用预设优化值
7
+ * ## Core Features
8
+ * 1. **Color Space Conversion**: HEX RGB ↔ HSL conversions
9
+ * 2. **Color Adjustment and Generation**: Adjust brightness and saturation based on HSL color space
10
+ * 3. **Complete Theme Configuration**: Generates a complete theme configuration object including
11
+ * primary colors, text colors, background colors, border colors, fill colors, status colors,
12
+ * decorative colors, shadows, etc.
13
13
  *
14
- * 生成规则:
15
- * - 主色 (Primary):从输入的主色生成,暗色模式自动调整亮度
16
- * - 背景色系:基于 bgBase 生成,保持色相统一
17
- * - 文本色系:基于 textBase 生成,保持色相统一
18
- * - 边框色系:基于 bgBase 生成,饱和度提高以增强可见度
19
- * - 填充色系:暗色模式基于文本色+透明度,浅色模式基于背景色
20
- * - 状态色/装饰色/阴影:暗色模式使用预设优化值,浅色模式使用配置文件
14
+ * ## Design Principles
15
+ * ### Light Mode
16
+ * - Background: 95-99% lightness
17
+ * - Border: 80-90% lightness
18
+ * - Text: 15-25% lightness
19
+ *
20
+ * ### Dark Mode
21
+ * - Background: 0-10% lightness
22
+ * - Border: Uses transparency to enhance layering
23
+ * - Text: 85-95% lightness
24
+ * - Status colors and decorative colors: Use preset optimized values
25
+ *
26
+ * ## Generation Rules
27
+ * - **Primary Color**: Generated from input primary color, automatically adjusts brightness in dark mode for readability
28
+ * - **Background Color System**: Generated based on bgBase, maintains consistent hue
29
+ * - **Text Color System**: Generated based on textBase, uses transparency to achieve different levels
30
+ * - **Border Color System**: Generated based on bgBase, increases saturation to enhance visibility
31
+ * - **Fill Color System**: Dark mode uses text color + transparency, light mode uses background color
32
+ * - **Status Colors/Decorative Colors/Shadows**: Dark mode uses preset optimized values, light mode uses configuration file
21
33
  */
22
34
  /**
23
- * 生成完整主题
24
- * @param {string} primaryHex - 主色调
25
- * @param {string} bgBaseHex - 背景基础色
26
- * @param {string} textBaseHex - 文本基础色
27
- * @param {boolean} darkMode - 是否为暗色模式
28
- * @returns {Object} 完整的主题配置对象
35
+ * Generates complete theme configuration
36
+ *
37
+ * Generates a complete theme configuration object based on input primary color, background color,
38
+ * text color, and mode (light/dark). The theme configuration includes: primary colors, text colors,
39
+ * background colors, border colors, fill colors, status colors, decorative colors, shadows, etc.
40
+ *
41
+ * @param {Object} props - Theme generation parameters
42
+ * @param {string} props.primaryHex - Primary color HEX value (required)
43
+ * @param {string} [props.bgBaseHex] - Background base color HEX value, uses default if not provided (light: #ffffff, dark: #000000)
44
+ * @param {string} [props.textBaseHex] - Text base color HEX value, uses default if not provided (light: #1a1a1a, dark: #E7E7ED)
45
+ * @param {boolean} [props.darkMode=false] - Whether it is dark mode
46
+ * @returns {Object | null} Complete theme configuration object, returns null if parameters are invalid
29
47
  */
30
48
  interface GenerateThemeProps {
49
+ /** Primary color HEX value */
31
50
  primaryHex: string;
51
+ /** Background base color HEX value */
32
52
  bgBaseHex?: string;
53
+ /** Text base color HEX value */
33
54
  textBaseHex?: string;
55
+ /** Whether it is dark mode */
34
56
  darkMode: boolean;
35
57
  }
36
- declare const generateTheme: ({ primaryHex, bgBaseHex, textBaseHex, darkMode, }: GenerateThemeProps) => {
58
+ declare const generateTheme: (config: GenerateThemeProps) => {
37
59
  borderRadiusXS: number;
38
60
  borderRadiusSM: number;
39
61
  borderRadius: number;
@@ -51,6 +73,7 @@ declare const generateTheme: ({ primaryHex, bgBaseHex, textBaseHex, darkMode, }:
51
73
  colorPrimaryText: any;
52
74
  colorPrimaryTextHover: any;
53
75
  colorPrimaryTextActive: any;
76
+ colorTextOnPrimary: string;
54
77
  colorTextBase: string;
55
78
  colorText: string;
56
79
  colorTextSecondary: string;
@@ -60,7 +83,7 @@ declare const generateTheme: ({ primaryHex, bgBaseHex, textBaseHex, darkMode, }:
60
83
  colorBgBase: string;
61
84
  colorBgContainer: any;
62
85
  colorBgElevated: any;
63
- colorBgLayout: any;
86
+ colorBgLayout: string;
64
87
  colorBgSpotlight: string;
65
88
  colorBgMask: string;
66
89
  colorBorder: any;
@@ -1,32 +1,46 @@
1
1
  /**
2
- * 主题生成器 - Theme Generator
2
+ * Theme Generator
3
3
 
4
- * 核心功能:
5
- * 1. 颜色空间转换(HEX/RGB/HSL)
6
- * 2. 颜色调整和生成
7
- * 3. 完整主题配置生成(支持浅色/暗色模式)
4
+ * Generates a complete theme configuration based on input primary color, background color, and text color.
5
+ * Supports both light and dark modes.
8
6
  *
9
- * 设计原则(参考 Radix Colors):
10
- * - 浅色模式:背景 95-99% 亮度,边框 80-90% 亮度,文本 15-25% 亮度
11
- * - 暗色模式:背景 0-10% 亮度,边框使用透明度,文本 85-95% 亮度
12
- * - 状态色和装饰色在暗色模式下使用预设优化值
7
+ * ## Core Features
8
+ * 1. **Color Space Conversion**: HEX RGB ↔ HSL conversions
9
+ * 2. **Color Adjustment and Generation**: Adjust brightness and saturation based on HSL color space
10
+ * 3. **Complete Theme Configuration**: Generates a complete theme configuration object including
11
+ * primary colors, text colors, background colors, border colors, fill colors, status colors,
12
+ * decorative colors, shadows, etc.
13
13
  *
14
- * 生成规则:
15
- * - 主色 (Primary):从输入的主色生成,暗色模式自动调整亮度
16
- * - 背景色系:基于 bgBase 生成,保持色相统一
17
- * - 文本色系:基于 textBase 生成,保持色相统一
18
- * - 边框色系:基于 bgBase 生成,饱和度提高以增强可见度
19
- * - 填充色系:暗色模式基于文本色+透明度,浅色模式基于背景色
20
- * - 状态色/装饰色/阴影:暗色模式使用预设优化值,浅色模式使用配置文件
14
+ * ## Design Principles
15
+ * ### Light Mode
16
+ * - Background: 95-99% lightness
17
+ * - Border: 80-90% lightness
18
+ * - Text: 15-25% lightness
19
+ *
20
+ * ### Dark Mode
21
+ * - Background: 0-10% lightness
22
+ * - Border: Uses transparency to enhance layering
23
+ * - Text: 85-95% lightness
24
+ * - Status colors and decorative colors: Use preset optimized values
25
+ *
26
+ * ## Generation Rules
27
+ * - **Primary Color**: Generated from input primary color, automatically adjusts brightness in dark mode for readability
28
+ * - **Background Color System**: Generated based on bgBase, maintains consistent hue
29
+ * - **Text Color System**: Generated based on textBase, uses transparency to achieve different levels
30
+ * - **Border Color System**: Generated based on bgBase, increases saturation to enhance visibility
31
+ * - **Fill Color System**: Dark mode uses text color + transparency, light mode uses background color
32
+ * - **Status Colors/Decorative Colors/Shadows**: Dark mode uses preset optimized values, light mode uses configuration file
21
33
  */
22
34
 
23
35
  import themeDataDark from "./bailianDarkTheme.json";
24
36
  import themeData from "./bailianTheme.json";
25
37
 
26
- // ==================== 颜色转换工具函数 ====================
38
+ // ==================== Color Conversion Utility Functions ====================
27
39
 
28
40
  /**
29
- * HEX RGB
41
+ * Converts HEX color value to RGB object
42
+ * @param {string} hex - HEX color value (e.g., '#FF0000' or 'FF0000')
43
+ * @returns {{r: number, g: number, b: number} | null} RGB object, returns null if conversion fails
30
44
  */
31
45
  var hexToRgb = function hexToRgb(hex) {
32
46
  var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
@@ -38,21 +52,29 @@ var hexToRgb = function hexToRgb(hex) {
38
52
  };
39
53
 
40
54
  /**
41
- * RGB HEX
55
+ * Converts RGB values to HEX color string
56
+ * @param {number} r - Red component (0-255)
57
+ * @param {number} g - Green component (0-255)
58
+ * @param {number} b - Blue component (0-255)
59
+ * @returns {string} HEX color string (e.g., '#FF0000')
42
60
  */
43
61
  var rgbToHex = function rgbToHex(r, g, b) {
44
62
  return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
45
63
  };
46
64
 
47
65
  /**
48
- * RGB HSL
66
+ * Converts RGB values to HSL object
67
+ * @param {number} r - Red component (0-255)
68
+ * @param {number} g - Green component (0-255)
69
+ * @param {number} b - Blue component (0-255)
70
+ * @returns {{h: number, s: number, l: number}} HSL object (h: 0-360, s: 0-100, l: 0-100)
49
71
  */
50
72
  var rgbToHsl = function rgbToHsl(r, g, b) {
51
- r /= 255;
52
- g /= 255;
53
- b /= 255;
54
- var max = Math.max(r, g, b),
55
- min = Math.min(r, g, b);
73
+ var rr = r / 255;
74
+ var gg = g / 255;
75
+ var bb = b / 255;
76
+ var max = Math.max(rr, gg, bb),
77
+ min = Math.min(rr, gg, bb);
56
78
  var h,
57
79
  s,
58
80
  l = (max + min) / 2;
@@ -62,14 +84,14 @@ var rgbToHsl = function rgbToHsl(r, g, b) {
62
84
  var d = max - min;
63
85
  s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
64
86
  switch (max) {
65
- case r:
66
- h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
87
+ case rr:
88
+ h = ((gg - bb) / d + (gg < bb ? 6 : 0)) / 6;
67
89
  break;
68
- case g:
69
- h = ((b - r) / d + 2) / 6;
90
+ case gg:
91
+ h = ((bb - rr) / d + 2) / 6;
70
92
  break;
71
- case b:
72
- h = ((r - g) / d + 4) / 6;
93
+ case bb:
94
+ h = ((rr - gg) / d + 4) / 6;
73
95
  break;
74
96
  default:
75
97
  h = 0;
@@ -83,29 +105,34 @@ var rgbToHsl = function rgbToHsl(r, g, b) {
83
105
  };
84
106
 
85
107
  /**
86
- * HSL RGB
108
+ * Converts HSL values to RGB object
109
+ * @param {number} h - Hue (0-360)
110
+ * @param {number} s - Saturation (0-100)
111
+ * @param {number} l - Lightness (0-100)
112
+ * @returns {{r: number, g: number, b: number}} RGB object (r, g, b: 0-255)
87
113
  */
88
114
  var hslToRgb = function hslToRgb(h, s, l) {
89
- h /= 360;
90
- s /= 100;
91
- l /= 100;
115
+ var hh = h / 360;
116
+ var ss = s / 100;
117
+ var ll = l / 100;
92
118
  var r, g, b;
93
- if (s === 0) {
94
- r = g = b = l;
119
+ if (ss === 0) {
120
+ r = g = b = ll;
95
121
  } else {
96
122
  var hue2rgb = function hue2rgb(p, q, t) {
97
- if (t < 0) t += 1;
98
- if (t > 1) t -= 1;
99
- if (t < 1 / 6) return p + (q - p) * 6 * t;
100
- if (t < 1 / 2) return q;
101
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
123
+ var tt = t;
124
+ if (tt < 0) tt += 1;
125
+ if (tt > 1) tt -= 1;
126
+ if (tt < 1 / 6) return p + (q - p) * 6 * tt;
127
+ if (tt < 1 / 2) return q;
128
+ if (tt < 2 / 3) return p + (q - p) * (2 / 3 - tt) * 6;
102
129
  return p;
103
130
  };
104
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
105
- var p = 2 * l - q;
106
- r = hue2rgb(p, q, h + 1 / 3);
107
- g = hue2rgb(p, q, h);
108
- b = hue2rgb(p, q, h - 1 / 3);
131
+ var q = ll < 0.5 ? ll * (1 + ss) : ll + ss - ll * ss;
132
+ var p = 2 * ll - q;
133
+ r = hue2rgb(p, q, hh + 1 / 3);
134
+ g = hue2rgb(p, q, hh);
135
+ b = hue2rgb(p, q, hh - 1 / 3);
109
136
  }
110
137
  return {
111
138
  r: Math.round(r * 255),
@@ -114,10 +141,14 @@ var hslToRgb = function hslToRgb(h, s, l) {
114
141
  };
115
142
  };
116
143
 
117
- // ==================== 颜色调整函数 ====================
144
+ // ==================== Color Adjustment Functions ====================
118
145
 
119
146
  /**
120
- * 调整颜色的亮度和饱和度(相对调整)
147
+ * Adjusts color brightness and saturation relatively
148
+ * @param {string} hex - Original HEX color value
149
+ * @param {number} lightness - Lightness adjustment value (positive for lighter, negative for darker)
150
+ * @param {number} [saturation=0] - Saturation adjustment value (positive to increase, negative to decrease)
151
+ * @returns {string} Adjusted HEX color value
121
152
  */
122
153
  var adjustColor = function adjustColor(hex, lightness) {
123
154
  var saturation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
@@ -131,7 +162,11 @@ var adjustColor = function adjustColor(hex, lightness) {
131
162
  };
132
163
 
133
164
  /**
134
- * 生成指定亮度的颜色(绝对值)
165
+ * Generates a color with specified lightness (absolute value)
166
+ * @param {string} hex - Base HEX color value
167
+ * @param {number} targetLightness - Target lightness value (0-100)
168
+ * @param {number | null} [targetSaturation=null] - Target saturation value (0-100), keeps original saturation if null
169
+ * @returns {string} Generated HEX color value
135
170
  */
136
171
  var generateColorWithLightness = function generateColorWithLightness(hex, targetLightness) {
137
172
  var targetSaturation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
@@ -147,7 +182,11 @@ var generateColorWithLightness = function generateColorWithLightness(hex, target
147
182
  };
148
183
 
149
184
  /**
150
- * 基于基础色生成色阶(保持色相,调整亮度和饱和度)
185
+ * Generates color scale based on base color (maintains hue, adjusts lightness and saturation)
186
+ * @param {string} baseHex - Base HEX color value
187
+ * @param {number} lightness - Target lightness value (0-100)
188
+ * @param {number} [saturationMultiplier=1] - Saturation multiplier (1 to keep original saturation)
189
+ * @returns {string} Generated HEX color value
151
190
  */
152
191
  var generateColorScale = function generateColorScale(baseHex, lightness) {
153
192
  var saturationMultiplier = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
@@ -160,30 +199,34 @@ var generateColorScale = function generateColorScale(baseHex, lightness) {
160
199
  return rgbToHex(newRgb.r, newRgb.g, newRgb.b);
161
200
  };
162
201
 
163
- // ==================== 主题生成函数 ====================
202
+ // ==================== Theme Generation Function ====================
164
203
 
165
204
  /**
166
- * 生成完整主题
167
- * @param {string} primaryHex - 主色调
168
- * @param {string} bgBaseHex - 背景基础色
169
- * @param {string} textBaseHex - 文本基础色
170
- * @param {boolean} darkMode - 是否为暗色模式
171
- * @returns {Object} 完整的主题配置对象
205
+ * Generates complete theme configuration
206
+ *
207
+ * Generates a complete theme configuration object based on input primary color, background color,
208
+ * text color, and mode (light/dark). The theme configuration includes: primary colors, text colors,
209
+ * background colors, border colors, fill colors, status colors, decorative colors, shadows, etc.
210
+ *
211
+ * @param {Object} props - Theme generation parameters
212
+ * @param {string} props.primaryHex - Primary color HEX value (required)
213
+ * @param {string} [props.bgBaseHex] - Background base color HEX value, uses default if not provided (light: #ffffff, dark: #000000)
214
+ * @param {string} [props.textBaseHex] - Text base color HEX value, uses default if not provided (light: #1a1a1a, dark: #E7E7ED)
215
+ * @param {boolean} [props.darkMode=false] - Whether it is dark mode
216
+ * @returns {Object | null} Complete theme configuration object, returns null if parameters are invalid
172
217
  */
173
218
 
174
- var generateTheme = function generateTheme(_ref) {
175
- var primaryHex = _ref.primaryHex,
176
- bgBaseHex = _ref.bgBaseHex,
177
- textBaseHex = _ref.textBaseHex,
178
- _ref$darkMode = _ref.darkMode,
179
- darkMode = _ref$darkMode === void 0 ? false : _ref$darkMode;
180
- bgBaseHex = bgBaseHex || (darkMode ? '#000000' : '#ffffff');
181
- textBaseHex = textBaseHex || (darkMode ? '#E7E7ED' : '#1a1a1a');
219
+ var generateTheme = function generateTheme(config) {
220
+ var primaryHex = config.primaryHex,
221
+ _config$darkMode = config.darkMode,
222
+ darkMode = _config$darkMode === void 0 ? false : _config$darkMode;
223
+ var bgBaseHex = config.bgBaseHex || (darkMode ? '#000000' : '#ffffff');
224
+ var textBaseHex = config.textBaseHex || (darkMode ? '#E7E7ED' : '#1a1a1a');
182
225
  var rgb = hexToRgb(primaryHex);
183
226
  if (!rgb) return null;
184
227
  var hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
185
228
 
186
- // 获取背景色和文本色的 RGB HSL
229
+ // Get RGB and HSL values for background and text colors
187
230
  var bgBaseRgb = hexToRgb(bgBaseHex);
188
231
  var textBaseRgb = hexToRgb(textBaseHex);
189
232
  var bgBaseHsl = bgBaseRgb ? rgbToHsl(bgBaseRgb.r, bgBaseRgb.g, bgBaseRgb.b) : {
@@ -192,22 +235,30 @@ var generateTheme = function generateTheme(_ref) {
192
235
  l: darkMode ? 5 : 99
193
236
  };
194
237
 
195
- // 参考 Radix Colors 的色阶系统
196
- // 浅色模式:
197
- // Scale 1-3: 背景色 (95-99% 亮度)
198
- // Scale 6-8: 边框色、填充色 (80-90% 亮度)
199
- // Scale 11-12: 文本色 (15-25% 亮度)
200
- // 暗色模式:
201
- // Scale 1-3: 背景色 (0-10% 亮度)
202
- // Scale 6-8: 边框色、填充色 (带透明度)
203
- // Scale 11-12: 文本色 (85-95% 亮度)
238
+ // Light mode:
239
+ // Scale 1-3: Background colors (95-99% lightness)
240
+ // Scale 6-8: Border colors, fill colors (80-90% lightness)
241
+ // Scale 11-12: Text colors (15-25% lightness)
242
+ // Dark mode:
243
+ // Scale 1-3: Background colors (0-10% lightness)
244
+ // Scale 6-8: Border colors, fill colors (with transparency)
245
+ // Scale 11-12: Text colors (85-95% lightness)
204
246
 
205
- var baseSaturation = Math.max(8, Math.min(hsl.s, 40)); // 主色背景(如 primaryBg)使用低饱和度
206
- var borderSaturation = Math.max(12, Math.min(hsl.s * 0.6, 35)); // 主色边框(如 primaryBorder)使用的饱和度
247
+ // Calculate saturation values related to primary color
248
+ // Primary color background uses low saturation to ensure background is not too vibrant
249
+ var baseSaturation = Math.max(8, Math.min(hsl.s, 40));
250
+ // Primary color border uses medium saturation to enhance visibility
251
+ var borderSaturation = Math.max(12, Math.min(hsl.s * 0.6, 35));
207
252
 
208
- // 生成主色相关的颜色
253
+ // Calculate actual generated primary color (considering dark mode adjustment)
254
+ var actualPrimaryHex = darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex;
255
+ // Get actual primary color lightness to determine text on primary color
256
+ var actualPrimaryRgb = hexToRgb(actualPrimaryHex);
257
+ var actualPrimaryHsl = actualPrimaryRgb ? rgbToHsl(actualPrimaryRgb.r, actualPrimaryRgb.g, actualPrimaryRgb.b) : hsl;
258
+
259
+ // Generate complete theme configuration object
209
260
  var theme = {
210
- // 保留边框圆角配置
261
+ // ========== Border Radius Configuration ==========
211
262
  borderRadiusXS: themeData.borderRadiusXS,
212
263
  borderRadiusSM: themeData.borderRadiusSM,
213
264
  borderRadius: themeData.borderRadius,
@@ -215,54 +266,64 @@ var generateTheme = function generateTheme(_ref) {
215
266
  borderRadiusXL: themeData.borderRadiusXL,
216
267
  borderRadiusFull: themeData.borderRadiusFull,
217
268
  wireframe: themeData.wireframe,
218
- // 主色系 - 暗色模式下生成适配的主色
269
+ // ========== Primary Color System ==========
270
+ // Automatically adjusts primary color brightness in dark mode to ensure readability
219
271
  colorPrimary: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
220
272
  colorPrimaryHover: darkMode ? generateColorWithLightness(primaryHex, Math.min(hsl.l + 10, 55), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? 10 : -10, 0),
221
273
  colorPrimaryActive: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 10, 35), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? -10 : -20, 0),
222
- colorPrimaryBg: darkMode ? generateColorWithLightness(primaryHex, 13, baseSaturation * 0.6) // 暗色模式:深色背景
274
+ colorPrimaryBg: darkMode ? generateColorWithLightness(primaryHex, 13, baseSaturation * 0.6) // Dark mode: dark background (13% lightness)
223
275
  : generateColorWithLightness(primaryHex, 96, baseSaturation * 0.8),
224
- // 浅色模式:浅色背景
276
+ // Light mode: light background (96% lightness)
225
277
  colorPrimaryBgHover: darkMode ? generateColorWithLightness(primaryHex, 13, baseSaturation * 0.6) : generateColorWithLightness(primaryHex, 94, baseSaturation),
226
278
  colorPrimaryBorder: darkMode ? generateColorWithLightness(primaryHex, 17, borderSaturation * 0.8) : generateColorWithLightness(primaryHex, 88, borderSaturation * 0.8),
227
279
  colorPrimaryBorderHover: darkMode ? generateColorWithLightness(primaryHex, 22, borderSaturation) : generateColorWithLightness(primaryHex, 82, borderSaturation),
228
280
  colorPrimaryText: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
229
281
  colorPrimaryTextHover: darkMode ? generateColorWithLightness(primaryHex, Math.min(hsl.l + 10, 55), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? 10 : -10, 0),
230
282
  colorPrimaryTextActive: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 10, 35), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? -10 : -20, 0),
231
- // 文本颜色 - 基于 textBase 的色相生成(Scale 11-12)
283
+ // Text color displayed on primary color background: automatically selects black or white based on actual primary color lightness
284
+ // Light theme colors (lightness > 50) use black text, dark theme colors (lightness <= 50) use white text
285
+ colorTextOnPrimary: actualPrimaryHsl.l > 50 ? '#000000' : '#ffffff',
286
+ // ========== Text Color System ==========
287
+ // Generated based on textBase hue, uses transparency to achieve different levels
232
288
  colorTextBase: textBaseHex,
233
289
  colorText: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.88)"),
234
290
  colorTextSecondary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.65)"),
235
291
  colorTextTertiary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.45)"),
236
292
  colorTextQuaternary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.25)"),
237
293
  colorTextWhite: '#fff',
238
- // 背景颜色 - 基于 bgBase 的色相生成 (Scale 1-3)
294
+ // ========== Background Color System ==========
295
+ // Generated based on bgBase hue, maintains consistent hue
239
296
  colorBgBase: bgBaseHex,
240
- colorBgContainer: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + 3, 8), 1.2) // 暗色:稍微亮一点 (5-8%)
241
- : generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + 1, 99), 0.8),
242
- // 浅色:稍微深一点
243
- colorBgElevated: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + 3, 8), 1.2) // 暗色:与 container 相同
297
+ colorBgContainer: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + hsl.l * 0.08, 12), 1.2) // Dark mode: dynamically adjusts based on primary color lightness (brighter primary = brighter container, max 12% lightness)
298
+ : generateColorScale(bgBaseHex, Math.max(100 - hsl.l * 0.05, 96), 0.8),
299
+ // Light mode: darker primary = grayer container; lighter primary = closer to white (min 96% lightness)
300
+ colorBgElevated: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + 3, 8), 1.2) // Dark mode: slightly brighter than container (max 8% lightness)
244
301
  : bgBaseHex,
245
- // 浅色:使用 bgBase 本身
246
- colorBgLayout: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + 3, 8), 1.2) // 暗色:与 container 相同
247
- : generateColorScale(bgBaseHex, Math.max(bgBaseHsl.l - 2, 96), 1.2),
248
- // 浅色:稍微深一点
302
+ // Light mode: uses bgBase itself (usually white)
303
+ colorBgLayout: bgBaseHex,
304
+ // Keeps consistent with bgBase
249
305
  colorBgSpotlight: darkMode ? "rgba(".concat(hexToRgb(generateColorScale(bgBaseHex, 28, 1.2)).r, ", ").concat(hexToRgb(generateColorScale(bgBaseHex, 28, 1.2)).g, ", ").concat(hexToRgb(generateColorScale(bgBaseHex, 28, 1.2)).b, ", 0.85)") : "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.85)"),
250
306
  colorBgMask: darkMode ? "rgba(".concat(bgBaseRgb.r, ", ").concat(bgBaseRgb.g, ", ").concat(bgBaseRgb.b, ", 0.8)") : "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.45)"),
251
- // 边框和填充 - 暗色模式使用透明度,浅色模式使用实色
252
- colorBorder: darkMode ? "rgba(".concat(hexToRgb(generateColorScale(bgBaseHex, 28, 2)).r, ", ").concat(hexToRgb(generateColorScale(bgBaseHex, 28, 2)).g, ", ").concat(hexToRgb(generateColorScale(bgBaseHex, 28, 2)).b, ", 0.8)") // 暗色:中等亮度 + 透明度
307
+ // ========== Border and Fill Color System ==========
308
+ // Dark mode uses transparency to enhance layering, light mode uses solid colors
309
+ colorBorder: darkMode ? "rgba(".concat(hexToRgb(generateColorScale(bgBaseHex, 28, 2)).r, ", ").concat(hexToRgb(generateColorScale(bgBaseHex, 28, 2)).g, ", ").concat(hexToRgb(generateColorScale(bgBaseHex, 28, 2)).b, ", 0.8)") // Dark mode: medium lightness (28%) + 80% opacity
253
310
  : generateColorScale(bgBaseHex, 81, 2.5),
254
- // 浅色:实色边框
311
+ // Light mode: solid border (81% lightness)
255
312
  colorBorderSecondary: darkMode ? "rgba(".concat(hexToRgb(generateColorScale(bgBaseHex, 22, 1.8)).r, ", ").concat(hexToRgb(generateColorScale(bgBaseHex, 22, 1.8)).g, ", ").concat(hexToRgb(generateColorScale(bgBaseHex, 22, 1.8)).b, ", 0.8)") : generateColorScale(bgBaseHex, 88, 2),
256
- colorFill: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.18)") // 暗色:基于文本色的透明填充
313
+ colorFill: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.18)") // Dark mode: transparent fill based on text color
257
314
  : generateColorScale(bgBaseHex, 81, 2.5) + '5c',
258
315
  colorFillSecondary: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.12)") : generateColorScale(bgBaseHex, 81, 2.5) + '33',
259
316
  colorFillTertiary: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.08)") : generateColorScale(bgBaseHex, 81, 2.5) + '26',
260
317
  colorFillQuaternary: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.04)") : generateColorScale(bgBaseHex, 81, 2.5) + '1a',
261
- colorFillDisable: darkMode ? generateColorScale(textBaseHex, 55, 0.8) // 暗色:中等亮度的灰色
318
+ colorFillDisable: darkMode ? generateColorScale(textBaseHex, 55, 0.8) // Dark mode: medium lightness gray (55% lightness)
262
319
  : generateColorScale(bgBaseHex, 86, 1.8),
263
- // 链接色 - 暗色模式下生成适配的颜色
320
+ // Light mode: light gray (86% lightness)
321
+
322
+ // ========== Link Color ==========
323
+ // Automatically adjusts brightness in dark mode to ensure readability
264
324
  colorLink: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
265
- // 状态色 - 暗色模式下使用预设值
325
+ // ========== Status Colors ==========
326
+ // Dark mode uses preset optimized values, light mode uses values from configuration file
266
327
  colorInfo: darkMode ? themeDataDark.colorInfo : themeData.colorInfo,
267
328
  colorInfoHover: darkMode ? themeDataDark.colorInfoHover : themeData.colorInfoHover,
268
329
  colorInfoText: darkMode ? themeDataDark.colorInfoText : themeData.colorInfoText,
@@ -288,7 +349,8 @@ var generateTheme = function generateTheme(_ref) {
288
349
  colorErrorBgHover: darkMode ? themeDataDark.colorErrorBgHover : themeData.colorErrorBgHover,
289
350
  colorErrorBorder: darkMode ? themeDataDark.colorErrorBorder : themeData.colorErrorBorder,
290
351
  colorErrorBorderHover: darkMode ? themeDataDark.colorErrorBorderHover : themeData.colorErrorBorderHover,
291
- // 装饰色 - 暗色模式下使用预设值
352
+ // ========== Decorative Colors ==========
353
+ // Dark mode uses preset optimized values, light mode uses values from configuration file
292
354
  colorPurple: darkMode ? themeDataDark.colorPurple : themeData.colorPurple,
293
355
  colorPurpleHover: darkMode ? themeDataDark.colorPurpleHover : themeData.colorPurpleHover,
294
356
  colorPurpleBg: darkMode ? themeDataDark.colorPurpleBg : themeData.colorPurpleBg,
@@ -316,7 +378,8 @@ var generateTheme = function generateTheme(_ref) {
316
378
  colorLavender: darkMode ? themeDataDark.colorLavender : themeData.colorLavender || '#A77BFF',
317
379
  colorLavenderHover: darkMode ? themeDataDark.colorLavenderHover : themeData.colorLavenderHover || '#BB99FF',
318
380
  colorLavenderBg: darkMode ? themeDataDark.colorLavenderBg : themeData.colorLavenderBg || 'rgba(226, 212, 255, 0.8)',
319
- // 阴影 - 暗色模式使用预设值
381
+ // ========== Shadows ==========
382
+ // Dark mode uses preset optimized values, light mode uses values from configuration file
320
383
  boxShadow: darkMode ? themeDataDark.boxShadow : themeData.boxShadow,
321
384
  boxShadowSecondary: darkMode ? themeDataDark.boxShadowSecondary : themeData.boxShadowSecondary,
322
385
  boxShadowTertiary: darkMode ? themeDataDark.boxShadowTertiary : themeData.boxShadowTertiary,