@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.
- package/lib/antd/themes/generateTheme.d.ts +47 -24
- package/lib/antd/themes/generateTheme.js +165 -102
- package/llms/all.llms.txt +551 -572
- package/llms/docs/guide/tokens&variables.zh-CN.llms.txt +3 -4
- package/llms/index.llms.txt +13 -14
- package/package.json +1 -1
- package/llms/docs/changelog/index.zh-CN.llms.txt +0 -18
|
@@ -1,39 +1,61 @@
|
|
|
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
|
-
declare const generateTheme: (
|
|
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:
|
|
86
|
+
colorBgLayout: string;
|
|
64
87
|
colorBgSpotlight: string;
|
|
65
88
|
colorBgMask: string;
|
|
66
89
|
colorBorder: any;
|
|
@@ -1,32 +1,46 @@
|
|
|
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
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
|
|
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
|
|
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
|
|
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
|
|
52
|
-
g
|
|
53
|
-
b
|
|
54
|
-
var max = Math.max(
|
|
55
|
-
min = Math.min(
|
|
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
|
|
66
|
-
h = ((
|
|
87
|
+
case rr:
|
|
88
|
+
h = ((gg - bb) / d + (gg < bb ? 6 : 0)) / 6;
|
|
67
89
|
break;
|
|
68
|
-
case
|
|
69
|
-
h = ((
|
|
90
|
+
case gg:
|
|
91
|
+
h = ((bb - rr) / d + 2) / 6;
|
|
70
92
|
break;
|
|
71
|
-
case
|
|
72
|
-
h = ((
|
|
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
|
|
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
|
|
90
|
-
s
|
|
91
|
-
l
|
|
115
|
+
var hh = h / 360;
|
|
116
|
+
var ss = s / 100;
|
|
117
|
+
var ll = l / 100;
|
|
92
118
|
var r, g, b;
|
|
93
|
-
if (
|
|
94
|
-
r = g = b =
|
|
119
|
+
if (ss === 0) {
|
|
120
|
+
r = g = b = ll;
|
|
95
121
|
} else {
|
|
96
122
|
var hue2rgb = function hue2rgb(p, q, t) {
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
if (
|
|
100
|
-
if (
|
|
101
|
-
if (
|
|
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 =
|
|
105
|
-
var p = 2 *
|
|
106
|
-
r = hue2rgb(p, q,
|
|
107
|
-
g = hue2rgb(p, q,
|
|
108
|
-
b = hue2rgb(p, q,
|
|
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
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
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(
|
|
175
|
-
var primaryHex =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
//
|
|
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
|
-
//
|
|
196
|
-
//
|
|
197
|
-
// Scale
|
|
198
|
-
// Scale
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
// Scale
|
|
202
|
-
// Scale
|
|
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
|
-
|
|
206
|
-
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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 +
|
|
241
|
-
: generateColorScale(bgBaseHex, Math.
|
|
242
|
-
//
|
|
243
|
-
colorBgElevated: darkMode ? generateColorScale(bgBaseHex, Math.min(bgBaseHsl.l + 3, 8), 1.2) //
|
|
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
|
-
//
|
|
246
|
-
colorBgLayout:
|
|
247
|
-
|
|
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
|
-
|
|
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,
|