@oscarpalmer/atoms 0.188.1 → 0.189.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.
- package/dist/array/difference.d.mts +0 -1
- package/dist/array/exists.d.mts +0 -1
- package/dist/array/filter.d.mts +0 -1
- package/dist/array/find.d.mts +0 -1
- package/dist/array/first.d.mts +0 -1
- package/dist/array/flatten.d.mts +0 -1
- package/dist/array/get.d.mts +0 -1
- package/dist/array/group-by.d.mts +0 -1
- package/dist/array/last.d.mts +0 -1
- package/dist/array/match.d.mts +0 -1
- package/dist/array/match.mjs +3 -3
- package/dist/array/move.d.mts +0 -1
- package/dist/array/partition.d.mts +0 -1
- package/dist/array/select.d.mts +0 -1
- package/dist/array/select.mjs +2 -1
- package/dist/array/single.d.mts +0 -1
- package/dist/array/slice.d.mts +0 -1
- package/dist/array/sort.d.mts +1 -2
- package/dist/array/sort.mjs +0 -1
- package/dist/array/swap.d.mts +0 -1
- package/dist/array/to-map.d.mts +0 -1
- package/dist/array/to-record.d.mts +0 -1
- package/dist/array/to-set.d.mts +0 -1
- package/dist/array/toggle.d.mts +0 -1
- package/dist/array/unique.d.mts +0 -1
- package/dist/array/update.d.mts +0 -1
- package/dist/color/constants.d.mts +9 -10
- package/dist/color/constants.mjs +15 -7
- package/dist/color/index.d.mts +9 -9
- package/dist/color/index.mjs +8 -7
- package/dist/color/instance.d.mts +35 -8
- package/dist/color/instance.mjs +53 -13
- package/dist/color/misc/alpha.d.mts +0 -1
- package/dist/color/misc/alpha.mjs +5 -5
- package/dist/color/misc/get.d.mts +42 -13
- package/dist/color/misc/get.mjs +45 -24
- package/dist/color/misc/index.d.mts +4 -4
- package/dist/color/misc/index.mjs +12 -12
- package/dist/color/misc/is.d.mts +56 -3
- package/dist/color/misc/is.mjs +76 -5
- package/dist/color/misc/state.d.mts +2 -2
- package/dist/color/misc/state.mjs +79 -43
- package/dist/color/models.d.mts +18 -2
- package/dist/color/space/hex.d.mts +38 -5
- package/dist/color/space/hex.mjs +57 -9
- package/dist/color/space/hsl.d.mts +33 -7
- package/dist/color/space/hsl.mjs +65 -14
- package/dist/color/space/hwb.d.mts +52 -0
- package/dist/color/space/hwb.mjs +99 -0
- package/dist/color/space/rgb.d.mts +26 -5
- package/dist/color/space/rgb.mjs +82 -28
- package/dist/function/assert.d.mts +1 -2
- package/dist/function/limit.d.mts +0 -1
- package/dist/function/memoize.d.mts +0 -1
- package/dist/function/once.d.mts +0 -1
- package/dist/function/retry.d.mts +0 -1
- package/dist/function/work.d.mts +0 -1
- package/dist/herald.d.mts +0 -1
- package/dist/index.d.mts +296 -51
- package/dist/index.mjs +661 -260
- package/dist/internal/array/callbacks.d.mts +0 -1
- package/dist/internal/array/callbacks.mjs +0 -1
- package/dist/internal/array/group.d.mts +0 -1
- package/dist/internal/array/index-of.d.mts +0 -1
- package/dist/internal/function/timer.d.mts +0 -1
- package/dist/internal/is.d.mts +0 -1
- package/dist/internal/is.mjs +1 -1
- package/dist/internal/math/aggregate.d.mts +0 -1
- package/dist/internal/math/misc.d.mts +12 -0
- package/dist/internal/math/misc.mjs +19 -0
- package/dist/internal/result.d.mts +0 -1
- package/dist/internal/value/compare.d.mts +0 -1
- package/dist/internal/value/equal.d.mts +0 -1
- package/dist/internal/value/get.d.mts +0 -1
- package/dist/internal/value/handlers.d.mts +0 -1
- package/dist/internal/value/has.d.mts +0 -1
- package/dist/internal/value/misc.d.mts +0 -1
- package/dist/internal/value/set.d.mts +0 -1
- package/dist/is.d.mts +0 -1
- package/dist/math.d.mts +1 -9
- package/dist/math.mjs +1 -16
- package/dist/models.d.mts +6 -6
- package/dist/promise/delay.d.mts +0 -1
- package/dist/promise/helpers.d.mts +0 -1
- package/dist/promise/index.d.mts +0 -1
- package/dist/promise/misc.d.mts +0 -1
- package/dist/promise/models.d.mts +4 -5
- package/dist/promise/models.mjs +1 -1
- package/dist/promise/timed.d.mts +0 -1
- package/dist/query.d.mts +0 -1
- package/dist/query.mjs +1 -1
- package/dist/queue.d.mts +0 -1
- package/dist/random.d.mts +0 -1
- package/dist/result/index.d.mts +0 -1
- package/dist/result/index.mjs +2 -1
- package/dist/result/match.d.mts +0 -1
- package/dist/result/misc.d.mts +0 -1
- package/dist/result/models.d.mts +0 -1
- package/dist/result/work/flow.d.mts +0 -1
- package/dist/result/work/pipe.d.mts +0 -1
- package/dist/string/fuzzy.d.mts +0 -1
- package/dist/string/index.d.mts +0 -1
- package/dist/string/index.mjs +1 -1
- package/dist/string/template.d.mts +0 -1
- package/dist/value/clone.d.mts +0 -1
- package/dist/value/freeze.d.mts +1 -2
- package/dist/value/merge.d.mts +0 -1
- package/dist/value/omit.d.mts +0 -1
- package/dist/value/pick.d.mts +0 -1
- package/dist/value/shake.d.mts +1 -2
- package/dist/value/smush.d.mts +1 -2
- package/dist/value/transform.d.mts +1 -2
- package/dist/value/unsmush.d.mts +1 -2
- package/package.json +5 -5
- package/src/color/constants.ts +17 -13
- package/src/color/index.ts +21 -6
- package/src/color/instance.ts +67 -14
- package/src/color/misc/alpha.ts +6 -10
- package/src/color/misc/get.ts +70 -16
- package/src/color/misc/index.ts +18 -17
- package/src/color/misc/is.ts +90 -4
- package/src/color/misc/state.ts +126 -40
- package/src/color/models.ts +19 -1
- package/src/color/space/hex.ts +55 -8
- package/src/color/space/hsl.ts +80 -14
- package/src/color/space/hwb.ts +123 -0
- package/src/color/space/rgb.ts +108 -27
- package/src/internal/math/misc.ts +28 -0
- package/src/math.ts +2 -29
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { DEFAULT_HWB } from "../constants.mjs";
|
|
2
|
+
import { getAlphaValue } from "../misc/alpha.mjs";
|
|
3
|
+
import { getDegrees, getPercentage } from "../misc/get.mjs";
|
|
4
|
+
import { isHwbLike } from "../misc/is.mjs";
|
|
5
|
+
import { rgbToHex } from "./rgb.mjs";
|
|
6
|
+
import { hslToRgb, hslToRgba } from "./hsl.mjs";
|
|
7
|
+
//#region src/color/space/hwb.ts
|
|
8
|
+
function convertHwbToHsl(input) {
|
|
9
|
+
let { blackness, hue, whiteness } = isHwbLike(input) ? getHwbValue(input) : DEFAULT_HWB;
|
|
10
|
+
blackness /= 100;
|
|
11
|
+
whiteness /= 100;
|
|
12
|
+
if (blackness + whiteness > 1) {
|
|
13
|
+
const total = blackness + whiteness;
|
|
14
|
+
blackness /= total;
|
|
15
|
+
whiteness /= total;
|
|
16
|
+
}
|
|
17
|
+
const lightness = (1 - blackness + whiteness) / 2;
|
|
18
|
+
return {
|
|
19
|
+
hue,
|
|
20
|
+
saturation: getHwbSaturation(blackness, whiteness, lightness) * 100,
|
|
21
|
+
lightness: lightness * 100,
|
|
22
|
+
alpha: getAlphaValue(input?.alpha ?? 100)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function getHwbSaturation(blackness, whiteness, lightness) {
|
|
26
|
+
const hue = 1 - blackness - whiteness;
|
|
27
|
+
if (hue <= 0) return 0;
|
|
28
|
+
return hue / Math.min(2 * lightness, 2 - 2 * lightness);
|
|
29
|
+
}
|
|
30
|
+
function getHwbValue(value) {
|
|
31
|
+
return {
|
|
32
|
+
hue: getDegrees(value.hue),
|
|
33
|
+
whiteness: getPercentage(value.whiteness),
|
|
34
|
+
blackness: getPercentage(value.blackness)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Convert an _HWB(A)_ color to a hex color _(with optional alpha channel, i.e., opacity)_
|
|
39
|
+
*
|
|
40
|
+
* _If the value is unable to be converted, a black hex color will be returned_
|
|
41
|
+
*
|
|
42
|
+
* @param hwb _HWB(A)_ color
|
|
43
|
+
* @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
|
|
44
|
+
* @returns Hex color string
|
|
45
|
+
*/
|
|
46
|
+
function hwbToHex(hwb, alpha) {
|
|
47
|
+
return rgbToHex(hwbToRgb(hwb), alpha);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Convert an _HWB(A)_ color to an _RGB_ color
|
|
51
|
+
*
|
|
52
|
+
* _If the value is unable to be converted, a black _RGB_ color will be returned_
|
|
53
|
+
*
|
|
54
|
+
* @param hwb _HWB(A)_ color
|
|
55
|
+
* @returns _RGB_ color
|
|
56
|
+
*/
|
|
57
|
+
function hwbToHsl(hwb) {
|
|
58
|
+
const { hue, lightness, saturation } = convertHwbToHsl(hwb);
|
|
59
|
+
return {
|
|
60
|
+
hue,
|
|
61
|
+
lightness,
|
|
62
|
+
saturation
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Convert an _HWB(A)_ color to an _HSLA_ color
|
|
67
|
+
*
|
|
68
|
+
* _If the value is unable to be converted, a black _HSLA_ color will be returned_
|
|
69
|
+
*
|
|
70
|
+
* @param hwb _HWB(A)_ color
|
|
71
|
+
* @returns _HSLA_ color
|
|
72
|
+
*/
|
|
73
|
+
function hwbToHsla(hwb) {
|
|
74
|
+
return convertHwbToHsl(hwb);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Convert an _HWB(A)_ color to an _RGB_ color
|
|
78
|
+
*
|
|
79
|
+
* _If the value is unable to be converted, a black _RGB_ color will be returned_
|
|
80
|
+
*
|
|
81
|
+
* @param hwb _HWB(A)_ color
|
|
82
|
+
* @returns _RGB_ color
|
|
83
|
+
*/
|
|
84
|
+
function hwbToRgb(hwb) {
|
|
85
|
+
return hslToRgb(hwbToHsl(hwb));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Convert an _HWB(A)_ color to an _RGBA_ color
|
|
89
|
+
*
|
|
90
|
+
* _If the value is unable to be converted, a black _RGBA_ color will be returned_
|
|
91
|
+
*
|
|
92
|
+
* @param hwb _HWB(A)_ color
|
|
93
|
+
* @returns _RGBA_ color
|
|
94
|
+
*/
|
|
95
|
+
function hwbToRgba(hwb) {
|
|
96
|
+
return hslToRgba(hwbToHsla(hwb));
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { convertHwbToHsl, getHwbValue, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HSLAColor, HSLColor, RGBAColor, RGBColor } from "../models.mjs";
|
|
2
|
-
|
|
1
|
+
import { HSLAColor, HSLColor, HWBAColor, HWBColor, RGBAColor, RGBColor } from "../models.mjs";
|
|
3
2
|
//#region src/color/space/rgb.d.ts
|
|
4
3
|
declare function convertRgbToHex(rgb: RGBAColor | RGBColor, alpha: boolean): string;
|
|
5
4
|
declare function convertRgbToHsla(value: unknown): HSLAColor;
|
|
5
|
+
declare function convertRgbToHwba(value: unknown): HWBAColor;
|
|
6
6
|
declare function getRgbValue(value: Record<keyof RGBColor, unknown>): RGBColor;
|
|
7
7
|
/**
|
|
8
8
|
* Convert an _RGB(A)_ color to a hex color _(with optional alpha channel, i.e., opacity)_
|
|
@@ -17,7 +17,7 @@ declare function rgbToHex(rgb: RGBAColor | RGBColor, alpha?: boolean): string;
|
|
|
17
17
|
/**
|
|
18
18
|
* Convert an _RGB(A)_ color to an _HSL_ color
|
|
19
19
|
*
|
|
20
|
-
* _If the value is unable to be converted, a black
|
|
20
|
+
* _If the value is unable to be converted, a black _HSL_ color will be returned_
|
|
21
21
|
*
|
|
22
22
|
* _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
|
|
23
23
|
*
|
|
@@ -28,7 +28,7 @@ declare function rgbToHsl(rgb: RGBAColor | RGBColor): HSLColor;
|
|
|
28
28
|
/**
|
|
29
29
|
* Convert an _RGB(A)_ color to an _HSLA_ color
|
|
30
30
|
*
|
|
31
|
-
* _If the value is unable to be converted, a black _HSLA_ color
|
|
31
|
+
* _If the value is unable to be converted, a black _HSLA_ color will be returned_
|
|
32
32
|
*
|
|
33
33
|
* _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
|
|
34
34
|
*
|
|
@@ -36,5 +36,26 @@ declare function rgbToHsl(rgb: RGBAColor | RGBColor): HSLColor;
|
|
|
36
36
|
* @returns _HSLA_ color
|
|
37
37
|
*/
|
|
38
38
|
declare function rgbToHsla(rgb: RGBAColor | RGBColor): HSLAColor;
|
|
39
|
+
/**
|
|
40
|
+
* Convert an _RGB(A)_ color to an _HWB_ color
|
|
41
|
+
*
|
|
42
|
+
* _If the value is unable to be converted, a black _HWB_ color will be returned_
|
|
43
|
+
*
|
|
44
|
+
* _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
|
|
45
|
+
*
|
|
46
|
+
* @param rgb _RGB(A)_ color
|
|
47
|
+
* @returns _HWB_ color
|
|
48
|
+
*/
|
|
49
|
+
declare function rgbToHwb(rgb: RGBAColor | RGBColor): HWBColor;
|
|
50
|
+
/**
|
|
51
|
+
* Convert an _RGB(A)_ color to an _HWBA_ color
|
|
52
|
+
* _If the value is unable to be converted, a black _HWBA_ color will be returned_
|
|
53
|
+
*
|
|
54
|
+
* _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
|
|
55
|
+
*
|
|
56
|
+
* @param rgb _RGB(A)_ color
|
|
57
|
+
* @returns _HWBA_ color
|
|
58
|
+
*/
|
|
59
|
+
declare function rgbToHwba(rgb: RGBAColor | RGBColor): HWBAColor;
|
|
39
60
|
//#endregion
|
|
40
|
-
export { convertRgbToHex, convertRgbToHsla, getRgbValue, rgbToHex, rgbToHsl, rgbToHsla };
|
|
61
|
+
export { convertRgbToHex, convertRgbToHsla, convertRgbToHwba, getRgbValue, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba };
|
package/dist/color/space/rgb.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { join } from "../../internal/string.mjs";
|
|
2
2
|
import { DEFAULT_RGB } from "../constants.mjs";
|
|
3
3
|
import { getAlpha, getAlphaValue } from "../misc/alpha.mjs";
|
|
4
|
-
import { isRgbLike } from "../misc/is.mjs";
|
|
5
4
|
import { getHexValue } from "../misc/get.mjs";
|
|
5
|
+
import { isRgbLike } from "../misc/is.mjs";
|
|
6
6
|
//#region src/color/space/rgb.ts
|
|
7
7
|
function convertRgbToHex(rgb, alpha) {
|
|
8
8
|
const hex = `${join([
|
|
@@ -18,38 +18,46 @@ function convertRgbToHex(rgb, alpha) {
|
|
|
18
18
|
return `${hex}${a}`;
|
|
19
19
|
}
|
|
20
20
|
function convertRgbToHsla(value) {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const red = rgb.red / 255;
|
|
25
|
-
const maxHex = Math.max(blue, green, red);
|
|
26
|
-
const minHex = Math.min(blue, green, red);
|
|
27
|
-
const delta = maxHex - minHex;
|
|
28
|
-
const lightness = (minHex + maxHex) / 2;
|
|
21
|
+
const values = getRgbValues(isRgbLike(value) ? getRgbValue(value) : { ...DEFAULT_RGB });
|
|
22
|
+
const { delta, max, min } = values;
|
|
23
|
+
const lightness = (min + max) / 2;
|
|
29
24
|
let hue = 0;
|
|
30
25
|
let saturation = 0;
|
|
31
26
|
if (delta !== 0) {
|
|
32
|
-
saturation = (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
saturation = (max - lightness) / Math.min(lightness, 1 - lightness);
|
|
28
|
+
hue = getRgbHue(values);
|
|
29
|
+
hue *= 60;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
hue,
|
|
33
|
+
saturation: saturation * 100,
|
|
34
|
+
lightness: lightness * 100,
|
|
35
|
+
alpha: getAlphaValue(value?.alpha ?? 100)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function convertRgbToHwba(value) {
|
|
39
|
+
const values = getRgbValues(isRgbLike(value) ? getRgbValue(value) : { ...DEFAULT_RGB });
|
|
40
|
+
const { delta, max, min } = values;
|
|
41
|
+
let hue = 0;
|
|
42
|
+
if (delta !== 0) {
|
|
43
|
+
hue = getRgbHue(values);
|
|
44
44
|
hue *= 60;
|
|
45
45
|
}
|
|
46
46
|
return {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
hue,
|
|
48
|
+
whiteness: min * 100,
|
|
49
|
+
blackness: (1 - max) * 100,
|
|
50
|
+
alpha: getAlphaValue(value?.alpha ?? 100)
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
+
function getRgbHue(values) {
|
|
54
|
+
const { blue, delta, green, max, red } = values;
|
|
55
|
+
switch (max) {
|
|
56
|
+
case blue: return (red - green) / delta + 4;
|
|
57
|
+
case green: return (blue - red) / delta + 2;
|
|
58
|
+
default: return (green - blue) / delta + (green < blue ? 6 : 0);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
53
61
|
function getRgbValue(value) {
|
|
54
62
|
return {
|
|
55
63
|
blue: getHexValue(value.blue),
|
|
@@ -57,6 +65,21 @@ function getRgbValue(value) {
|
|
|
57
65
|
red: getHexValue(value.red)
|
|
58
66
|
};
|
|
59
67
|
}
|
|
68
|
+
function getRgbValues(rgb) {
|
|
69
|
+
const blue = rgb.blue / 255;
|
|
70
|
+
const green = rgb.green / 255;
|
|
71
|
+
const red = rgb.red / 255;
|
|
72
|
+
const max = Math.max(blue, green, red);
|
|
73
|
+
const min = Math.min(blue, green, red);
|
|
74
|
+
return {
|
|
75
|
+
blue,
|
|
76
|
+
delta: max - min,
|
|
77
|
+
green,
|
|
78
|
+
max,
|
|
79
|
+
min,
|
|
80
|
+
red
|
|
81
|
+
};
|
|
82
|
+
}
|
|
60
83
|
/**
|
|
61
84
|
* Convert an _RGB(A)_ color to a hex color _(with optional alpha channel, i.e., opacity)_
|
|
62
85
|
*
|
|
@@ -72,7 +95,7 @@ function rgbToHex(rgb, alpha) {
|
|
|
72
95
|
/**
|
|
73
96
|
* Convert an _RGB(A)_ color to an _HSL_ color
|
|
74
97
|
*
|
|
75
|
-
* _If the value is unable to be converted, a black
|
|
98
|
+
* _If the value is unable to be converted, a black _HSL_ color will be returned_
|
|
76
99
|
*
|
|
77
100
|
* _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
|
|
78
101
|
*
|
|
@@ -90,7 +113,7 @@ function rgbToHsl(rgb) {
|
|
|
90
113
|
/**
|
|
91
114
|
* Convert an _RGB(A)_ color to an _HSLA_ color
|
|
92
115
|
*
|
|
93
|
-
* _If the value is unable to be converted, a black _HSLA_ color
|
|
116
|
+
* _If the value is unable to be converted, a black _HSLA_ color will be returned_
|
|
94
117
|
*
|
|
95
118
|
* _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
|
|
96
119
|
*
|
|
@@ -100,5 +123,36 @@ function rgbToHsl(rgb) {
|
|
|
100
123
|
function rgbToHsla(rgb) {
|
|
101
124
|
return convertRgbToHsla(rgb);
|
|
102
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Convert an _RGB(A)_ color to an _HWB_ color
|
|
128
|
+
*
|
|
129
|
+
* _If the value is unable to be converted, a black _HWB_ color will be returned_
|
|
130
|
+
*
|
|
131
|
+
* _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
|
|
132
|
+
*
|
|
133
|
+
* @param rgb _RGB(A)_ color
|
|
134
|
+
* @returns _HWB_ color
|
|
135
|
+
*/
|
|
136
|
+
function rgbToHwb(rgb) {
|
|
137
|
+
const { blackness, hue, whiteness } = convertRgbToHwba(rgb);
|
|
138
|
+
return {
|
|
139
|
+
hue,
|
|
140
|
+
whiteness,
|
|
141
|
+
blackness
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Convert an _RGB(A)_ color to an _HWBA_ color
|
|
146
|
+
|
|
147
|
+
* _If the value is unable to be converted, a black _HWBA_ color will be returned_
|
|
148
|
+
*
|
|
149
|
+
* _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
|
|
150
|
+
*
|
|
151
|
+
* @param rgb _RGB(A)_ color
|
|
152
|
+
* @returns _HWBA_ color
|
|
153
|
+
*/
|
|
154
|
+
function rgbToHwba(rgb) {
|
|
155
|
+
return convertRgbToHwba(rgb);
|
|
156
|
+
}
|
|
103
157
|
//#endregion
|
|
104
|
-
export { convertRgbToHex, convertRgbToHsla, getRgbValue, rgbToHex, rgbToHsl, rgbToHsla };
|
|
158
|
+
export { convertRgbToHex, convertRgbToHsla, convertRgbToHwba, getRgbValue, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Constructor, NestedKeys, NestedValue, PlainObject } from "../models.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/function/assert.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Asserter for a property of a value
|
|
@@ -9,7 +8,7 @@ type AssertProperty<Value extends PlainObject, Path extends NestedKeys<Value>, A
|
|
|
9
8
|
* A function that asserts a value is of a specific type, throwing an error if it is not
|
|
10
9
|
*/
|
|
11
10
|
type Asserter<Value> = (value: unknown) => asserts value is Value;
|
|
12
|
-
type NestedPick<Value, Path extends string> = Value extends PlainObject ? Path extends `${infer Head}.${infer Rest}` ? Head extends keyof Value ? { [Key in Head]: NestedPick<Value[Key], Rest
|
|
11
|
+
type NestedPick<Value, Path extends string> = Value extends PlainObject ? Path extends `${infer Head}.${infer Rest}` ? Head extends keyof Value ? { [Key in Head]: NestedPick<Value[Key], Rest>; } : never : Path extends keyof Value ? { [Key in Path]: Value[Key]; } : never : never;
|
|
13
12
|
/**
|
|
14
13
|
* Asserts that a condition is true, throwing an error if it is not
|
|
15
14
|
*
|
package/dist/function/once.d.mts
CHANGED
package/dist/function/work.d.mts
CHANGED