@oscarpalmer/atoms 0.193.0 → 0.193.1

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.
Files changed (126) hide show
  1. package/package.json +3 -4
  2. package/src/array/difference.ts +0 -73
  3. package/src/array/exists.ts +0 -93
  4. package/src/array/filter.ts +0 -182
  5. package/src/array/find.ts +0 -183
  6. package/src/array/first.ts +0 -196
  7. package/src/array/flatten.ts +0 -20
  8. package/src/array/from.ts +0 -129
  9. package/src/array/get.ts +0 -131
  10. package/src/array/group-by.ts +0 -369
  11. package/src/array/index.ts +0 -26
  12. package/src/array/insert.ts +0 -52
  13. package/src/array/intersection.ts +0 -72
  14. package/src/array/last.ts +0 -194
  15. package/src/array/match.ts +0 -436
  16. package/src/array/move.ts +0 -315
  17. package/src/array/partition.ts +0 -91
  18. package/src/array/push.ts +0 -23
  19. package/src/array/reverse.ts +0 -33
  20. package/src/array/select.ts +0 -260
  21. package/src/array/single.ts +0 -93
  22. package/src/array/slice.ts +0 -335
  23. package/src/array/sort.ts +0 -607
  24. package/src/array/splice.ts +0 -106
  25. package/src/array/swap.ts +0 -322
  26. package/src/array/to-map.ts +0 -371
  27. package/src/array/to-record.ts +0 -351
  28. package/src/array/to-set.ts +0 -80
  29. package/src/array/toggle.ts +0 -79
  30. package/src/array/union.ts +0 -72
  31. package/src/array/unique.ts +0 -67
  32. package/src/array/update.ts +0 -75
  33. package/src/beacon.ts +0 -378
  34. package/src/color/constants.ts +0 -137
  35. package/src/color/index.ts +0 -83
  36. package/src/color/instance.ts +0 -162
  37. package/src/color/misc/alpha.ts +0 -56
  38. package/src/color/misc/format.ts +0 -29
  39. package/src/color/misc/get.ts +0 -210
  40. package/src/color/misc/is.ts +0 -221
  41. package/src/color/misc/state.ts +0 -243
  42. package/src/color/models.ts +0 -389
  43. package/src/color/space/hex.ts +0 -184
  44. package/src/color/space/hsl.ts +0 -174
  45. package/src/color/space/hwb.ts +0 -153
  46. package/src/color/space/rgb.ts +0 -240
  47. package/src/function/assert.ts +0 -174
  48. package/src/function/index.ts +0 -2
  49. package/src/function/limit.ts +0 -83
  50. package/src/function/memoize.ts +0 -202
  51. package/src/function/once.ts +0 -200
  52. package/src/function/retry.ts +0 -175
  53. package/src/function/work.ts +0 -1007
  54. package/src/herald.ts +0 -216
  55. package/src/index.ts +0 -68
  56. package/src/internal/array/callbacks.ts +0 -46
  57. package/src/internal/array/chunk.ts +0 -51
  58. package/src/internal/array/compact.ts +0 -56
  59. package/src/internal/array/find.ts +0 -200
  60. package/src/internal/array/group.ts +0 -42
  61. package/src/internal/array/index-of.ts +0 -182
  62. package/src/internal/array/insert.ts +0 -80
  63. package/src/internal/array/overlap.ts +0 -35
  64. package/src/internal/array/sets.ts +0 -74
  65. package/src/internal/array/shuffle.ts +0 -33
  66. package/src/internal/array/update.ts +0 -52
  67. package/src/internal/function/misc.ts +0 -8
  68. package/src/internal/function/timer.ts +0 -168
  69. package/src/internal/is.ts +0 -244
  70. package/src/internal/math/aggregate.ts +0 -164
  71. package/src/internal/math/misc.ts +0 -28
  72. package/src/internal/number.ts +0 -129
  73. package/src/internal/random.ts +0 -49
  74. package/src/internal/result.ts +0 -92
  75. package/src/internal/sized.ts +0 -25
  76. package/src/internal/string.ts +0 -128
  77. package/src/internal/subscription.ts +0 -264
  78. package/src/internal/value/compare.ts +0 -170
  79. package/src/internal/value/equal.ts +0 -465
  80. package/src/internal/value/get.ts +0 -57
  81. package/src/internal/value/handlers.ts +0 -95
  82. package/src/internal/value/has.ts +0 -118
  83. package/src/internal/value/misc.ts +0 -125
  84. package/src/internal/value/partial.ts +0 -46
  85. package/src/internal/value/set.ts +0 -132
  86. package/src/is.ts +0 -182
  87. package/src/logger.ts +0 -230
  88. package/src/math.ts +0 -281
  89. package/src/models.ts +0 -286
  90. package/src/number.ts +0 -1
  91. package/src/promise/delay.ts +0 -62
  92. package/src/promise/helpers.ts +0 -96
  93. package/src/promise/index.ts +0 -300
  94. package/src/promise/misc.ts +0 -96
  95. package/src/promise/models.ts +0 -195
  96. package/src/promise/timed.ts +0 -91
  97. package/src/query.ts +0 -147
  98. package/src/queue.ts +0 -814
  99. package/src/random.ts +0 -125
  100. package/src/result/index.ts +0 -105
  101. package/src/result/match.ts +0 -124
  102. package/src/result/misc.ts +0 -129
  103. package/src/result/models.ts +0 -83
  104. package/src/result/work/flow.ts +0 -488
  105. package/src/result/work/pipe.ts +0 -496
  106. package/src/sized/map.ts +0 -110
  107. package/src/sized/set.ts +0 -107
  108. package/src/string/case.ts +0 -236
  109. package/src/string/fuzzy.ts +0 -444
  110. package/src/string/index.ts +0 -199
  111. package/src/string/match.ts +0 -80
  112. package/src/string/normalize.ts +0 -205
  113. package/src/string/template.ts +0 -161
  114. package/src/value/clone.ts +0 -319
  115. package/src/value/collection.ts +0 -63
  116. package/src/value/diff.ts +0 -232
  117. package/src/value/freeze.ts +0 -322
  118. package/src/value/handle.ts +0 -3
  119. package/src/value/index.ts +0 -5
  120. package/src/value/merge.ts +0 -278
  121. package/src/value/omit.ts +0 -20
  122. package/src/value/pick.ts +0 -20
  123. package/src/value/shake.ts +0 -45
  124. package/src/value/smush.ts +0 -89
  125. package/src/value/transform.ts +0 -153
  126. package/src/value/unsmush.ts +0 -84
@@ -1,243 +0,0 @@
1
- import type {Subscriptions} from '../../internal/subscription';
2
- import {COLOR_DEFAULTS, COLOR_KEYS, COLOR_LENGTHS, COLOR_MAX, COLOR_TYPE} from '../constants';
3
- import type {
4
- Color,
5
- ColorState,
6
- ColorType,
7
- HSLAColor,
8
- HSLColor,
9
- HWBAColor,
10
- HWBColor,
11
- RGBAColor,
12
- RGBColor,
13
- } from '../models';
14
- import {getColorFromHex, getNormalizedHex} from '../space/hex';
15
- import {getColorFromHsl, getHslValue} from '../space/hsl';
16
- import {getColorFromHwb, getHwbValue} from '../space/hwb';
17
- import {getColorFromRgb, getRgbValue} from '../space/rgb';
18
- import {getAlpha} from './alpha';
19
- import {getDegrees, getHexValue, getPercentage} from './get';
20
- import {isColor, isHexColor, isHslLike, isHwbLike, isRgbLike} from './is';
21
-
22
- // #region Functions
23
-
24
- export function getColorFromState<Type extends ColorType>(
25
- state: ColorState,
26
- type: Type,
27
- ): NonNullable<ColorState[Type]> {
28
- const {origin} = state;
29
-
30
- if (type === origin) {
31
- return state[origin] as NonNullable<ColorState[Type]>;
32
- }
33
-
34
- return state[type] ?? (getters[origin](state, type) as NonNullable<ColorState[Type]>);
35
- }
36
-
37
- export function getColorState(value: unknown): ColorState {
38
- if (typeof value === 'string') {
39
- return getColorStateForHex(value);
40
- }
41
-
42
- if (isColor(value)) {
43
- const {origin} = value;
44
-
45
- return {
46
- origin,
47
- [origin]: value[origin],
48
- alpha: getAlpha(value.alpha, false),
49
- };
50
- }
51
-
52
- if (typeof value === 'object' && value !== null) {
53
- const state: ColorState = {
54
- alpha: getAlpha((value as HSLAColor).alpha, false),
55
- origin: undefined as never,
56
- };
57
-
58
- if (COLOR_KEYS.hsl.every(key => key in value)) {
59
- state.hsl = getHslValue(value as Record<keyof HSLColor, unknown>);
60
- state.origin = COLOR_TYPE.hsl;
61
- } else if (COLOR_KEYS.hwb.every(key => key in value)) {
62
- state.hwb = getHwbValue(value as Record<keyof HWBColor, unknown>);
63
- state.origin = COLOR_TYPE.hwb;
64
- } else if (COLOR_KEYS.rgb.every(key => key in value)) {
65
- state.rgb = getRgbValue(value as Record<keyof RGBColor, unknown>);
66
- state.origin = COLOR_TYPE.rgb;
67
- }
68
-
69
- if (state.origin != null) {
70
- return state;
71
- }
72
- }
73
-
74
- return getDefaultColorState();
75
- }
76
-
77
- function getColorStateForHex(value: string): ColorState {
78
- const normalized = getNormalizedHex(value, true);
79
- const hex = normalized.slice(0, COLOR_LENGTHS.hexLong);
80
-
81
- return {
82
- hex,
83
- alpha: getAlpha(normalized.slice(COLOR_LENGTHS.hexLong), true),
84
- origin: COLOR_TYPE.hex,
85
- };
86
- }
87
-
88
- function getDefaultColorState(): ColorState {
89
- return {
90
- alpha: getAlpha(COLOR_MAX.percent, false),
91
- hex: COLOR_DEFAULTS.hexBlack,
92
- hsl: {...COLOR_DEFAULTS.hsl},
93
- hwb: {...COLOR_DEFAULTS.hwb},
94
- rgb: {...COLOR_DEFAULTS.rgb},
95
- origin: COLOR_TYPE.hex,
96
- };
97
- }
98
-
99
- function setColorValue<Type extends ColorType>(
100
- color: Color,
101
- state: ColorState,
102
- subscriptions: Subscriptions<Function>,
103
- type: Type,
104
- value: ColorState[Type],
105
- alpha?: number | string,
106
- ): void {
107
- state.hex = undefined;
108
- state.hsl = undefined;
109
- state.hwb = undefined;
110
- state.rgb = undefined;
111
-
112
- state.origin = type;
113
- state[type] = value;
114
-
115
- if (alpha != null) {
116
- state.alpha = getAlpha(alpha, type === COLOR_TYPE.hex);
117
- }
118
-
119
- for (const type of COLOR_TYPE.all) {
120
- const callbacks = subscriptions.values.to.keyed?.get(type);
121
-
122
- if (callbacks != null) {
123
- for (const callback of callbacks.values()) {
124
- callback(color[type]);
125
- }
126
- }
127
- }
128
-
129
- for (const callback of subscriptions.values.to.any.values()) {
130
- callback(color);
131
- }
132
- }
133
-
134
- export function setHexColor(
135
- color: Color,
136
- state: ColorState,
137
- subscriptions: Subscriptions<Function>,
138
- value: string,
139
- alpha: boolean,
140
- ): void {
141
- if (!isHexColor(value) || (!alpha && value === state.hex)) {
142
- return;
143
- }
144
-
145
- const normalized = getNormalizedHex(value, true);
146
-
147
- setColorValue(
148
- color,
149
- state,
150
- subscriptions,
151
- COLOR_TYPE.hex,
152
- normalized.slice(0, COLOR_LENGTHS.hexLong),
153
- alpha ? normalized.slice(COLOR_LENGTHS.hexLong) : undefined,
154
- );
155
- }
156
-
157
- export function setHSLColor(
158
- color: Color,
159
- state: ColorState,
160
- subscriptions: Subscriptions<Function>,
161
- value: unknown,
162
- alpha: boolean,
163
- ): void {
164
- if (!isHslLike(value)) {
165
- return;
166
- }
167
-
168
- setColorValue(
169
- color,
170
- state,
171
- subscriptions,
172
- COLOR_TYPE.hsl,
173
- {
174
- hue: getDegrees((value as HSLColor).hue),
175
- saturation: getPercentage((value as HSLColor).saturation),
176
- lightness: getPercentage((value as HSLColor).lightness),
177
- },
178
- alpha ? (value as HSLAColor).alpha : undefined,
179
- );
180
- }
181
-
182
- export function setHWBColor(
183
- color: Color,
184
- state: ColorState,
185
- subscriptions: Subscriptions<Function>,
186
- value: unknown,
187
- alpha: boolean,
188
- ): void {
189
- if (!isHwbLike(value)) {
190
- return;
191
- }
192
-
193
- setColorValue(
194
- color,
195
- state,
196
- subscriptions,
197
- COLOR_TYPE.hwb,
198
- {
199
- hue: getDegrees((value as HWBColor).hue),
200
- whiteness: getPercentage((value as HWBColor).whiteness),
201
- blackness: getPercentage((value as HWBColor).blackness),
202
- },
203
- alpha ? (value as HWBAColor).alpha : undefined,
204
- );
205
- }
206
-
207
- export function setRGBColor(
208
- color: Color,
209
- state: ColorState,
210
- subscriptions: Subscriptions<Function>,
211
- value: unknown,
212
- alpha: boolean,
213
- ): void {
214
- if (!isRgbLike(value)) {
215
- return;
216
- }
217
-
218
- setColorValue(
219
- color,
220
- state,
221
- subscriptions,
222
- COLOR_TYPE.rgb,
223
- {
224
- red: getHexValue((value as RGBColor).red),
225
- green: getHexValue((value as RGBColor).green),
226
- blue: getHexValue((value as RGBColor).blue),
227
- },
228
- alpha ? (value as RGBAColor).alpha : undefined,
229
- );
230
- }
231
-
232
- // #endregion
233
-
234
- // #region Variables
235
-
236
- const getters: Record<ColorType, (state: ColorState, type: ColorType) => any> = {
237
- hex: getColorFromHex,
238
- hsl: getColorFromHsl,
239
- hwb: getColorFromHwb,
240
- rgb: getColorFromRgb,
241
- };
242
-
243
- // #endregion
@@ -1,389 +0,0 @@
1
- // #region Types
2
-
3
- import type {Subscription} from '../internal/subscription';
4
- import type {COLOR_ALPHA, COLOR_TYPE} from './constants';
5
-
6
- export type Alpha = {
7
- hex: string;
8
- value: number;
9
- };
10
-
11
- /**
12
- * A color that is represented in multiple color formats
13
- */
14
- export type Color = {
15
- /**
16
- * Get the alpha channel _(opacity)_ of the color as a percentage between `0` and `100`
17
- *
18
- * @returns Current alpha channel value
19
- */
20
- get alpha(): number;
21
-
22
- /**
23
- * Set the alpha channel _(opacity)_ of the color as a percentage between `0` and `100`
24
- *
25
- * @param value New alpha channel value
26
- */
27
- set alpha(value: number);
28
-
29
- /**
30
- * Get the color as a hex color string
31
- *
32
- * _Hex color string is returned with no `#`-prefix or alpha channel (opacity)_
33
- *
34
- * @returns Current color as a hex color string
35
- */
36
- get hex(): string;
37
-
38
- /**
39
- * Set the color from a hex color string
40
- *
41
- * - `#`-prefix is optional
42
- * - Alpha channel _(opacity)_ will be ignored
43
- *
44
- * @param value New hex color string
45
- */
46
- set hex(value: string);
47
-
48
- /**
49
- * Get the color as a hex color with an alpha channel _(opacity)_
50
- *
51
- * _Hex color string is returned with alpha channel (opacity), but without `#`-prefix_
52
- *
53
- * @returns Current color as a hex color string
54
- */
55
- get hexa(): string;
56
-
57
- /**
58
- * Set the color from a hex color string with an alpha channel _(opacity)_
59
- *
60
- * - `#`-prefix is optional
61
- * - Alpha channel _(opacity)_ will be respected
62
- *
63
- * @param value New hex color string
64
- */
65
- set hexa(value: string);
66
-
67
- /**
68
- * Get the color as an _HSL_ color
69
- *
70
- * @returns Current color as an _HSL_ color
71
- */
72
- get hsl(): HSLColor;
73
-
74
- /**
75
- * Set colors from an _HSL_ color
76
- *
77
- * @param value New _HSL_ color
78
- */
79
- set hsl(value: HSLColor);
80
-
81
- /**
82
- * Get the color as an _HSLA_ color
83
- *
84
- * @returns Current color as an _HSLA_ color
85
- */
86
- get hsla(): HSLAColor;
87
-
88
- /**
89
- * Set colors and alpha from an _HSLA_ color
90
- *
91
- * @param value New _HSLA_ color
92
- */
93
- set hsla(value: HSLAColor);
94
-
95
- /**
96
- * Get the color as an _HWB_ color
97
- *
98
- * @returns Current color as an _HWB_ color
99
- */
100
- get hwb(): HWBColor;
101
-
102
- /**
103
- * Set colors from an _HWB_ color
104
- *
105
- * @param value New _HWB_ color
106
- */
107
- set hwb(value: HWBColor);
108
-
109
- /**
110
- * Get the color as an _HWBA_ color
111
- *
112
- * @returns Current color as an _HWBA_ color
113
- */
114
- get hwba(): HWBAColor;
115
-
116
- /**
117
- * Set colors and alpha from an _HWBA_ color
118
- *
119
- * @param value New _HWBA_ color
120
- */
121
- set hwba(value: HWBAColor);
122
-
123
- /**
124
- * Last color format that was set on the color
125
- *
126
- * @returns Color type
127
- */
128
- get origin(): ColorType;
129
-
130
- /**
131
- * Get the color as an _RGB_ color
132
- *
133
- * @returns Current color as an _RGB_ color
134
- */
135
- get rgb(): RGBColor;
136
-
137
- /**
138
- * Set colors from an _RGB_ color
139
- *
140
- * @param value New _RGB_ color
141
- */
142
- set rgb(value: RGBColor);
143
-
144
- /**
145
- * Get the color as an _RGBA_ color
146
- *
147
- * @returns Current color as an _RGBA_ color
148
- */
149
- get rgba(): RGBAColor;
150
-
151
- /**
152
- * Set colors and alpha from an _RGBA_ color
153
- *
154
- * @param value New _RGBA_ color
155
- */
156
- set rgba(value: RGBAColor);
157
-
158
- /**
159
- * Subscribe to alpha channel _(opacity)_ changes of the color
160
- *
161
- * @param key Color property to subscribe to
162
- * @param callback Callback function for changes
163
- */
164
- subscribe(key: 'alpha', callback: (value: number) => void): Subscription;
165
-
166
- /**
167
- * Subscribe to hex color changes of the color
168
- *
169
- * @param key Color type to subscribe to
170
- * @param callback Callback function for changes
171
- */
172
- subscribe(key: typeof COLOR_TYPE.hex, callback: (value: string) => void): Subscription;
173
-
174
- /**
175
- * Subscribe to hex color changes of the color with alpha channel _(opacity)_
176
- *
177
- * @param key Color type to subscribe to
178
- * @param callback Callback function for changes
179
- */
180
- subscribe(key: typeof COLOR_TYPE.hexa, callback: (value: string) => void): Subscription;
181
-
182
- /**
183
- * Subscribe to _HSL_ color changes of the color
184
- *
185
- * @param key Color type to subscribe to
186
- * @param callback Callback function for changes
187
- */
188
- subscribe(key: typeof COLOR_TYPE.hsl, callback: (value: HSLColor) => void): Subscription;
189
-
190
- /**
191
- * Subscribe to _HSL(A)_ color changes of the color
192
- *
193
- * @param key Color type to subscribe to
194
- * @param callback Callback function for changes
195
- */
196
- subscribe(key: typeof COLOR_TYPE.hsla, callback: (value: HSLAColor) => void): Subscription;
197
-
198
- /**
199
- * Subscribe to _HWB_ color changes of the color
200
- *
201
- * @param key Color type to subscribe to
202
- * @param callback Callback function for changes
203
- */
204
- subscribe(key: typeof COLOR_TYPE.hwb, callback: (value: HWBColor) => void): Subscription;
205
-
206
- /**
207
- * Subscribe to _HWB(A)_ color changes of the color
208
- *
209
- * @param key Color type to subscribe to
210
- * @param callback Callback function for changes
211
- */
212
- subscribe(key: typeof COLOR_TYPE.hwba, callback: (value: HWBAColor) => void): Subscription;
213
-
214
- /**
215
- * Subscribe to _RGB_ color changes of the color
216
- *
217
- * @param key Color type to subscribe to
218
- * @param callback Callback function for changes
219
- */
220
- subscribe(key: typeof COLOR_TYPE.rgb, callback: (value: RGBColor) => void): Subscription;
221
-
222
- /**
223
- * Subscribe to _RGBA_ color changes of the color
224
- *
225
- * @param key Color type to subscribe to
226
- * @param callback Callback function for changes
227
- */
228
- subscribe(key: typeof COLOR_TYPE.rgba, callback: (value: RGBAColor) => void): Subscription;
229
-
230
- /**
231
- * Subscribe to any color changes of the color
232
- *
233
- * @param callback Callback function for changes
234
- */
235
- subscribe(callback: (value: Color) => void): Subscription;
236
-
237
- /**
238
- * Get the color as a hex string
239
- *
240
- * @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
241
- * @returns Hex color string
242
- */
243
- toHexString(alpha?: boolean): string;
244
-
245
- /**
246
- * Get the color as an _HSL(A)_ string
247
- *
248
- * @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
249
- * @returns _HSL(A)_ color string
250
- */
251
- toHslString(alpha?: boolean): string;
252
-
253
- /**
254
- * Get the color as an _HWB(A)_ string
255
- *
256
- * @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
257
- * @returns _HWB(A)_ color string
258
- */
259
- toHwbString(alpha?: boolean): string;
260
-
261
- /**
262
- * Get the color as an _RGB(A)_ string
263
- *
264
- * @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
265
- * @returns _RGB(A)_ color string
266
- */
267
- toRgbString(alpha?: boolean): string;
268
-
269
- /**
270
- * Get the color as a hex color string
271
- *
272
- * @returns Hex color string
273
- */
274
- toString(): string;
275
-
276
- /**
277
- * Unsubscribe from all color changes of the color
278
- *
279
- * _(To unsubscribe from a specific color change, use the `unsubscribe()` method on the `Subscription` returned by the individual `subscribe()` method)_
280
- */
281
- unsubscribe(): void;
282
- };
283
-
284
- type ColorWithAlpha = {
285
- /**
286
- * Alpha channel _(opacity)_ of the color _(in percentage; 0-100)_
287
- */
288
- alpha: number;
289
- };
290
-
291
- /**
292
- * An _HSL_ color with an alpha channel _(opacity)_
293
- */
294
- export type HSLAColor = HSLColor & ColorWithAlpha;
295
-
296
- /**
297
- * An _HSL_ color
298
- */
299
- export type HSLColor = {
300
- /**
301
- * Hue of the color _(in degrees; 0-360)_
302
- */
303
- hue: number;
304
- /**
305
- * Lightness of the color _(in percentage; 0-100)_
306
- */
307
- lightness: number;
308
- /**
309
- * Saturation of the color _(in percentage; 0-100)_
310
- */
311
- saturation: number;
312
- };
313
-
314
- export type HWBColor = {
315
- /**
316
- * Blackness of the color _(in percentage; 0-100)_
317
- */
318
- blackness: number;
319
- /**
320
- * Hue of the color _(in degrees; 0-360)_
321
- */
322
- hue: number;
323
- /**
324
- * Whiteness of the color _(in percentage; 0-100)_
325
- */
326
- whiteness: number;
327
- };
328
-
329
- export type HWBAColor = HWBColor & ColorWithAlpha;
330
-
331
- /**
332
- * An _RGB_ color with an alpha channel _(opacity)_
333
- */
334
- export type RGBAColor = RGBColor & ColorWithAlpha;
335
-
336
- /**
337
- * An _RGB_ color
338
- */
339
- export type RGBColor = {
340
- /**
341
- * Blue channel of the color _(in hexadecimal; 0-255)_
342
- */
343
- blue: number;
344
- /**
345
- * Green channel of the color _(in hexadecimal; 0-255)_
346
- */
347
- green: number;
348
- /**
349
- * Red channel of the color _(in hexadecimal; 0-255)_
350
- */
351
- red: number;
352
- };
353
-
354
- export type ColorProperty =
355
- | typeof COLOR_ALPHA.name
356
- | keyof HSLColor
357
- | keyof HWBColor
358
- | keyof RGBColor;
359
-
360
- export type ColorState = {
361
- alpha: Alpha;
362
- hex?: string;
363
- hsl?: HSLColor;
364
- hwb?: HWBColor;
365
- origin: ColorType;
366
- rgb?: RGBColor;
367
- };
368
-
369
- /**
370
- * Base color types
371
- */
372
- export type ColorType = 'hex' | 'hsl' | 'hwb' | 'rgb';
373
-
374
- /**
375
- * Extended color types
376
- */
377
- export type ColorTypeExtended = ColorType | 'hsla' | 'hwba' | 'rgba';
378
-
379
- /**
380
- * Base color values
381
- */
382
- export type ColorValue = string | HSLColor | HWBColor | RGBColor;
383
-
384
- /**
385
- * Extended color values
386
- */
387
- export type ColorValueExtended = ColorValue | HSLAColor | HWBAColor | RGBAColor;
388
-
389
- // #endregion