@thi.ng/color 5.6.24 → 5.6.26
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/color-range.d.ts +2 -0
- package/color.d.ts +2 -0
- package/cosine-gradients.d.ts +3 -1
- package/gradients.d.ts +7 -3
- package/mix.d.ts +1 -0
- package/package.json +13 -13
- package/sort.d.ts +12 -8
package/CHANGELOG.md
CHANGED
package/color-range.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export declare function colorsFromRange(range: ColorRange | keyof typeof COLOR_R
|
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* ```ts
|
|
58
|
+
* import { colorsFromTheme } from "@thi.ng/color";
|
|
59
|
+
*
|
|
58
60
|
* [...colorsFromTheme(
|
|
59
61
|
* [["cool", "aliceblue"], ["bright", "orange", 0.25], ["hotpink", 0.1]],
|
|
60
62
|
* { num: 10 }
|
package/color.d.ts
CHANGED
package/cosine-gradients.d.ts
CHANGED
|
@@ -67,12 +67,14 @@ export declare const cosineCoeffs: FnU2<ReadonlyColor, CosGradientSpec>;
|
|
|
67
67
|
*
|
|
68
68
|
* @example
|
|
69
69
|
* ```ts
|
|
70
|
+
* import { multiCosineGradient, srgb } from "@thi.ng/color";
|
|
71
|
+
*
|
|
70
72
|
* multiCosineGradient({
|
|
71
73
|
* num: 10,
|
|
72
74
|
* // gradient stops (normalized positions)
|
|
73
75
|
* stops: [[0.1, [1, 0, 0, 1]], [0.5, [0, 1, 0, 1]], [0.9, [0, 0, 1, 1]]],
|
|
74
76
|
* // optional color transform/coercion
|
|
75
|
-
* tx:
|
|
77
|
+
* tx: srgb
|
|
76
78
|
* })
|
|
77
79
|
* ```
|
|
78
80
|
*
|
package/gradients.d.ts
CHANGED
|
@@ -14,9 +14,13 @@ import type { GradientOpts } from "./api/gradients.js";
|
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
|
+
* import { lch, multiColorGradient, swatchesH } from "@thi.ng/color";
|
|
18
|
+
* import { serialize } from "@thi.ng/hiccup";
|
|
19
|
+
* import { svg } from "@thi.ng/hiccup-svg";
|
|
20
|
+
*
|
|
17
21
|
* gradient = multiColorGradient({
|
|
18
22
|
* num: 100,
|
|
19
|
-
* //
|
|
23
|
+
* // LCH color stops
|
|
20
24
|
* stops: [
|
|
21
25
|
* // pink red
|
|
22
26
|
* [0, lch(0.8, 0.8, 0)],
|
|
@@ -31,10 +35,10 @@ import type { GradientOpts } from "./api/gradients.js";
|
|
|
31
35
|
*
|
|
32
36
|
* // write gradient as SVG swatches
|
|
33
37
|
* writeFileSync(
|
|
34
|
-
* `
|
|
38
|
+
* `lch-multigradient.svg`,
|
|
35
39
|
* serialize(
|
|
36
40
|
* svg(
|
|
37
|
-
* { width: 500, height: 50,
|
|
41
|
+
* { width: 500, height: 50, __convert: true },
|
|
38
42
|
* swatchesH(gradient, 5, 50)
|
|
39
43
|
* )
|
|
40
44
|
* )
|
package/mix.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/color",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.26",
|
|
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",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"tool:swatches": "bun tools/index.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.9.
|
|
43
|
-
"@thi.ng/arrays": "^2.8.
|
|
44
|
-
"@thi.ng/binary": "^3.4.
|
|
42
|
+
"@thi.ng/api": "^8.9.26",
|
|
43
|
+
"@thi.ng/arrays": "^2.8.3",
|
|
44
|
+
"@thi.ng/binary": "^3.4.15",
|
|
45
45
|
"@thi.ng/checks": "^3.5.0",
|
|
46
|
-
"@thi.ng/compare": "^2.2.
|
|
47
|
-
"@thi.ng/compose": "^2.1.
|
|
48
|
-
"@thi.ng/defmulti": "^3.0.
|
|
46
|
+
"@thi.ng/compare": "^2.2.22",
|
|
47
|
+
"@thi.ng/compose": "^2.1.65",
|
|
48
|
+
"@thi.ng/defmulti": "^3.0.26",
|
|
49
49
|
"@thi.ng/errors": "^2.4.18",
|
|
50
|
-
"@thi.ng/math": "^5.10.
|
|
51
|
-
"@thi.ng/random": "^3.6.
|
|
52
|
-
"@thi.ng/strings": "^3.7.
|
|
53
|
-
"@thi.ng/transducers": "^8.9.
|
|
54
|
-
"@thi.ng/vectors": "^7.10.
|
|
50
|
+
"@thi.ng/math": "^5.10.3",
|
|
51
|
+
"@thi.ng/random": "^3.6.33",
|
|
52
|
+
"@thi.ng/strings": "^3.7.18",
|
|
53
|
+
"@thi.ng/transducers": "^8.9.7",
|
|
54
|
+
"@thi.ng/vectors": "^7.10.13"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@microsoft/api-extractor": "^7.40.1",
|
|
@@ -445,5 +445,5 @@
|
|
|
445
445
|
"vectors"
|
|
446
446
|
]
|
|
447
447
|
},
|
|
448
|
-
"gitHead": "
|
|
448
|
+
"gitHead": "190d68e7f7524631b333cfdbf32c6a23be27c166\n"
|
|
449
449
|
}
|
package/sort.d.ts
CHANGED
|
@@ -29,30 +29,34 @@ export declare const sort: <T extends import("@thi.ng/vectors").ReadonlyVec>(col
|
|
|
29
29
|
* memory.
|
|
30
30
|
*
|
|
31
31
|
* ```ts
|
|
32
|
+
* import { css, luminanceSrgb, sortMapped, srgb } from "@thi.ng/color";
|
|
33
|
+
*
|
|
32
34
|
* // memory buffer of 4 sRGB colors
|
|
33
|
-
* const buf = new Float32Array([
|
|
35
|
+
* const buf = new Float32Array([
|
|
36
|
+
* 0, 1, 0, 1, 0, 0.5, 0, 1, 0, 0.25, 0, 1, 0, 0.75, 0, 1,
|
|
37
|
+
* ]);
|
|
34
38
|
*
|
|
35
39
|
* // map buffer (creates 4 SRGB instances linked to the buffer)
|
|
36
40
|
* const pix = srgb.mapBuffer(buf);
|
|
37
41
|
*
|
|
38
42
|
* // display original order
|
|
39
|
-
* pix.map(css);
|
|
43
|
+
* console.log(pix.map((x) => css(x)));
|
|
40
44
|
* // [ '#00ff00', '#008000', '#004000', '#00bf00' ]
|
|
41
45
|
*
|
|
42
46
|
* // sort colors (buffer!) by luminance
|
|
43
47
|
* sortMapped(pix, luminanceSrgb);
|
|
44
48
|
*
|
|
45
49
|
* // new order
|
|
46
|
-
* pix.map(css);
|
|
50
|
+
* console.log(pix.map((x) => css(x)));
|
|
47
51
|
* // [ '#004000', '#008000', '#00bf00', '#00ff00' ]
|
|
48
52
|
*
|
|
49
53
|
* // buffer contents have been re-ordered
|
|
50
|
-
* buf
|
|
54
|
+
* console.log(buf);
|
|
51
55
|
* // Float32Array(16) [
|
|
52
|
-
* // 0, 0.25, 0, 1,
|
|
53
|
-
* //
|
|
54
|
-
* // 0,
|
|
55
|
-
* // 1
|
|
56
|
+
* // 0, 0.25, 0, 1,
|
|
57
|
+
* // 0, 0.5, 0, 1,
|
|
58
|
+
* // 0, 0.75, 0, 1,
|
|
59
|
+
* // 0, 1, 0, 1
|
|
56
60
|
* // ]
|
|
57
61
|
* ```
|
|
58
62
|
*
|