@thi.ng/color 5.6.24 → 5.6.25

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-02-23T15:42:39Z
3
+ - **Last updated**: 2024-02-25T14:07:53Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
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
@@ -6,6 +6,8 @@ import type { Color, ColorMode, ParsedColor, TypedColor } from "./api.js";
6
6
  *
7
7
  * @example
8
8
  * ```ts
9
+ * import { color } from "@thi.ng/color";
10
+ *
9
11
  * color("springgreen");
10
12
  * // $Color [srgb] { offset: 0, stride: 1, buf: [ 0, 1, 0.498, 1 ] }
11
13
  *
@@ -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: srgba
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
- * // LAB color stops
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
- * `export/lch-multigradient.svg`,
38
+ * `lch-multigradient.svg`,
35
39
  * serialize(
36
40
  * svg(
37
- * { width: 500, height: 50, convert: true },
41
+ * { width: 500, height: 50, __convert: true },
38
42
  * swatchesH(gradient, 5, 50)
39
43
  * )
40
44
  * )
package/mix.d.ts CHANGED
@@ -55,6 +55,7 @@ export declare const mixNNNN: ColorMixFn;
55
55
  *
56
56
  * @example
57
57
  * ```ts
58
+ * import { mix, rgb, RED, GREEN } from "@thi.ng/color";
58
59
  * import { circular } from "@thi.ng/math";
59
60
  *
60
61
  * mix([], rgb("#f00"), rgb("#0f0"), 0.5);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/color",
3
- "version": "5.6.24",
3
+ "version": "5.6.25",
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.25",
43
- "@thi.ng/arrays": "^2.8.2",
44
- "@thi.ng/binary": "^3.4.14",
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.21",
47
- "@thi.ng/compose": "^2.1.64",
48
- "@thi.ng/defmulti": "^3.0.25",
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.2",
51
- "@thi.ng/random": "^3.6.32",
52
- "@thi.ng/strings": "^3.7.16",
53
- "@thi.ng/transducers": "^8.9.6",
54
- "@thi.ng/vectors": "^7.10.11"
50
+ "@thi.ng/math": "^5.10.3",
51
+ "@thi.ng/random": "^3.6.33",
52
+ "@thi.ng/strings": "^3.7.17",
53
+ "@thi.ng/transducers": "^8.9.7",
54
+ "@thi.ng/vectors": "^7.10.12"
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": "b97641d1d722f79a70ea68243fa95e845dca7a43\n"
448
+ "gitHead": "6e20f80dd9df1c8055ffa3c1e4d6f7598add0c0b\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([0,1,0,1, 0,0.5,0,1, 0,0.25,0,1, 0,0.75,0,1]);
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, 0,
53
- * // 0.5, 0, 1, 0, 0.75,
54
- * // 0, 1, 0, 1, 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
  *