@thi.ng/color 5.2.13 → 5.2.15
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/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/analog.d.ts +9 -3
- package/analog.js +9 -3
- package/api/ranges.d.ts +2 -1
- package/cosine-gradients.d.ts +2 -1
- package/cosine-gradients.js +2 -1
- package/gradients.d.ts +2 -1
- package/linear.d.ts +2 -2
- package/linear.js +2 -2
- package/mix.d.ts +2 -2
- package/mix.js +2 -2
- package/package.json +16 -16
- package/rgb/kelvin-rgba.d.ts +3 -2
- package/rgb/kelvin-rgba.js +3 -2
- package/rgb/rgb-hcv.d.ts +1 -1
- package/rgb/rgb-hcv.js +1 -1
- package/rgb/rgb-hcy.d.ts +1 -1
- package/rgb/rgb-hcy.js +1 -1
- package/rgb/rgb-xyz.d.ts +1 -1
- package/rgb/rgb-xyz.js +1 -1
- package/xyz/xyz-rgb.d.ts +1 -1
- package/xyz/xyz-rgb.js +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ For the Clojure version, please visit: [thi.ng/color-clj](https://thi.ng/color-c
|
|
|
34
34
|
|
|
35
35
|
## About
|
|
36
36
|
|
|
37
|
-
Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets
|
|
37
|
+
Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets.
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
package/analog.d.ts
CHANGED
|
@@ -5,13 +5,17 @@ export declare const defAnalog: FnU3<Fn3<number, number, IRandom, number>, Fn4<C
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns a random analog color based on given `src` color and variance
|
|
7
7
|
* `delta`. Each channel will be randomized by +/- `delta`, optionally using
|
|
8
|
-
* provided
|
|
8
|
+
* provided
|
|
9
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
10
|
+
* PRNG.
|
|
9
11
|
*/
|
|
10
12
|
export declare const analog: import("@thi.ng/defmulti").MultiFn4<import("@thi.ng/vectors").Vec | null, TypedColor<any>, number, IRandom | undefined, import("@thi.ng/vectors").Vec>;
|
|
11
13
|
/**
|
|
12
14
|
* Similar to {@link analogRGB}. Returns an analog color based on given HSVA
|
|
13
15
|
* color, with each channel randomly varied by given channel-specific delta
|
|
14
|
-
* amounts (and optionally given
|
|
16
|
+
* amounts (and optionally given
|
|
17
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
18
|
+
* PRNG).
|
|
15
19
|
*
|
|
16
20
|
* @remarks
|
|
17
21
|
* This function provides more user control than {@link analog}, but the latter
|
|
@@ -32,7 +36,9 @@ export declare const analogHsv: (out: Color | null, src: ReadonlyColor, deltaH:
|
|
|
32
36
|
/**
|
|
33
37
|
* Similar to {@link analogHSV}. Returns an analog color based on given RGBA
|
|
34
38
|
* color, with each channel randomly varied by given delta amounts (and
|
|
35
|
-
* optionally given
|
|
39
|
+
* optionally given
|
|
40
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
41
|
+
* PRNG).
|
|
36
42
|
*
|
|
37
43
|
* @remarks
|
|
38
44
|
* By default the green and blue channel variance will be the same as `deltaR`.
|
package/analog.js
CHANGED
|
@@ -25,7 +25,9 @@ const analogNUU = defAnalog(analogN, analogU, analogU);
|
|
|
25
25
|
/**
|
|
26
26
|
* Returns a random analog color based on given `src` color and variance
|
|
27
27
|
* `delta`. Each channel will be randomized by +/- `delta`, optionally using
|
|
28
|
-
* provided
|
|
28
|
+
* provided
|
|
29
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
30
|
+
* PRNG.
|
|
29
31
|
*/
|
|
30
32
|
export const analog = defmulti(__dispatch1, {}, {
|
|
31
33
|
hcy: analogHNN,
|
|
@@ -41,7 +43,9 @@ export const analog = defmulti(__dispatch1, {}, {
|
|
|
41
43
|
/**
|
|
42
44
|
* Similar to {@link analogRGB}. Returns an analog color based on given HSVA
|
|
43
45
|
* color, with each channel randomly varied by given channel-specific delta
|
|
44
|
-
* amounts (and optionally given
|
|
46
|
+
* amounts (and optionally given
|
|
47
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
48
|
+
* PRNG).
|
|
45
49
|
*
|
|
46
50
|
* @remarks
|
|
47
51
|
* This function provides more user control than {@link analog}, but the latter
|
|
@@ -62,7 +66,9 @@ export const analogHsv = (out, src, deltaH, deltaS = 0, deltaV = 0, deltaA = 0,
|
|
|
62
66
|
/**
|
|
63
67
|
* Similar to {@link analogHSV}. Returns an analog color based on given RGBA
|
|
64
68
|
* color, with each channel randomly varied by given delta amounts (and
|
|
65
|
-
* optionally given
|
|
69
|
+
* optionally given
|
|
70
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
71
|
+
* PRNG).
|
|
66
72
|
*
|
|
67
73
|
* @remarks
|
|
68
74
|
* By default the green and blue channel variance will be the same as `deltaR`.
|
package/api/ranges.d.ts
CHANGED
|
@@ -58,7 +58,8 @@ export interface ColorRangeOpts {
|
|
|
58
58
|
/**
|
|
59
59
|
* PRNG instance to use for randomized values
|
|
60
60
|
*
|
|
61
|
-
* @defaultValue
|
|
61
|
+
* @defaultValue
|
|
62
|
+
* [`SYSTEM`](https://docs.thi.ng/umbrella/random/variables/SYSTEM.html)
|
|
62
63
|
*/
|
|
63
64
|
rnd: IRandom;
|
|
64
65
|
}
|
package/cosine-gradients.d.ts
CHANGED
|
@@ -62,7 +62,8 @@ export declare const cosineCoeffs: FnU2<ReadonlyColor, CosGradientSpec>;
|
|
|
62
62
|
* an array of `n+1` linear RGBA color samples.
|
|
63
63
|
*
|
|
64
64
|
* @remarks
|
|
65
|
-
*
|
|
65
|
+
* See
|
|
66
|
+
* [`tween()`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
|
|
66
67
|
*
|
|
67
68
|
* @example
|
|
68
69
|
* ```ts
|
package/cosine-gradients.js
CHANGED
|
@@ -223,7 +223,8 @@ export const cosineCoeffs = (from, to) => {
|
|
|
223
223
|
* an array of `n+1` linear RGBA color samples.
|
|
224
224
|
*
|
|
225
225
|
* @remarks
|
|
226
|
-
*
|
|
226
|
+
* See
|
|
227
|
+
* [`tween()`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
|
|
227
228
|
*
|
|
228
229
|
* @example
|
|
229
230
|
* ```ts
|
package/gradients.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ import type { GradientOpts } from "./api/gradients.js";
|
|
|
9
9
|
* array of numbers will be returned.
|
|
10
10
|
*
|
|
11
11
|
* @remarks
|
|
12
|
-
*
|
|
12
|
+
* See
|
|
13
|
+
* [`tween()`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
15
16
|
* ```ts
|
package/linear.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Maps a single linear RGB channel value to sRGB.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* https://en.wikipedia.org/wiki/SRGB
|
|
5
5
|
*
|
|
6
6
|
* @param x - channel value
|
|
7
7
|
*/
|
|
@@ -9,7 +9,7 @@ export declare const linearSrgb: (x: number) => number;
|
|
|
9
9
|
/**
|
|
10
10
|
* Maps a single linear sRGB channel value to linear RGB.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* https://en.wikipedia.org/wiki/SRGB
|
|
13
13
|
*
|
|
14
14
|
* @param x - channel value
|
|
15
15
|
*/
|
package/linear.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Maps a single linear RGB channel value to sRGB.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* https://en.wikipedia.org/wiki/SRGB
|
|
5
5
|
*
|
|
6
6
|
* @param x - channel value
|
|
7
7
|
*/
|
|
@@ -9,7 +9,7 @@ export const linearSrgb = (x) => x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x
|
|
|
9
9
|
/**
|
|
10
10
|
* Maps a single linear sRGB channel value to linear RGB.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* https://en.wikipedia.org/wiki/SRGB
|
|
13
13
|
*
|
|
14
14
|
* @param x - channel value
|
|
15
15
|
*/
|
package/mix.d.ts
CHANGED
|
@@ -48,8 +48,8 @@ export declare const mixNNNN: ColorMixFn;
|
|
|
48
48
|
* Any hue channel will always be interpolated using the smallest angle
|
|
49
49
|
* difference (using {@link mixH}).
|
|
50
50
|
*
|
|
51
|
-
* The
|
|
52
|
-
* non-linear interpolations. For example:
|
|
51
|
+
* The [thi.ng/math](https://thi.ng/thi.ng/math) package provides various easing
|
|
52
|
+
* functions to create non-linear interpolations. For example:
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
package/mix.js
CHANGED
|
@@ -63,8 +63,8 @@ export const mixNNNN = mixN4;
|
|
|
63
63
|
* Any hue channel will always be interpolated using the smallest angle
|
|
64
64
|
* difference (using {@link mixH}).
|
|
65
65
|
*
|
|
66
|
-
* The
|
|
67
|
-
* non-linear interpolations. For example:
|
|
66
|
+
* The [thi.ng/math](https://thi.ng/thi.ng/math) package provides various easing
|
|
67
|
+
* functions to create non-linear interpolations. For example:
|
|
68
68
|
*
|
|
69
69
|
* @example
|
|
70
70
|
* ```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/color",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.15",
|
|
4
4
|
"description": "Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,23 +36,23 @@
|
|
|
36
36
|
"tool:swatches": "tools:node-esm tools/index.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.6.
|
|
40
|
-
"@thi.ng/arrays": "^2.4.
|
|
41
|
-
"@thi.ng/binary": "^3.3.
|
|
42
|
-
"@thi.ng/checks": "^3.3.
|
|
43
|
-
"@thi.ng/compare": "^2.1.
|
|
44
|
-
"@thi.ng/compose": "^2.1.
|
|
45
|
-
"@thi.ng/defmulti": "^2.1.
|
|
46
|
-
"@thi.ng/errors": "^2.2.
|
|
47
|
-
"@thi.ng/math": "^5.3.
|
|
48
|
-
"@thi.ng/random": "^3.3.
|
|
49
|
-
"@thi.ng/strings": "^3.3.
|
|
50
|
-
"@thi.ng/transducers": "^8.3.
|
|
51
|
-
"@thi.ng/vectors": "^7.5.
|
|
39
|
+
"@thi.ng/api": "^8.6.2",
|
|
40
|
+
"@thi.ng/arrays": "^2.4.7",
|
|
41
|
+
"@thi.ng/binary": "^3.3.15",
|
|
42
|
+
"@thi.ng/checks": "^3.3.6",
|
|
43
|
+
"@thi.ng/compare": "^2.1.21",
|
|
44
|
+
"@thi.ng/compose": "^2.1.23",
|
|
45
|
+
"@thi.ng/defmulti": "^2.1.26",
|
|
46
|
+
"@thi.ng/errors": "^2.2.7",
|
|
47
|
+
"@thi.ng/math": "^5.3.18",
|
|
48
|
+
"@thi.ng/random": "^3.3.20",
|
|
49
|
+
"@thi.ng/strings": "^3.3.22",
|
|
50
|
+
"@thi.ng/transducers": "^8.3.28",
|
|
51
|
+
"@thi.ng/vectors": "^7.5.29"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@microsoft/api-extractor": "^7.33.7",
|
|
55
|
-
"@thi.ng/testament": "^0.3.
|
|
55
|
+
"@thi.ng/testament": "^0.3.8",
|
|
56
56
|
"rimraf": "^3.0.2",
|
|
57
57
|
"tools": "^0.0.1",
|
|
58
58
|
"typedoc": "^0.23.22",
|
|
@@ -424,5 +424,5 @@
|
|
|
424
424
|
"vectors"
|
|
425
425
|
]
|
|
426
426
|
},
|
|
427
|
-
"gitHead": "
|
|
427
|
+
"gitHead": "bc6f7f5e2765bb96fe64db804eaf4b2443b47fc6\n"
|
|
428
428
|
}
|
package/rgb/kelvin-rgba.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SRGB } from "../srgb/srgb.js";
|
|
2
2
|
/**
|
|
3
|
+
* @remarks
|
|
3
4
|
* Based on:
|
|
4
|
-
* -
|
|
5
|
-
* -
|
|
5
|
+
* - https://github.com/neilbartlett/color-temperature/blob/develop/index.js
|
|
6
|
+
* - http://www.zombieprototypes.com/?p=210
|
|
6
7
|
*
|
|
7
8
|
* Uses adjusted coefficients to produce normalized sRGB values.
|
|
8
9
|
*
|
package/rgb/kelvin-rgba.js
CHANGED
|
@@ -14,9 +14,10 @@ const B1 = -0.9990954974165059;
|
|
|
14
14
|
const B2 = 0.0032447435545127036;
|
|
15
15
|
const B3 = 0.453646839257496;
|
|
16
16
|
/**
|
|
17
|
+
* @remarks
|
|
17
18
|
* Based on:
|
|
18
|
-
* -
|
|
19
|
-
* -
|
|
19
|
+
* - https://github.com/neilbartlett/color-temperature/blob/develop/index.js
|
|
20
|
+
* - http://www.zombieprototypes.com/?p=210
|
|
20
21
|
*
|
|
21
22
|
* Uses adjusted coefficients to produce normalized sRGB values.
|
|
22
23
|
*
|
package/rgb/rgb-hcv.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ColorOp } from "../api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Based on:
|
|
4
|
-
*
|
|
4
|
+
* https://github.com/tobspr/GLSL-Color-Spaces/blob/develop/ColorSpaces.inc.glsl#L159
|
|
5
5
|
*
|
|
6
6
|
* @param out - result
|
|
7
7
|
* @param src - source color
|
package/rgb/rgb-hcv.js
CHANGED
|
@@ -4,7 +4,7 @@ import { setC3 } from "@thi.ng/vectors/setc";
|
|
|
4
4
|
import { clamp } from "../clamp.js";
|
|
5
5
|
/**
|
|
6
6
|
* Based on:
|
|
7
|
-
*
|
|
7
|
+
* https://github.com/tobspr/GLSL-Color-Spaces/blob/develop/ColorSpaces.inc.glsl#L159
|
|
8
8
|
*
|
|
9
9
|
* @param out - result
|
|
10
10
|
* @param src - source color
|
package/rgb/rgb-hcy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ColorOp } from "../api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Ported from:
|
|
4
|
-
*
|
|
4
|
+
* https://github.com/tobspr/GLSL-Color-Spaces/blob/develop/ColorSpaces.inc.glsl#L226
|
|
5
5
|
*
|
|
6
6
|
* @param out - result
|
|
7
7
|
* @param src - source color
|
package/rgb/rgb-hcy.js
CHANGED
|
@@ -4,7 +4,7 @@ import { hueRgb } from "./hue-rgb.js";
|
|
|
4
4
|
import { rgbHcv } from "./rgb-hcv.js";
|
|
5
5
|
/**
|
|
6
6
|
* Ported from:
|
|
7
|
-
*
|
|
7
|
+
* https://github.com/tobspr/GLSL-Color-Spaces/blob/develop/ColorSpaces.inc.glsl#L226
|
|
8
8
|
*
|
|
9
9
|
* @param out - result
|
|
10
10
|
* @param src - source color
|
package/rgb/rgb-xyz.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Color, ColorOp, ReadonlyColor } from "../api.js";
|
|
|
3
3
|
* Converts RGB to XYZ using provided transformation matrix (default:
|
|
4
4
|
* {@link RGB_XYZ_D50}).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* https://en.wikipedia.org/wiki/CIE_1931_color_space
|
|
7
7
|
*
|
|
8
8
|
* @param out - result
|
|
9
9
|
* @param src - source color
|
package/rgb/rgb-xyz.js
CHANGED
|
@@ -5,7 +5,7 @@ import { __mulV33 } from "../internal/matrix-ops.js";
|
|
|
5
5
|
* Converts RGB to XYZ using provided transformation matrix (default:
|
|
6
6
|
* {@link RGB_XYZ_D50}).
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* https://en.wikipedia.org/wiki/CIE_1931_color_space
|
|
9
9
|
*
|
|
10
10
|
* @param out - result
|
|
11
11
|
* @param src - source color
|
package/xyz/xyz-rgb.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Color, ColorOp, ReadonlyColor } from "../api.js";
|
|
|
3
3
|
* Converts CIE XYZ to RGB using provided transformation/whitepoint matrix
|
|
4
4
|
* (default: {@link XYZ_RGB_D50}).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* https://en.wikipedia.org/wiki/CIE_1931_color_space
|
|
7
7
|
*
|
|
8
8
|
* @param out - result
|
|
9
9
|
* @param src - source color
|
package/xyz/xyz-rgb.js
CHANGED
|
@@ -4,7 +4,7 @@ import { __mulV33 } from "../internal/matrix-ops.js";
|
|
|
4
4
|
* Converts CIE XYZ to RGB using provided transformation/whitepoint matrix
|
|
5
5
|
* (default: {@link XYZ_RGB_D50}).
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* https://en.wikipedia.org/wiki/CIE_1931_color_space
|
|
8
8
|
*
|
|
9
9
|
* @param out - result
|
|
10
10
|
* @param src - source color
|