@agentscope-ai/design 1.0.22 → 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 +164 -98
- 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,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,32 +1,47 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Theme Generator
|
|
3
4
|
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 2. 颜色调整和生成
|
|
7
|
-
* 3. 完整主题配置生成(支持浅色/暗色模式)
|
|
5
|
+
* Generates a complete theme configuration based on input primary color, background color, and text color.
|
|
6
|
+
* Supports both light and dark modes.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
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.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
*
|
|
20
|
-
*
|
|
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
|
|
21
34
|
*/
|
|
22
35
|
|
|
23
36
|
import themeDataDark from "./bailianDarkTheme.json";
|
|
24
37
|
import themeData from "./bailianTheme.json";
|
|
25
38
|
|
|
26
|
-
// ====================
|
|
39
|
+
// ==================== Color Conversion Utility Functions ====================
|
|
27
40
|
|
|
28
41
|
/**
|
|
29
|
-
* 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
|
|
30
45
|
*/
|
|
31
46
|
var hexToRgb = function hexToRgb(hex) {
|
|
32
47
|
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
@@ -38,21 +53,29 @@ var hexToRgb = function hexToRgb(hex) {
|
|
|
38
53
|
};
|
|
39
54
|
|
|
40
55
|
/**
|
|
41
|
-
* 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')
|
|
42
61
|
*/
|
|
43
62
|
var rgbToHex = function rgbToHex(r, g, b) {
|
|
44
63
|
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
|
|
45
64
|
};
|
|
46
65
|
|
|
47
66
|
/**
|
|
48
|
-
* 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)
|
|
49
72
|
*/
|
|
50
73
|
var rgbToHsl = function rgbToHsl(r, g, b) {
|
|
51
|
-
r
|
|
52
|
-
g
|
|
53
|
-
b
|
|
54
|
-
var max = Math.max(
|
|
55
|
-
min = Math.min(
|
|
74
|
+
var rr = r / 255;
|
|
75
|
+
var gg = g / 255;
|
|
76
|
+
var bb = b / 255;
|
|
77
|
+
var max = Math.max(rr, gg, bb),
|
|
78
|
+
min = Math.min(rr, gg, bb);
|
|
56
79
|
var h,
|
|
57
80
|
s,
|
|
58
81
|
l = (max + min) / 2;
|
|
@@ -62,14 +85,14 @@ var rgbToHsl = function rgbToHsl(r, g, b) {
|
|
|
62
85
|
var d = max - min;
|
|
63
86
|
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
64
87
|
switch (max) {
|
|
65
|
-
case
|
|
66
|
-
h = ((
|
|
88
|
+
case rr:
|
|
89
|
+
h = ((gg - bb) / d + (gg < bb ? 6 : 0)) / 6;
|
|
67
90
|
break;
|
|
68
|
-
case
|
|
69
|
-
h = ((
|
|
91
|
+
case gg:
|
|
92
|
+
h = ((bb - rr) / d + 2) / 6;
|
|
70
93
|
break;
|
|
71
|
-
case
|
|
72
|
-
h = ((
|
|
94
|
+
case bb:
|
|
95
|
+
h = ((rr - gg) / d + 4) / 6;
|
|
73
96
|
break;
|
|
74
97
|
default:
|
|
75
98
|
h = 0;
|
|
@@ -83,29 +106,34 @@ var rgbToHsl = function rgbToHsl(r, g, b) {
|
|
|
83
106
|
};
|
|
84
107
|
|
|
85
108
|
/**
|
|
86
|
-
* 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)
|
|
87
114
|
*/
|
|
88
115
|
var hslToRgb = function hslToRgb(h, s, l) {
|
|
89
|
-
h
|
|
90
|
-
s
|
|
91
|
-
l
|
|
116
|
+
var hh = h / 360;
|
|
117
|
+
var ss = s / 100;
|
|
118
|
+
var ll = l / 100;
|
|
92
119
|
var r, g, b;
|
|
93
|
-
if (
|
|
94
|
-
r = g = b =
|
|
120
|
+
if (ss === 0) {
|
|
121
|
+
r = g = b = ll;
|
|
95
122
|
} else {
|
|
96
123
|
var hue2rgb = function hue2rgb(p, q, t) {
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
if (
|
|
100
|
-
if (
|
|
101
|
-
if (
|
|
124
|
+
var tt = t;
|
|
125
|
+
if (tt < 0) tt += 1;
|
|
126
|
+
if (tt > 1) tt -= 1;
|
|
127
|
+
if (tt < 1 / 6) return p + (q - p) * 6 * tt;
|
|
128
|
+
if (tt < 1 / 2) return q;
|
|
129
|
+
if (tt < 2 / 3) return p + (q - p) * (2 / 3 - tt) * 6;
|
|
102
130
|
return p;
|
|
103
131
|
};
|
|
104
|
-
var q =
|
|
105
|
-
var p = 2 *
|
|
106
|
-
r = hue2rgb(p, q,
|
|
107
|
-
g = hue2rgb(p, q,
|
|
108
|
-
b = hue2rgb(p, q,
|
|
132
|
+
var q = ll < 0.5 ? ll * (1 + ss) : ll + ss - ll * ss;
|
|
133
|
+
var p = 2 * ll - q;
|
|
134
|
+
r = hue2rgb(p, q, hh + 1 / 3);
|
|
135
|
+
g = hue2rgb(p, q, hh);
|
|
136
|
+
b = hue2rgb(p, q, hh - 1 / 3);
|
|
109
137
|
}
|
|
110
138
|
return {
|
|
111
139
|
r: Math.round(r * 255),
|
|
@@ -114,10 +142,14 @@ var hslToRgb = function hslToRgb(h, s, l) {
|
|
|
114
142
|
};
|
|
115
143
|
};
|
|
116
144
|
|
|
117
|
-
// ====================
|
|
145
|
+
// ==================== Color Adjustment Functions ====================
|
|
118
146
|
|
|
119
147
|
/**
|
|
120
|
-
*
|
|
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
|
|
121
153
|
*/
|
|
122
154
|
var adjustColor = function adjustColor(hex, lightness) {
|
|
123
155
|
var saturation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
@@ -131,7 +163,11 @@ var adjustColor = function adjustColor(hex, lightness) {
|
|
|
131
163
|
};
|
|
132
164
|
|
|
133
165
|
/**
|
|
134
|
-
*
|
|
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
|
|
135
171
|
*/
|
|
136
172
|
var generateColorWithLightness = function generateColorWithLightness(hex, targetLightness) {
|
|
137
173
|
var targetSaturation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -147,7 +183,11 @@ var generateColorWithLightness = function generateColorWithLightness(hex, target
|
|
|
147
183
|
};
|
|
148
184
|
|
|
149
185
|
/**
|
|
150
|
-
*
|
|
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
|
|
151
191
|
*/
|
|
152
192
|
var generateColorScale = function generateColorScale(baseHex, lightness) {
|
|
153
193
|
var saturationMultiplier = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
@@ -160,15 +200,21 @@ var generateColorScale = function generateColorScale(baseHex, lightness) {
|
|
|
160
200
|
return rgbToHex(newRgb.r, newRgb.g, newRgb.b);
|
|
161
201
|
};
|
|
162
202
|
|
|
163
|
-
// ====================
|
|
203
|
+
// ==================== Theme Generation Function ====================
|
|
164
204
|
|
|
165
205
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
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
|
|
172
218
|
*/
|
|
173
219
|
|
|
174
220
|
var generateTheme = function generateTheme(_ref) {
|
|
@@ -177,37 +223,45 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
177
223
|
textBaseHex = _ref.textBaseHex,
|
|
178
224
|
_ref$darkMode = _ref.darkMode,
|
|
179
225
|
darkMode = _ref$darkMode === void 0 ? false : _ref$darkMode;
|
|
180
|
-
|
|
181
|
-
|
|
226
|
+
var resolvedBgBaseHex = bgBaseHex || (darkMode ? '#000000' : '#ffffff');
|
|
227
|
+
var resolvedTextBaseHex = textBaseHex || (darkMode ? '#E7E7ED' : '#1a1a1a');
|
|
182
228
|
var rgb = hexToRgb(primaryHex);
|
|
183
229
|
if (!rgb) return null;
|
|
184
230
|
var hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
|
|
185
231
|
|
|
186
|
-
//
|
|
187
|
-
var bgBaseRgb = hexToRgb(
|
|
188
|
-
var textBaseRgb = hexToRgb(
|
|
232
|
+
// Get RGB and HSL values for background and text colors
|
|
233
|
+
var bgBaseRgb = hexToRgb(resolvedBgBaseHex);
|
|
234
|
+
var textBaseRgb = hexToRgb(resolvedTextBaseHex);
|
|
189
235
|
var bgBaseHsl = bgBaseRgb ? rgbToHsl(bgBaseRgb.r, bgBaseRgb.g, bgBaseRgb.b) : {
|
|
190
236
|
h: 210,
|
|
191
237
|
s: 8,
|
|
192
238
|
l: darkMode ? 5 : 99
|
|
193
239
|
};
|
|
194
240
|
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
// Scale
|
|
198
|
-
// Scale
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
// Scale
|
|
202
|
-
// Scale
|
|
203
|
-
// 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)
|
|
204
249
|
|
|
205
|
-
|
|
206
|
-
|
|
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));
|
|
207
255
|
|
|
208
|
-
//
|
|
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
|
|
209
263
|
var theme = {
|
|
210
|
-
//
|
|
264
|
+
// ========== Border Radius Configuration ==========
|
|
211
265
|
borderRadiusXS: themeData.borderRadiusXS,
|
|
212
266
|
borderRadiusSM: themeData.borderRadiusSM,
|
|
213
267
|
borderRadius: themeData.borderRadius,
|
|
@@ -215,54 +269,64 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
215
269
|
borderRadiusXL: themeData.borderRadiusXL,
|
|
216
270
|
borderRadiusFull: themeData.borderRadiusFull,
|
|
217
271
|
wireframe: themeData.wireframe,
|
|
218
|
-
//
|
|
272
|
+
// ========== Primary Color System ==========
|
|
273
|
+
// Automatically adjusts primary color brightness in dark mode to ensure readability
|
|
219
274
|
colorPrimary: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
|
|
220
275
|
colorPrimaryHover: darkMode ? generateColorWithLightness(primaryHex, Math.min(hsl.l + 10, 55), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? 10 : -10, 0),
|
|
221
276
|
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) //
|
|
277
|
+
colorPrimaryBg: darkMode ? generateColorWithLightness(primaryHex, 13, baseSaturation * 0.6) // Dark mode: dark background (13% lightness)
|
|
223
278
|
: generateColorWithLightness(primaryHex, 96, baseSaturation * 0.8),
|
|
224
|
-
//
|
|
279
|
+
// Light mode: light background (96% lightness)
|
|
225
280
|
colorPrimaryBgHover: darkMode ? generateColorWithLightness(primaryHex, 13, baseSaturation * 0.6) : generateColorWithLightness(primaryHex, 94, baseSaturation),
|
|
226
281
|
colorPrimaryBorder: darkMode ? generateColorWithLightness(primaryHex, 17, borderSaturation * 0.8) : generateColorWithLightness(primaryHex, 88, borderSaturation * 0.8),
|
|
227
282
|
colorPrimaryBorderHover: darkMode ? generateColorWithLightness(primaryHex, 22, borderSaturation) : generateColorWithLightness(primaryHex, 82, borderSaturation),
|
|
228
283
|
colorPrimaryText: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
|
|
229
284
|
colorPrimaryTextHover: darkMode ? generateColorWithLightness(primaryHex, Math.min(hsl.l + 10, 55), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? 10 : -10, 0),
|
|
230
285
|
colorPrimaryTextActive: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 10, 35), hsl.s * 0.95) : adjustColor(primaryHex, hsl.l < 50 ? -10 : -20, 0),
|
|
231
|
-
//
|
|
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
|
|
232
291
|
colorTextBase: textBaseHex,
|
|
233
292
|
colorText: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.88)"),
|
|
234
293
|
colorTextSecondary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.65)"),
|
|
235
294
|
colorTextTertiary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.45)"),
|
|
236
295
|
colorTextQuaternary: "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.25)"),
|
|
237
296
|
colorTextWhite: '#fff',
|
|
238
|
-
//
|
|
297
|
+
// ========== Background Color System ==========
|
|
298
|
+
// Generated based on bgBase hue, maintains consistent hue
|
|
239
299
|
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) //
|
|
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)
|
|
244
304
|
: bgBaseHex,
|
|
245
|
-
//
|
|
246
|
-
colorBgLayout:
|
|
247
|
-
|
|
248
|
-
// 浅色:稍微深一点
|
|
305
|
+
// Light mode: uses bgBase itself (usually white)
|
|
306
|
+
colorBgLayout: bgBaseHex,
|
|
307
|
+
// Keeps consistent with bgBase
|
|
249
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)"),
|
|
250
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)"),
|
|
251
|
-
//
|
|
252
|
-
|
|
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
|
|
253
313
|
: generateColorScale(bgBaseHex, 81, 2.5),
|
|
254
|
-
//
|
|
314
|
+
// Light mode: solid border (81% lightness)
|
|
255
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),
|
|
256
|
-
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
|
|
257
317
|
: generateColorScale(bgBaseHex, 81, 2.5) + '5c',
|
|
258
318
|
colorFillSecondary: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.12)") : generateColorScale(bgBaseHex, 81, 2.5) + '33',
|
|
259
319
|
colorFillTertiary: darkMode ? "rgba(".concat(textBaseRgb.r, ", ").concat(textBaseRgb.g, ", ").concat(textBaseRgb.b, ", 0.08)") : generateColorScale(bgBaseHex, 81, 2.5) + '26',
|
|
260
320
|
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) //
|
|
321
|
+
colorFillDisable: darkMode ? generateColorScale(textBaseHex, 55, 0.8) // Dark mode: medium lightness gray (55% lightness)
|
|
262
322
|
: generateColorScale(bgBaseHex, 86, 1.8),
|
|
263
|
-
//
|
|
323
|
+
// Light mode: light gray (86% lightness)
|
|
324
|
+
|
|
325
|
+
// ========== Link Color ==========
|
|
326
|
+
// Automatically adjusts brightness in dark mode to ensure readability
|
|
264
327
|
colorLink: darkMode ? generateColorWithLightness(primaryHex, Math.max(hsl.l - 5, 42), hsl.s * 0.95) : primaryHex,
|
|
265
|
-
//
|
|
328
|
+
// ========== Status Colors ==========
|
|
329
|
+
// Dark mode uses preset optimized values, light mode uses values from configuration file
|
|
266
330
|
colorInfo: darkMode ? themeDataDark.colorInfo : themeData.colorInfo,
|
|
267
331
|
colorInfoHover: darkMode ? themeDataDark.colorInfoHover : themeData.colorInfoHover,
|
|
268
332
|
colorInfoText: darkMode ? themeDataDark.colorInfoText : themeData.colorInfoText,
|
|
@@ -288,7 +352,8 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
288
352
|
colorErrorBgHover: darkMode ? themeDataDark.colorErrorBgHover : themeData.colorErrorBgHover,
|
|
289
353
|
colorErrorBorder: darkMode ? themeDataDark.colorErrorBorder : themeData.colorErrorBorder,
|
|
290
354
|
colorErrorBorderHover: darkMode ? themeDataDark.colorErrorBorderHover : themeData.colorErrorBorderHover,
|
|
291
|
-
//
|
|
355
|
+
// ========== Decorative Colors ==========
|
|
356
|
+
// Dark mode uses preset optimized values, light mode uses values from configuration file
|
|
292
357
|
colorPurple: darkMode ? themeDataDark.colorPurple : themeData.colorPurple,
|
|
293
358
|
colorPurpleHover: darkMode ? themeDataDark.colorPurpleHover : themeData.colorPurpleHover,
|
|
294
359
|
colorPurpleBg: darkMode ? themeDataDark.colorPurpleBg : themeData.colorPurpleBg,
|
|
@@ -316,7 +381,8 @@ var generateTheme = function generateTheme(_ref) {
|
|
|
316
381
|
colorLavender: darkMode ? themeDataDark.colorLavender : themeData.colorLavender || '#A77BFF',
|
|
317
382
|
colorLavenderHover: darkMode ? themeDataDark.colorLavenderHover : themeData.colorLavenderHover || '#BB99FF',
|
|
318
383
|
colorLavenderBg: darkMode ? themeDataDark.colorLavenderBg : themeData.colorLavenderBg || 'rgba(226, 212, 255, 0.8)',
|
|
319
|
-
//
|
|
384
|
+
// ========== Shadows ==========
|
|
385
|
+
// Dark mode uses preset optimized values, light mode uses values from configuration file
|
|
320
386
|
boxShadow: darkMode ? themeDataDark.boxShadow : themeData.boxShadow,
|
|
321
387
|
boxShadowSecondary: darkMode ? themeDataDark.boxShadowSecondary : themeData.boxShadowSecondary,
|
|
322
388
|
boxShadowTertiary: darkMode ? themeDataDark.boxShadowTertiary : themeData.boxShadowTertiary,
|