phaser-wind 0.3.0 → 0.5.0
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/README.md +170 -413
- package/dist/components/column.d.ts +2 -0
- package/dist/components/column.d.ts.map +1 -0
- package/dist/components/column.js +2 -0
- package/dist/components/column.js.map +1 -0
- package/dist/core/color.d.ts +149 -282
- package/dist/core/color.d.ts.map +1 -1
- package/dist/core/color.js +117 -298
- package/dist/core/color.js.map +1 -1
- package/dist/core/color.spec.js +46 -55
- package/dist/core/color.spec.js.map +1 -1
- package/dist/core/font-size.d.ts +36 -15
- package/dist/core/font-size.d.ts.map +1 -1
- package/dist/core/font-size.js +42 -47
- package/dist/core/font-size.js.map +1 -1
- package/dist/core/font-size.spec.js +55 -43
- package/dist/core/font-size.spec.js.map +1 -1
- package/dist/core/font.d.ts +18 -91
- package/dist/core/font.d.ts.map +1 -1
- package/dist/core/font.js +33 -174
- package/dist/core/font.js.map +1 -1
- package/dist/core/font.spec.js +45 -49
- package/dist/core/font.spec.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/{pallete.d.ts → palette.d.ts} +2 -2
- package/dist/core/{pallete.d.ts.map → palette.d.ts.map} +1 -1
- package/dist/core/{pallete.js → palette.js} +2 -2
- package/dist/core/{pallete.js.map → palette.js.map} +1 -1
- package/dist/core/radius.d.ts +19 -24
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +20 -28
- package/dist/core/radius.js.map +1 -1
- package/dist/core/radius.spec.js +28 -33
- package/dist/core/radius.spec.js.map +1 -1
- package/dist/core/shadow.d.ts +18 -10
- package/dist/core/shadow.d.ts.map +1 -1
- package/dist/core/shadow.js +29 -19
- package/dist/core/shadow.js.map +1 -1
- package/dist/core/shadow.spec.d.ts +2 -0
- package/dist/core/shadow.spec.d.ts.map +1 -0
- package/dist/core/shadow.spec.js +21 -0
- package/dist/core/shadow.spec.js.map +1 -0
- package/dist/core/spacing.d.ts +22 -29
- package/dist/core/spacing.d.ts.map +1 -1
- package/dist/core/spacing.js +27 -39
- package/dist/core/spacing.js.map +1 -1
- package/dist/core/spacing.spec.js +18 -29
- package/dist/core/spacing.spec.js.map +1 -1
- package/dist/exceptions.d.ts +1 -0
- package/dist/exceptions.d.ts.map +1 -0
- package/dist/exceptions.js +2 -0
- package/dist/exceptions.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/index.d.ts +2 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +2 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/plugin.d.ts +71 -0
- package/dist/plugin/plugin.d.ts.map +1 -0
- package/dist/plugin/plugin.js +91 -0
- package/dist/plugin/plugin.js.map +1 -0
- package/dist/scene/index.d.ts +2 -0
- package/dist/scene/index.d.ts.map +1 -0
- package/dist/scene/index.js +2 -0
- package/dist/scene/index.js.map +1 -0
- package/dist/scene/scene-with-phaser-wind.d.ts +11 -0
- package/dist/scene/scene-with-phaser-wind.d.ts.map +1 -0
- package/dist/scene/scene-with-phaser-wind.js +11 -0
- package/dist/scene/scene-with-phaser-wind.js.map +1 -0
- package/dist/theme/theme-config.d.ts +24 -48
- package/dist/theme/theme-config.d.ts.map +1 -1
- package/dist/theme/theme-config.js +4 -1
- package/dist/theme/theme-config.js.map +1 -1
- package/dist/theme/theme-manager.d.ts +1 -106
- package/dist/theme/theme-manager.d.ts.map +1 -1
- package/dist/theme/theme-manager.js +1 -187
- package/dist/theme/theme-manager.js.map +1 -1
- package/dist/theme/type.d.ts +48 -0
- package/dist/theme/type.d.ts.map +1 -1
- package/dist/theme/type.js +1 -1
- package/package.json +3 -3
package/dist/core/color.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/* eslint-disable no-magic-numbers */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import { ThemeManager } from '../theme/theme-manager';
|
|
4
1
|
import { isValidColor } from '../utils';
|
|
5
|
-
import {
|
|
2
|
+
import { palette } from './palette';
|
|
3
|
+
/** Regular expression to match RGB color format */
|
|
4
|
+
const RGB_REGEX = /rgb\((\d+),\s*(\d+),\s*(\d+)\)/;
|
|
6
5
|
/**
|
|
7
6
|
* Convert hex color value to number
|
|
8
7
|
* @param hexValue - Hex color value (e.g., '#ff0000')
|
|
@@ -22,9 +21,10 @@ const convertHexToNumber = (hexValue) => {
|
|
|
22
21
|
* Convert RGB color value to number
|
|
23
22
|
* @param rgbValue - RGB color value (e.g., 'rgb(255, 0, 0)')
|
|
24
23
|
* @returns Number representation of RGB color
|
|
24
|
+
* @throws {Error} If RGB format is invalid
|
|
25
25
|
*/
|
|
26
26
|
const convertRgbToNumber = (rgbValue) => {
|
|
27
|
-
const matches = rgbValue.match(
|
|
27
|
+
const matches = rgbValue.match(RGB_REGEX);
|
|
28
28
|
if (!matches) {
|
|
29
29
|
throw new Error(`Invalid RGB format: ${rgbValue}`);
|
|
30
30
|
}
|
|
@@ -45,32 +45,53 @@ const convertColorValueToNumber = (colorValue) => {
|
|
|
45
45
|
return convertRgbToNumber(colorValue);
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Factory that creates a color utility API based on the provided theme colors
|
|
49
|
+
* @param themeColors - Theme colors configuration
|
|
50
|
+
* @returns Color utility API instance
|
|
49
51
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Create a color API bound to an optional theme colors map.
|
|
54
|
+
* If a key exists in `themeColors`, it will be resolved to a palette token and then to RGB/Hex.
|
|
55
|
+
*
|
|
56
|
+
* @typeParam T - Theme colors map
|
|
57
|
+
* @param themeColors - Optional map of theme color tokens
|
|
58
|
+
* @example
|
|
59
|
+
* const c = createColor({ primary: 'blue-500' });
|
|
60
|
+
* c.rgb('primary'); // rgb(59, 130, 246)
|
|
61
|
+
*/
|
|
62
|
+
export const createColor = (themeColors) => {
|
|
58
63
|
/**
|
|
59
|
-
* Get
|
|
60
|
-
* @param
|
|
61
|
-
* @returns
|
|
64
|
+
* Get color value from theme configuration
|
|
65
|
+
* @param key - Color token or theme color key
|
|
66
|
+
* @returns Color value from theme or null if not found
|
|
62
67
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
const getValueFromTheme = (key) => {
|
|
69
|
+
if (themeColors && key in themeColors) {
|
|
70
|
+
return themeColors[key];
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Get RGB string representation of a color
|
|
76
|
+
* @param color - Color token, theme color key or valid color string
|
|
77
|
+
* @returns RGB color string
|
|
78
|
+
* @throws {Error} If color token is not found
|
|
79
|
+
*/
|
|
80
|
+
const rgb = (color) => {
|
|
81
|
+
// Runtime supports direct CSS strings for flexibility, but
|
|
82
|
+
// the public type restricts to palette tokens or theme keys.
|
|
83
|
+
if (typeof color === 'string' && isValidColor(color)) {
|
|
84
|
+
return color;
|
|
85
|
+
}
|
|
86
|
+
const colorFromTheme = getValueFromTheme(color);
|
|
65
87
|
if (colorFromTheme) {
|
|
66
|
-
return
|
|
88
|
+
return rgb(colorFromTheme);
|
|
67
89
|
}
|
|
68
|
-
// If the color is not a theme token, it must be a color token
|
|
69
90
|
const parts = color.split('-');
|
|
70
91
|
if (parts.length === 2) {
|
|
71
92
|
const colorKey = parts[0];
|
|
72
93
|
const shade = parts[1];
|
|
73
|
-
const colorValue =
|
|
94
|
+
const colorValue = palette[colorKey]?.[shade];
|
|
74
95
|
if (!colorValue) {
|
|
75
96
|
if (isValidColor(color)) {
|
|
76
97
|
return color;
|
|
@@ -79,7 +100,7 @@ export const Color = {
|
|
|
79
100
|
}
|
|
80
101
|
return colorValue;
|
|
81
102
|
}
|
|
82
|
-
const colorValue =
|
|
103
|
+
const colorValue = palette[color];
|
|
83
104
|
if (!colorValue) {
|
|
84
105
|
if (isValidColor(color)) {
|
|
85
106
|
return color;
|
|
@@ -87,23 +108,27 @@ export const Color = {
|
|
|
87
108
|
throw new Error(`Color token "${color}" not found`);
|
|
88
109
|
}
|
|
89
110
|
return colorValue;
|
|
90
|
-
}
|
|
111
|
+
};
|
|
91
112
|
/**
|
|
92
|
-
* Get hex number
|
|
93
|
-
* @param color - Color token
|
|
94
|
-
* @returns Hex number
|
|
113
|
+
* Get hex number representation of a color
|
|
114
|
+
* @param color - Color token, theme color key or valid color string
|
|
115
|
+
* @returns Hex color number
|
|
116
|
+
* @throws {Error} If color token is not found
|
|
95
117
|
*/
|
|
96
|
-
hex
|
|
97
|
-
|
|
118
|
+
const hex = (color) => {
|
|
119
|
+
// See note in rgb()
|
|
120
|
+
if (typeof color === 'string' && isValidColor(color)) {
|
|
121
|
+
return convertColorValueToNumber(color);
|
|
122
|
+
}
|
|
123
|
+
const colorFromTheme = getValueFromTheme(color);
|
|
98
124
|
if (colorFromTheme) {
|
|
99
|
-
return
|
|
125
|
+
return hex(colorFromTheme);
|
|
100
126
|
}
|
|
101
|
-
// If the color is not a theme token, it must be a color token
|
|
102
127
|
const parts = color.split('-');
|
|
103
128
|
if (parts.length === 2) {
|
|
104
129
|
const colorKey = parts[0];
|
|
105
130
|
const shade = parts[1];
|
|
106
|
-
const colorValue =
|
|
131
|
+
const colorValue = palette[colorKey]?.[shade];
|
|
107
132
|
if (!colorValue) {
|
|
108
133
|
if (isValidColor(color)) {
|
|
109
134
|
return convertColorValueToNumber(color);
|
|
@@ -112,275 +137,69 @@ export const Color = {
|
|
|
112
137
|
}
|
|
113
138
|
return convertColorValueToNumber(colorValue);
|
|
114
139
|
}
|
|
115
|
-
const colorToConvert =
|
|
140
|
+
const colorToConvert = palette[color];
|
|
116
141
|
if (isValidColor(colorToConvert)) {
|
|
117
142
|
return convertColorValueToNumber(colorToConvert);
|
|
118
143
|
}
|
|
119
144
|
throw new Error(`Color token "${color}" not found`);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
* Get RGB color value for stone color with specified shade
|
|
171
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
172
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
173
|
-
*/
|
|
174
|
-
stone: (shade) => Color.rgb(`stone-${shade}`),
|
|
175
|
-
/**
|
|
176
|
-
* Get RGB color value for red color with specified shade
|
|
177
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
178
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
179
|
-
*/
|
|
180
|
-
red: (shade) => Color.rgb(`red-${shade}`),
|
|
181
|
-
/**
|
|
182
|
-
* Get RGB color value for orange color with specified shade
|
|
183
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
184
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
185
|
-
*/
|
|
186
|
-
orange: (shade) => Color.rgb(`orange-${shade}`),
|
|
187
|
-
/**
|
|
188
|
-
* Get RGB color value for amber color with specified shade
|
|
189
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
190
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
191
|
-
*/
|
|
192
|
-
amber: (shade) => Color.rgb(`amber-${shade}`),
|
|
193
|
-
/**
|
|
194
|
-
* Get RGB color value for yellow color with specified shade
|
|
195
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
196
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
197
|
-
*/
|
|
198
|
-
yellow: (shade) => Color.rgb(`yellow-${shade}`),
|
|
199
|
-
/**
|
|
200
|
-
* Get RGB color value for lime color with specified shade
|
|
201
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
202
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
203
|
-
*/
|
|
204
|
-
lime: (shade) => Color.rgb(`lime-${shade}`),
|
|
205
|
-
/**
|
|
206
|
-
* Get RGB color value for green color with specified shade
|
|
207
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
208
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
209
|
-
*/
|
|
210
|
-
green: (shade) => Color.rgb(`green-${shade}`),
|
|
211
|
-
/**
|
|
212
|
-
* Get RGB color value for emerald color with specified shade
|
|
213
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
214
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
215
|
-
*/
|
|
216
|
-
emerald: (shade) => Color.rgb(`emerald-${shade}`),
|
|
217
|
-
/**
|
|
218
|
-
* Get RGB color value for teal color with specified shade
|
|
219
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
220
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
221
|
-
*/
|
|
222
|
-
teal: (shade) => Color.rgb(`teal-${shade}`),
|
|
223
|
-
/**
|
|
224
|
-
* Get RGB color value for cyan color with specified shade
|
|
225
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
226
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
227
|
-
*/
|
|
228
|
-
cyan: (shade) => Color.rgb(`cyan-${shade}`),
|
|
229
|
-
/**
|
|
230
|
-
* Get RGB color value for sky color with specified shade
|
|
231
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
232
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
233
|
-
*/
|
|
234
|
-
sky: (shade) => Color.rgb(`sky-${shade}`),
|
|
235
|
-
/**
|
|
236
|
-
* Get RGB color value for blue color with specified shade
|
|
237
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
238
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
239
|
-
*/
|
|
240
|
-
blue: (shade) => Color.rgb(`blue-${shade}`),
|
|
241
|
-
/**
|
|
242
|
-
* Get RGB color value for indigo color with specified shade
|
|
243
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
244
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
245
|
-
*/
|
|
246
|
-
indigo: (shade) => Color.rgb(`indigo-${shade}`),
|
|
247
|
-
/**
|
|
248
|
-
* Get RGB color value for violet color with specified shade
|
|
249
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
250
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
251
|
-
*/
|
|
252
|
-
violet: (shade) => Color.rgb(`violet-${shade}`),
|
|
253
|
-
/**
|
|
254
|
-
* Get RGB color value for purple color with specified shade
|
|
255
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
256
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
257
|
-
*/
|
|
258
|
-
purple: (shade) => Color.rgb(`purple-${shade}`),
|
|
259
|
-
/**
|
|
260
|
-
* Get RGB color value for fuchsia color with specified shade
|
|
261
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
262
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
263
|
-
*/
|
|
264
|
-
fuchsia: (shade) => Color.rgb(`fuchsia-${shade}`),
|
|
265
|
-
/**
|
|
266
|
-
* Get RGB color value for pink color with specified shade
|
|
267
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
268
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
269
|
-
*/
|
|
270
|
-
pink: (shade) => Color.rgb(`pink-${shade}`),
|
|
271
|
-
/**
|
|
272
|
-
* Get RGB color value for rose color with specified shade
|
|
273
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
274
|
-
* @returns RGB color value in format 'rgb(R, G, B)'
|
|
275
|
-
*/
|
|
276
|
-
rose: (shade) => Color.rgb(`rose-${shade}`),
|
|
277
|
-
/**
|
|
278
|
-
* Get hex number for stone color with specified shade
|
|
279
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
280
|
-
* @returns Hex number format 0xRRGGBB
|
|
281
|
-
*/
|
|
282
|
-
stoneHex: (shade) => Color.hex(`stone-${shade}`),
|
|
283
|
-
/**
|
|
284
|
-
* Get hex number for red color with specified shade
|
|
285
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
286
|
-
* @returns Hex number format 0xRRGGBB
|
|
287
|
-
*/
|
|
288
|
-
redHex: (shade) => Color.hex(`red-${shade}`),
|
|
289
|
-
/**
|
|
290
|
-
* Get hex number for orange color with specified shade
|
|
291
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
292
|
-
* @returns Hex number format 0xRRGGBB
|
|
293
|
-
*/
|
|
294
|
-
orangeHex: (shade) => Color.hex(`orange-${shade}`),
|
|
295
|
-
/**
|
|
296
|
-
* Get hex number for amber color with specified shade
|
|
297
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
298
|
-
* @returns Hex number format 0xRRGGBB
|
|
299
|
-
*/
|
|
300
|
-
amberHex: (shade) => Color.hex(`amber-${shade}`),
|
|
301
|
-
/**
|
|
302
|
-
* Get hex number for yellow color with specified shade
|
|
303
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
304
|
-
* @returns Hex number format 0xRRGGBB
|
|
305
|
-
*/
|
|
306
|
-
yellowHex: (shade) => Color.hex(`yellow-${shade}`),
|
|
307
|
-
/**
|
|
308
|
-
* Get hex number for lime color with specified shade
|
|
309
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
310
|
-
* @returns Hex number format 0xRRGGBB
|
|
311
|
-
*/
|
|
312
|
-
limeHex: (shade) => Color.hex(`lime-${shade}`),
|
|
313
|
-
/**
|
|
314
|
-
* Get hex number for green color with specified shade
|
|
315
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
316
|
-
* @returns Hex number format 0xRRGGBB
|
|
317
|
-
*/
|
|
318
|
-
greenHex: (shade) => Color.hex(`green-${shade}`),
|
|
319
|
-
/**
|
|
320
|
-
* Get hex number for emerald color with specified shade
|
|
321
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
322
|
-
* @returns Hex number format 0xRRGGBB
|
|
323
|
-
*/
|
|
324
|
-
emeraldHex: (shade) => Color.hex(`emerald-${shade}`),
|
|
325
|
-
/**
|
|
326
|
-
* Get hex number for teal color with specified shade
|
|
327
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
328
|
-
* @returns Hex number format 0xRRGGBB
|
|
329
|
-
*/
|
|
330
|
-
tealHex: (shade) => Color.hex(`teal-${shade}`),
|
|
331
|
-
/**
|
|
332
|
-
* Get hex number for cyan color with specified shade
|
|
333
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
334
|
-
* @returns Hex number format 0xRRGGBB
|
|
335
|
-
*/
|
|
336
|
-
cyanHex: (shade) => Color.hex(`cyan-${shade}`),
|
|
337
|
-
/**
|
|
338
|
-
* Get hex number for sky color with specified shade
|
|
339
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
340
|
-
* @returns Hex number format 0xRRGGBB
|
|
341
|
-
*/
|
|
342
|
-
skyHex: (shade) => Color.hex(`sky-${shade}`),
|
|
343
|
-
/**
|
|
344
|
-
* Get hex number for blue color with specified shade
|
|
345
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
346
|
-
* @returns Hex number format 0xRRGGBB
|
|
347
|
-
*/
|
|
348
|
-
blueHex: (shade) => Color.hex(`blue-${shade}`),
|
|
349
|
-
/**
|
|
350
|
-
* Get hex number for indigo color with specified shade
|
|
351
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
352
|
-
* @returns Hex number format 0xRRGGBB
|
|
353
|
-
*/
|
|
354
|
-
indigoHex: (shade) => Color.hex(`indigo-${shade}`),
|
|
355
|
-
/**
|
|
356
|
-
* Get hex number for violet color with specified shade
|
|
357
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
358
|
-
* @returns Hex number format 0xRRGGBB
|
|
359
|
-
*/
|
|
360
|
-
violetHex: (shade) => Color.hex(`violet-${shade}`),
|
|
361
|
-
/**
|
|
362
|
-
* Get hex number for purple color with specified shade
|
|
363
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
364
|
-
* @returns Hex number format 0xRRGGBB
|
|
365
|
-
*/
|
|
366
|
-
purpleHex: (shade) => Color.hex(`purple-${shade}`),
|
|
367
|
-
/**
|
|
368
|
-
* Get hex number for fuchsia color with specified shade
|
|
369
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
370
|
-
* @returns Hex number format 0xRRGGBB
|
|
371
|
-
*/
|
|
372
|
-
fuchsiaHex: (shade) => Color.hex(`fuchsia-${shade}`),
|
|
373
|
-
/**
|
|
374
|
-
* Get hex number for pink color with specified shade
|
|
375
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
376
|
-
* @returns Hex number format 0xRRGGBB
|
|
377
|
-
*/
|
|
378
|
-
pinkHex: (shade) => Color.hex(`pink-${shade}`),
|
|
379
|
-
/**
|
|
380
|
-
* Get hex number for rose color with specified shade
|
|
381
|
-
* @param shade - Shade key (e.g., '50', '100', '200', etc.)
|
|
382
|
-
* @returns Hex number format 0xRRGGBB
|
|
383
|
-
*/
|
|
384
|
-
roseHex: (shade) => Color.hex(`rose-${shade}`),
|
|
145
|
+
};
|
|
146
|
+
const api = {
|
|
147
|
+
rgb,
|
|
148
|
+
hex,
|
|
149
|
+
slate: (shade) => rgb(`slate-${shade}`),
|
|
150
|
+
gray: (shade) => rgb(`gray-${shade}`),
|
|
151
|
+
zinc: (shade) => rgb(`zinc-${shade}`),
|
|
152
|
+
neutral: (shade) => rgb(`neutral-${shade}`),
|
|
153
|
+
stone: (shade) => rgb(`stone-${shade}`),
|
|
154
|
+
red: (shade) => rgb(`red-${shade}`),
|
|
155
|
+
orange: (shade) => rgb(`orange-${shade}`),
|
|
156
|
+
amber: (shade) => rgb(`amber-${shade}`),
|
|
157
|
+
yellow: (shade) => rgb(`yellow-${shade}`),
|
|
158
|
+
lime: (shade) => rgb(`lime-${shade}`),
|
|
159
|
+
green: (shade) => rgb(`green-${shade}`),
|
|
160
|
+
emerald: (shade) => rgb(`emerald-${shade}`),
|
|
161
|
+
teal: (shade) => rgb(`teal-${shade}`),
|
|
162
|
+
cyan: (shade) => rgb(`cyan-${shade}`),
|
|
163
|
+
sky: (shade) => rgb(`sky-${shade}`),
|
|
164
|
+
blue: (shade) => rgb(`blue-${shade}`),
|
|
165
|
+
indigo: (shade) => rgb(`indigo-${shade}`),
|
|
166
|
+
violet: (shade) => rgb(`violet-${shade}`),
|
|
167
|
+
purple: (shade) => rgb(`purple-${shade}`),
|
|
168
|
+
fuchsia: (shade) => rgb(`fuchsia-${shade}`),
|
|
169
|
+
pink: (shade) => rgb(`pink-${shade}`),
|
|
170
|
+
rose: (shade) => rgb(`rose-${shade}`),
|
|
171
|
+
slateHex: (shade) => hex(`slate-${shade}`),
|
|
172
|
+
grayHex: (shade) => hex(`gray-${shade}`),
|
|
173
|
+
zincHex: (shade) => hex(`zinc-${shade}`),
|
|
174
|
+
neutralHex: (shade) => hex(`neutral-${shade}`),
|
|
175
|
+
stoneHex: (shade) => hex(`stone-${shade}`),
|
|
176
|
+
redHex: (shade) => hex(`red-${shade}`),
|
|
177
|
+
orangeHex: (shade) => hex(`orange-${shade}`),
|
|
178
|
+
amberHex: (shade) => hex(`amber-${shade}`),
|
|
179
|
+
yellowHex: (shade) => hex(`yellow-${shade}`),
|
|
180
|
+
limeHex: (shade) => hex(`lime-${shade}`),
|
|
181
|
+
greenHex: (shade) => hex(`green-${shade}`),
|
|
182
|
+
emeraldHex: (shade) => hex(`emerald-${shade}`),
|
|
183
|
+
tealHex: (shade) => hex(`teal-${shade}`),
|
|
184
|
+
cyanHex: (shade) => hex(`cyan-${shade}`),
|
|
185
|
+
skyHex: (shade) => hex(`sky-${shade}`),
|
|
186
|
+
blueHex: (shade) => hex(`blue-${shade}`),
|
|
187
|
+
indigoHex: (shade) => hex(`indigo-${shade}`),
|
|
188
|
+
violetHex: (shade) => hex(`violet-${shade}`),
|
|
189
|
+
purpleHex: (shade) => hex(`purple-${shade}`),
|
|
190
|
+
fuchsiaHex: (shade) => hex(`fuchsia-${shade}`),
|
|
191
|
+
pinkHex: (shade) => hex(`pink-${shade}`),
|
|
192
|
+
roseHex: (shade) => hex(`rose-${shade}`),
|
|
193
|
+
};
|
|
194
|
+
return api;
|
|
385
195
|
};
|
|
196
|
+
/**
|
|
197
|
+
* Convenience instance using only the default palette tokens (no theme).
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* Color.rgb('emerald-400')
|
|
201
|
+
* Color.hex('black')
|
|
202
|
+
*/
|
|
203
|
+
// eslint-disable-next-line no-redeclare
|
|
204
|
+
export const Color = createColor({});
|
|
386
205
|
//# sourceMappingURL=color.js.map
|
package/dist/core/color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/core/color.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/core/color.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,mDAAmD;AACnD,MAAM,SAAS,GAAG,gCAAgC,CAAC;AA8CnD;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAU,EAAE;IACtD,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAE,GAAG,GAAG,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC,CAAC;QAC1C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAE,GAAG,GAAG,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC,CAAC;QAC1C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAE,GAAG,GAAG,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC,CAAC;QAC1C,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAU,EAAE;IACtD,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,u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