@agentscope-ai/design 1.0.21 → 1.0.23-beta.1767087061250
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.
- package/lib/antd/themes/generateTheme.d.ts +46 -23
- package/lib/antd/themes/generateTheme.js +132 -68
- package/llms/all.llms.txt +1562 -689
- package/llms/index.llms.txt +20 -14
- package/package.json +1 -1
- package/llms/docs/changelog/index.zh-CN.llms.txt +0 -18
|
@@ -1,36 +1,58 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Theme Generator
|
|
3
3
|
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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
|
-
*
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
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
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
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
58
|
declare const generateTheme: ({ primaryHex, bgBaseHex, textBaseHex, darkMode, }: GenerateThemeProps) => {
|
|
@@ -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:
|
|
86
|
+
colorBgLayout: string;
|
|
64
87
|
colorBgSpotlight: string;
|
|
65
88
|
colorBgMask: string;
|
|
66
89
|
colorBorder: any;
|
|
@@ -1,33 +1,47 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Theme Generator
|
|
4
4
|
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 2. 颜色调整和生成
|
|
8
|
-
* 3. 完整主题配置生成(支持浅色/暗色模式)
|
|
5
|
+
* Generates a complete theme configuration based on input primary color, background color, and text color.
|
|
6
|
+
* Supports both light and dark modes.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* ## Core Features
|
|
9
|
+
* 1. **Color Space Conversion**: HEX ↔ RGB ↔ HSL conversions
|
|
10
|
+
* 2. **Color Adjustment and Generation**: Adjust brightness and saturation based on HSL color space
|
|
11
|
+
* 3. **Complete Theme Configuration**: Generates a complete theme configuration object including
|
|
12
|
+
* primary colors, text colors, background colors, border colors, fill colors, status colors,
|
|
13
|
+
* decorative colors, shadows, etc.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
* -
|
|
20
|
-
*
|
|
21
|
-
*
|
|
15
|
+
* ## Design Principles
|
|
16
|
+
* ### Light Mode
|
|
17
|
+
* - Background: 95-99% lightness
|
|
18
|
+
* - Border: 80-90% lightness
|
|
19
|
+
* - Text: 15-25% lightness
|
|
20
|
+
*
|
|
21
|
+
* ### Dark Mode
|
|
22
|
+
* - Background: 0-10% lightness
|
|
23
|
+
* - Border: Uses transparency to enhance layering
|
|
24
|
+
* - Text: 85-95% lightness
|
|
25
|
+
* - Status colors and decorative colors: Use preset optimized values
|
|
26
|
+
*
|
|
27
|
+
* ## Generation Rules
|
|
28
|
+
* - **Primary Color**: Generated from input primary color, automatically adjusts brightness in dark mode for readability
|
|
29
|
+
* - **Background Color System**: Generated based on bgBase, maintains consistent hue
|
|
30
|
+
* - **Text Color System**: Generated based on textBase, uses transparency to achieve different levels
|
|
31
|
+
* - **Border Color System**: Generated based on bgBase, increases saturation to enhance visibility
|
|
32
|
+
* - **Fill Color System**: Dark mode uses text color + transparency, light mode uses background color
|
|
33
|
+
* - **Status Colors/Decorative Colors/Shadows**: Dark mode uses preset optimized values, light mode uses configuration file
|
|
22
34
|
*/
|
|
23
35
|
|
|
24
36
|
import themeDataDark from "./bailianDarkTheme.json";
|
|
25
37
|
import themeData from "./bailianTheme.json";
|
|
26
38
|
|
|
27
|
-
// ====================
|
|
39
|
+
// ==================== Color Conversion Utility Functions ====================
|
|
28
40
|
|
|
29
41
|
/**
|
|
30
|
-
* HEX
|
|
42
|
+
* Converts HEX color value to RGB object
|
|
43
|
+
* @param {string} hex - HEX color value (e.g., '#FF0000' or 'FF0000')
|
|
44
|
+
* @returns {{r: number, g: number, b: number} | null} RGB object, returns null if conversion fails
|
|
31
45
|
*/
|
|
32
46
|
var hexToRgb = function hexToRgb(hex) {
|
|
33
47
|
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
@@ -39,14 +53,22 @@ var hexToRgb = function hexToRgb(hex) {
|
|
|
39
53
|
};
|
|
40
54
|
|
|
41
55
|
/**
|
|
42
|
-
* RGB
|
|
56
|
+
* Converts RGB values to HEX color string
|
|
57
|
+
* @param {number} r - Red component (0-255)
|
|
58
|
+
* @param {number} g - Green component (0-255)
|
|
59
|
+
* @param {number} b - Blue component (0-255)
|
|
60
|
+
* @returns {string} HEX color string (e.g., '#FF0000')
|
|
43
61
|
*/
|
|
44
62
|
var rgbToHex = function rgbToHex(r, g, b) {
|
|
45
63
|
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
|
|
46
64
|
};
|
|
47
65
|
|
|
48
66
|
/**
|
|
49
|
-
* RGB
|
|
67
|
+
* Converts RGB values to HSL object
|
|
68
|
+
* @param {number} r - Red component (0-255)
|
|
69
|
+
* @param {number} g - Green component (0-255)
|
|
70
|
+
* @param {number} b - Blue component (0-255)
|
|
71
|
+
* @returns {{h: number, s: number, l: number}} HSL object (h: 0-360, s: 0-100, l: 0-100)
|
|
50
72
|
*/
|
|
51
73
|
var rgbToHsl = function rgbToHsl(r, g, b) {
|
|
52
74
|
var rr = r / 255;
|
|
@@ -84,7 +106,11 @@ var rgbToHsl = function rgbToHsl(r, g, b) {
|
|
|
84
106
|
};
|
|
85
107
|
|
|
86
108
|
/**
|
|
87
|
-
* HSL
|
|
109
|
+
* Converts HSL values to RGB object
|
|
110
|
+
* @param {number} h - Hue (0-360)
|
|
111
|
+
* @param {number} s - Saturation (0-100)
|
|
112
|
+
* @param {number} l - Lightness (0-100)
|
|
113
|
+
* @returns {{r: number, g: number, b: number}} RGB object (r, g, b: 0-255)
|
|
88
114
|
*/
|
|
89
115
|
var hslToRgb = function hslToRgb(h, s, l) {
|
|
90
116
|
var hh = h / 360;
|
|
@@ -116,10 +142,14 @@ var hslToRgb = function hslToRgb(h, s, l) {
|
|
|
116
142
|
};
|
|
117
143
|
};
|
|
118
144
|
|
|
119
|
-
// ====================
|
|
145
|
+
// ==================== Color Adjustment Functions ====================
|
|
120
146
|
|
|
121
147
|
/**
|
|
122
|
-
*
|
|
148
|
+
* Adjusts color brightness and saturation relatively
|
|
149
|
+
* @param {string} hex - Original HEX color value
|
|
150
|
+
* @param {number} lightness - Lightness adjustment value (positive for lighter, negative for darker)
|
|
151
|
+
* @param {number} [saturation=0] - Saturation adjustment value (positive to increase, negative to decrease)
|
|
152
|
+
* @returns {string} Adjusted HEX color value
|
|
123
153
|
*/
|
|
124
154
|
var adjustColor = function adjustColor(hex, lightness) {
|
|
125
155
|
var saturation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
@@ -133,7 +163,11 @@ var adjustColor = function adjustColor(hex, lightness) {
|
|
|
133
163
|
};
|
|
134
164
|
|
|
135
165
|
/**
|
|
136
|
-
*
|
|
166
|
+
* Generates a color with specified lightness (absolute value)
|
|
167
|
+
* @param {string} hex - Base HEX color value
|
|
168
|
+
* @param {number} targetLightness - Target lightness value (0-100)
|
|
169
|
+
* @param {number | null} [targetSaturation=null] - Target saturation value (0-100), keeps original saturation if null
|
|
170
|
+
* @returns {string} Generated HEX color value
|
|
137
171
|
*/
|
|
138
172
|
var generateColorWithLightness = function generateColorWithLightness(hex, targetLightness) {
|
|
139
173
|
var targetSaturation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -149,7 +183,11 @@ var generateColorWithLightness = function generateColorWithLightness(hex, target
|
|
|
149
183
|
};
|
|
150
184
|
|
|
151
185
|
/**
|
|
152
|
-
*
|
|
186
|
+
* Generates color scale based on base color (maintains hue, adjusts lightness and saturation)
|
|
187
|
+
* @param {string} baseHex - Base HEX color value
|
|
188
|
+
* @param {number} lightness - Target lightness value (0-100)
|
|
189
|
+
* @param {number} [saturationMultiplier=1] - Saturation multiplier (1 to keep original saturation)
|
|
190
|
+
* @returns {string} Generated HEX color value
|
|
153
191
|
*/
|
|
154
192
|
var generateColorScale = function generateColorScale(baseHex, lightness) {
|
|
155
193
|
var saturationMultiplier = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
@@ -162,15 +200,21 @@ var generateColorScale = function generateColorScale(baseHex, lightness) {
|
|
|
162
200
|
return rgbToHex(newRgb.r, newRgb.g, newRgb.b);
|
|
163
201
|
};
|
|
164
202
|
|
|
165
|
-
// ====================
|
|
203
|
+
// ==================== Theme Generation Function ====================
|
|
166
204
|
|
|
167
205
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
206
|
+
* Generates complete theme configuration
|
|
207
|
+
*
|
|
208
|
+
* Generates a complete theme configuration object based on input primary color, background color,
|
|
209
|
+
* text color, and mode (light/dark). The theme configuration includes: primary colors, text colors,
|
|
210
|
+
* background colors, border colors, fill colors, status colors, decorative colors, shadows, etc.
|
|
211
|
+
*
|
|
212
|
+
* @param {Object} props - Theme generation parameters
|
|
213
|
+
* @param {string} props.primaryHex - Primary color HEX value (required)
|
|
214
|
+
* @param {string} [props.bgBaseHex] - Background base color HEX value, uses default if not provided (light: #ffffff, dark: #000000)
|
|
215
|
+
* @param {string} [props.textBaseHex] - Text base color HEX value, uses default if not provided (light: #1a1a1a, dark: #E7E7ED)
|
|
216
|
+
* @param {boolean} [props.darkMode=false] - Whether it is dark mode
|
|
217
|
+
* @returns {Object | null} Complete theme configuration object, returns null if parameters are invalid
|
|
174
218
|
*/
|
|
175
219
|
|
|
176
220
|
var generateTheme = function generateTheme(_ref) {
|
|
@@ -185,7 +229,7 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
185
229
|
if (!rgb) return null;
|
|
186
230
|
var hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
|
|
187
231
|
|
|
188
|
-
//
|
|
232
|
+
// Get RGB and HSL values for background and text colors
|
|
189
233
|
var bgBaseRgb = hexToRgb(resolvedBgBaseHex);
|
|
190
234
|
var textBaseRgb = hexToRgb(resolvedTextBaseHex);
|
|
191
235
|
var bgBaseHsl = bgBaseRgb ? rgbToHsl(bgBaseRgb.r, bgBaseRgb.g, bgBaseRgb.b) : {
|
|
@@ -194,22 +238,30 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
194
238
|
l: darkMode ? 5 : 99
|
|
195
239
|
};
|
|
196
240
|
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
// Scale
|
|
200
|
-
// Scale
|
|
201
|
-
//
|
|
202
|
-
//
|
|
203
|
-
// Scale
|
|
204
|
-
// Scale
|
|
205
|
-
// Scale 11-12: 文本色 (85-95% 亮度)
|
|
241
|
+
// Light mode:
|
|
242
|
+
// Scale 1-3: Background colors (95-99% lightness)
|
|
243
|
+
// Scale 6-8: Border colors, fill colors (80-90% lightness)
|
|
244
|
+
// Scale 11-12: Text colors (15-25% lightness)
|
|
245
|
+
// Dark mode:
|
|
246
|
+
// Scale 1-3: Background colors (0-10% lightness)
|
|
247
|
+
// Scale 6-8: Border colors, fill colors (with transparency)
|
|
248
|
+
// Scale 11-12: Text colors (85-95% lightness)
|
|
206
249
|
|
|
207
|
-
|
|
208
|
-
|
|
250
|
+
// Calculate saturation values related to primary color
|
|
251
|
+
// Primary color background uses low saturation to ensure background is not too vibrant
|
|
252
|
+
var baseSaturation = Math.max(8, Math.min(hsl.s, 40));
|
|
253
|
+
// Primary color border uses medium saturation to enhance visibility
|
|
254
|
+
var borderSaturation = Math.max(12, Math.min(hsl.s * 0.6, 35));
|
|
209
255
|
|
|
210
|
-
//
|
|
256
|
+
// Calculate actual generated primary color (considering dark mode adjustment)
|
|
257
|
+
var actualPrimaryHex = darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex;
|
|
258
|
+
// Get actual primary color lightness to determine text on primary color
|
|
259
|
+
var actualPrimaryRgb = hexToRgb(actualPrimaryHex);
|
|
260
|
+
var actualPrimaryHsl = actualPrimaryRgb ? rgbToHsl(actualPrimaryRgb.r, actualPrimaryRgb.g, actualPrimaryRgb.b) : hsl;
|
|
261
|
+
|
|
262
|
+
// Generate complete theme configuration object
|
|
211
263
|
var theme = {
|
|
212
|
-
//
|
|
264
|
+
// ========== Border Radius Configuration ==========
|
|
213
265
|
borderRadiusXS: themeData.borderRadiusXS,
|
|
214
266
|
borderRadiusSM: themeData.borderRadiusSM,
|
|
215
267
|
borderRadius: themeData.borderRadius,
|
|
@@ -217,54 +269,64 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
217
269
|
borderRadiusXL: themeData.borderRadiusXL,
|
|
218
270
|
borderRadiusFull: themeData.borderRadiusFull,
|
|
219
271
|
wireframe: themeData.wireframe,
|
|
220
|
-
//
|
|
272
|
+
// ========== Primary Color System ==========
|
|
273
|
+
// Automatically adjusts primary color brightness in dark mode to ensure readability
|
|
221
274
|
colorPrimary: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
|
|
222
275
|
colorPrimaryHover: darkMode ? generateColorWithLightness(primaryHex, Math.min(hsl.l + 10, 55), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? 10 : -10, 0),
|
|
223
276
|
colorPrimaryActive: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 10, 35), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? -10 : -20, 0),
|
|
224
|
-
colorPrimaryBg: darkMode ? generateColorWithLightness(primaryHex, 13, baseSaturation * 0.6) //
|
|
277
|
+
colorPrimaryBg: darkMode ? generateColorWithLightness(primaryHex, 13, baseSaturation * 0.6) // Dark mode: dark background (13% lightness)
|
|
225
278
|
: generateColorWithLightness(primaryHex, 96, baseSaturation * 0.8),
|
|
226
|
-
//
|
|
279
|
+
// Light mode: light background (96% lightness)
|
|
227
280
|
colorPrimaryBgHover: darkMode ? generateColorWithLightness(primaryHex, 13, baseSaturation * 0.6) : generateColorWithLightness(primaryHex, 94, baseSaturation),
|
|
228
281
|
colorPrimaryBorder: darkMode ? generateColorWithLightness(primaryHex, 17, borderSaturation * 0.8) : generateColorWithLightness(primaryHex, 88, borderSaturation * 0.8),
|
|
229
282
|
colorPrimaryBorderHover: darkMode ? generateColorWithLightness(primaryHex, 22, borderSaturation) : generateColorWithLightness(primaryHex, 82, borderSaturation),
|
|
230
283
|
colorPrimaryText: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
|
|
231
284
|
colorPrimaryTextHover: darkMode ? generateColorWithLightness(primaryHex, Math.min(hsl.l + 10, 55), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? 10 : -10, 0),
|
|
232
285
|
colorPrimaryTextActive: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 10, 35), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? -10 : -20, 0),
|
|
233
|
-
//
|
|
286
|
+
// Text color displayed on primary color background: automatically selects black or white based on actual primary color lightness
|
|
287
|
+
// Light theme colors (lightness > 50) use black text, dark theme colors (lightness <= 50) use white text
|
|
288
|
+
colorTextOnPrimary: actualPrimaryHsl.l > 50 ? '#000000' : '#ffffff',
|
|
289
|
+
// ========== Text Color System ==========
|
|
290
|
+
// Generated based on textBase hue, uses transparency to achieve different levels
|
|
234
291
|
colorTextBase: textBaseHex,
|
|
235
292
|
colorText: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.88)"),
|
|
236
293
|
colorTextSecondary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.65)"),
|
|
237
294
|
colorTextTertiary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.45)"),
|
|
238
295
|
colorTextQuaternary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.25)"),
|
|
239
296
|
colorTextWhite: '#fff',
|
|
240
|
-
//
|
|
297
|
+
// ========== Background Color System ==========
|
|
298
|
+
// Generated based on bgBase hue, maintains consistent hue
|
|
241
299
|
colorBgBase: bgBaseHex,
|
|
242
|
-
colorBgContainer: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l +
|
|
243
|
-
: generateColorScale(bgBaseHex, Math.
|
|
244
|
-
//
|
|
245
|
-
colorBgElevated: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + 3, 8), 1.2) //
|
|
300
|
+
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)
|
|
301
|
+
: generateColorScale(bgBaseHex, Math.max(100 - hsl.l * 0.05, 96), 0.8),
|
|
302
|
+
// Light mode: darker primary = grayer container; lighter primary = closer to white (min 96% lightness)
|
|
303
|
+
colorBgElevated: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + 3, 8), 1.2) // Dark mode: slightly brighter than container (max 8% lightness)
|
|
246
304
|
: bgBaseHex,
|
|
247
|
-
//
|
|
248
|
-
colorBgLayout:
|
|
249
|
-
|
|
250
|
-
// 浅色:稍微深一点
|
|
305
|
+
// Light mode: uses bgBase itself (usually white)
|
|
306
|
+
colorBgLayout: bgBaseHex,
|
|
307
|
+
// Keeps consistent with bgBase
|
|
251
308
|
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)"),
|
|
252
309
|
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)"),
|
|
253
|
-
//
|
|
254
|
-
|
|
310
|
+
// ========== Border and Fill Color System ==========
|
|
311
|
+
// Dark mode uses transparency to enhance layering, light mode uses solid colors
|
|
312
|
+
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
|
|
255
313
|
: generateColorScale(bgBaseHex, 81, 2.5),
|
|
256
|
-
//
|
|
314
|
+
// Light mode: solid border (81% lightness)
|
|
257
315
|
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),
|
|
258
|
-
colorFill: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.18)") //
|
|
316
|
+
colorFill: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.18)") // Dark mode: transparent fill based on text color
|
|
259
317
|
: generateColorScale(bgBaseHex, 81, 2.5) + '5c',
|
|
260
318
|
colorFillSecondary: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.12)") : generateColorScale(bgBaseHex, 81, 2.5) + '33',
|
|
261
319
|
colorFillTertiary: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.08)") : generateColorScale(bgBaseHex, 81, 2.5) + '26',
|
|
262
320
|
colorFillQuaternary: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.04)") : generateColorScale(bgBaseHex, 81, 2.5) + '1a',
|
|
263
|
-
colorFillDisable: darkMode ? generateColorScale(textBaseHex, 55, 0.8) //
|
|
321
|
+
colorFillDisable: darkMode ? generateColorScale(textBaseHex, 55, 0.8) // Dark mode: medium lightness gray (55% lightness)
|
|
264
322
|
: generateColorScale(bgBaseHex, 86, 1.8),
|
|
265
|
-
//
|
|
323
|
+
// Light mode: light gray (86% lightness)
|
|
324
|
+
|
|
325
|
+
// ========== Link Color ==========
|
|
326
|
+
// Automatically adjusts brightness in dark mode to ensure readability
|
|
266
327
|
colorLink: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
|
|
267
|
-
//
|
|
328
|
+
// ========== Status Colors ==========
|
|
329
|
+
// Dark mode uses preset optimized values, light mode uses values from configuration file
|
|
268
330
|
colorInfo: darkMode ? themeDataDark.colorInfo : themeData.colorInfo,
|
|
269
331
|
colorInfoHover: darkMode ? themeDataDark.colorInfoHover : themeData.colorInfoHover,
|
|
270
332
|
colorInfoText: darkMode ? themeDataDark.colorInfoText : themeData.colorInfoText,
|
|
@@ -290,7 +352,8 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
290
352
|
colorErrorBgHover: darkMode ? themeDataDark.colorErrorBgHover : themeData.colorErrorBgHover,
|
|
291
353
|
colorErrorBorder: darkMode ? themeDataDark.colorErrorBorder : themeData.colorErrorBorder,
|
|
292
354
|
colorErrorBorderHover: darkMode ? themeDataDark.colorErrorBorderHover : themeData.colorErrorBorderHover,
|
|
293
|
-
//
|
|
355
|
+
// ========== Decorative Colors ==========
|
|
356
|
+
// Dark mode uses preset optimized values, light mode uses values from configuration file
|
|
294
357
|
colorPurple: darkMode ? themeDataDark.colorPurple : themeData.colorPurple,
|
|
295
358
|
colorPurpleHover: darkMode ? themeDataDark.colorPurpleHover : themeData.colorPurpleHover,
|
|
296
359
|
colorPurpleBg: darkMode ? themeDataDark.colorPurpleBg : themeData.colorPurpleBg,
|
|
@@ -318,7 +381,8 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
318
381
|
colorLavender: darkMode ? themeDataDark.colorLavender : themeData.colorLavender || '#A77BFF',
|
|
319
382
|
colorLavenderHover: darkMode ? themeDataDark.colorLavenderHover : themeData.colorLavenderHover || '#BB99FF',
|
|
320
383
|
colorLavenderBg: darkMode ? themeDataDark.colorLavenderBg : themeData.colorLavenderBg || 'rgba(226, 212, 255, 0.8)',
|
|
321
|
-
//
|
|
384
|
+
// ========== Shadows ==========
|
|
385
|
+
// Dark mode uses preset optimized values, light mode uses values from configuration file
|
|
322
386
|
boxShadow: darkMode ? themeDataDark.boxShadow : themeData.boxShadow,
|
|
323
387
|
boxShadowSecondary: darkMode ? themeDataDark.boxShadowSecondary : themeData.boxShadowSecondary,
|
|
324
388
|
boxShadowTertiary: darkMode ? themeDataDark.boxShadowTertiary : themeData.boxShadowTertiary,
|