@thi.ng/color 5.6.31 → 5.6.33

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-03-09T13:46:38Z
3
+ - **Last updated**: 2024-03-13T14:04:31Z
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
@@ -54,13 +54,15 @@ export declare function colorsFromRange(range: ColorRange | keyof typeof COLOR_R
54
54
  * is 1.0.
55
55
  *
56
56
  * @example
57
- * ```ts
57
+ * ```ts tangle:../export/colors-from-theme.ts
58
58
  * import { colorsFromTheme } from "@thi.ng/color";
59
59
  *
60
- * [...colorsFromTheme(
61
- * [["cool", "aliceblue"], ["bright", "orange", 0.25], ["hotpink", 0.1]],
62
- * { num: 10 }
63
- * )]
60
+ * console.log(
61
+ * [...colorsFromTheme(
62
+ * [["cool", "aliceblue"], ["bright", "orange", 0.25], ["hotpink", 0.1]],
63
+ * { num: 10 }
64
+ * )]
65
+ * );
64
66
  * ```
65
67
  *
66
68
  * @param parts -
package/color.d.ts CHANGED
@@ -5,19 +5,19 @@ import type { Color, ColorMode, ParsedColor, TypedColor } from "./api.js";
5
5
  * for it (potentially by first parsing the color).
6
6
  *
7
7
  * @example
8
- * ```ts
8
+ * ```ts tangle:../export/color.ts
9
9
  * import { color } from "@thi.ng/color";
10
10
  *
11
- * color("springgreen");
11
+ * console.log(color("springgreen"));
12
12
  * // $Color [srgb] { offset: 0, stride: 1, buf: [ 0, 1, 0.498, 1 ] }
13
13
  *
14
- * color("#ff0")
14
+ * console.log(color("#ff0"));
15
15
  * // $Color [srgb] { offset: 0, stride: 1, buf: [ 1, 1, 0, 1 ] }
16
16
  *
17
- * color("oklch(60% 0.15 50)");
17
+ * console.log(color("oklch(60% 0.15 50)"));
18
18
  * // $Color [oklch] { offset: 0, stride: 1, buf: [ 0.6, 0.0015, 0.139, 1 ] }
19
19
  *
20
- * color("hsv", [0.5, 1, 1, 1])
20
+ * console.log(color("hsv", [0.5, 1, 1, 1]));
21
21
  * // $Color [hsv] { offset: 0, stride: 1, buf: [ 0.5, 1, 1, 1 ] }
22
22
  * ```
23
23
  *
@@ -66,7 +66,7 @@ export declare const cosineCoeffs: FnU2<ReadonlyColor, CosGradientSpec>;
66
66
  * [`tween()`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
67
67
  *
68
68
  * @example
69
- * ```ts
69
+ * ```ts tangle:../export/cosine-gradient.ts
70
70
  * import { multiCosineGradient, srgb } from "@thi.ng/color";
71
71
  *
72
72
  * multiCosineGradient({
package/gradients.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { GradientOpts } from "./api/gradients.js";
4
4
  /**
5
5
  * Similar to {@link multiCosineGradient}, but using any number of gradient
6
6
  * color stops and isn't limited to RGB, but for arbitrary color types. The
7
- * optional `isABGR` boolean arg can be used to autoconvert resulting colors
7
+ * optional `isABGR` boolean arg can be used to auto-convert resulting colors
8
8
  * into packed ARGB (false) or ABGR (true) integers. If that arg is given, an
9
9
  * array of numbers will be returned.
10
10
  *
@@ -13,12 +13,13 @@ import type { GradientOpts } from "./api/gradients.js";
13
13
  * [`tween()`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
14
14
  *
15
15
  * @example
16
- * ```ts
16
+ * ```ts tangle:../export/multi-color-gradient.ts
17
17
  * import { lch, multiColorGradient, swatchesH } from "@thi.ng/color";
18
18
  * import { serialize } from "@thi.ng/hiccup";
19
19
  * import { svg } from "@thi.ng/hiccup-svg";
20
+ * import { writeFileSync } from "node:fs";
20
21
  *
21
- * gradient = multiColorGradient({
22
+ * const gradient = multiColorGradient({
22
23
  * num: 100,
23
24
  * // LCH color stops
24
25
  * stops: [
package/mix.d.ts CHANGED
@@ -54,14 +54,18 @@ export declare const mixNNNN: ColorMixFn;
54
54
  * functions to create non-linear interpolations. For example:
55
55
  *
56
56
  * @example
57
- * ```ts
57
+ * ```ts tangle:../export/mix.ts
58
58
  * import { mix, rgb, RED, GREEN } from "@thi.ng/color";
59
59
  * import { circular } from "@thi.ng/math";
60
60
  *
61
- * mix([], rgb("#f00"), rgb("#0f0"), 0.5);
61
+ * console.log(
62
+ * mix([], rgb("#f00"), rgb("#0f0"), 0.5)
63
+ * );
62
64
  * // [ 0.5, 0.5, 0, 1 ]
63
65
  *
64
- * mix([], RED, GREEN, circular(0.5));
66
+ * console.log(
67
+ * mix([], rgb(RED), rgb(GREEN), circular(0.5))
68
+ * );
65
69
  * // [ 0.1339745962155614, 0.8660254037844386, 0, 1 ]
66
70
  * ```
67
71
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/color",
3
- "version": "5.6.31",
3
+ "version": "5.6.33",
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",
@@ -40,26 +40,26 @@
40
40
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@thi.ng/api": "^8.9.29",
44
- "@thi.ng/arrays": "^2.8.7",
45
- "@thi.ng/binary": "^3.4.18",
46
- "@thi.ng/checks": "^3.5.2",
47
- "@thi.ng/compare": "^2.2.25",
48
- "@thi.ng/compose": "^2.1.68",
49
- "@thi.ng/defmulti": "^3.0.30",
50
- "@thi.ng/errors": "^2.4.20",
51
- "@thi.ng/math": "^5.10.6",
52
- "@thi.ng/random": "^3.6.36",
53
- "@thi.ng/strings": "^3.7.22",
54
- "@thi.ng/transducers": "^8.9.11",
55
- "@thi.ng/vectors": "^7.10.17"
43
+ "@thi.ng/api": "^8.9.30",
44
+ "@thi.ng/arrays": "^2.8.9",
45
+ "@thi.ng/binary": "^3.4.19",
46
+ "@thi.ng/checks": "^3.5.3",
47
+ "@thi.ng/compare": "^2.2.26",
48
+ "@thi.ng/compose": "^2.1.70",
49
+ "@thi.ng/defmulti": "^3.0.32",
50
+ "@thi.ng/errors": "^2.5.1",
51
+ "@thi.ng/math": "^5.10.7",
52
+ "@thi.ng/random": "^3.6.38",
53
+ "@thi.ng/strings": "^3.7.24",
54
+ "@thi.ng/transducers": "^8.9.13",
55
+ "@thi.ng/vectors": "^7.10.19"
56
56
  },
57
57
  "devDependencies": {
58
- "@microsoft/api-extractor": "^7.40.1",
59
- "esbuild": "^0.20.0",
58
+ "@microsoft/api-extractor": "^7.42.3",
59
+ "esbuild": "^0.20.1",
60
60
  "rimraf": "^5.0.5",
61
- "typedoc": "^0.25.7",
62
- "typescript": "^5.3.3"
61
+ "typedoc": "^0.25.12",
62
+ "typescript": "^5.4.2"
63
63
  },
64
64
  "keywords": [
65
65
  "color",
@@ -446,5 +446,5 @@
446
446
  "vectors"
447
447
  ]
448
448
  },
449
- "gitHead": "0d3bacf526db92363b43e81356e8cef18368272a\n"
449
+ "gitHead": "bc0f3cb07d6f1cab6dbdc5ff57428f5484e711bb\n"
450
450
  }
package/sort.d.ts CHANGED
@@ -21,14 +21,14 @@ export declare const proximity: (target: ReadonlyColor, dist?: ColorDistance) =>
21
21
  * @param dist -
22
22
  */
23
23
  export declare const proximityABGR32: (target: ReadonlyColor, dist?: ColorDistance) => (col: ReadonlyColor) => number;
24
- export declare const sort: <T extends import("@thi.ng/vectors").ReadonlyVec>(colors: T[], key: Fn<ReadonlyColor, number>, isReverse?: boolean) => T[];
24
+ export declare const sort: <T extends import("@thi.ng/vectors/api").ReadonlyVec>(colors: T[], key: Fn<ReadonlyColor, number>, isReverse?: boolean) => T[];
25
25
  /**
26
26
  * Similar to {@link sort}, but only for memory mapped colors (e.g. mapping a
27
27
  * pixel buffer). Does NOT change the order of elements in given `colors` array,
28
28
  * BUT sorts the **apparent** order by swapping the contents of the backing
29
29
  * memory.
30
30
  *
31
- * ```ts
31
+ * ```ts tangle:../export/sort-mapped.ts
32
32
  * import { css, luminanceSrgb, sortMapped, srgb } from "@thi.ng/color";
33
33
  *
34
34
  * // memory buffer of 4 sRGB colors
@@ -65,5 +65,5 @@ export declare const sort: <T extends import("@thi.ng/vectors").ReadonlyVec>(col
65
65
  * @param isReverse -
66
66
  */
67
67
  export declare const sortMapped: <T extends TypedColor<any>>(colors: T[], key: Fn<ReadonlyColor, number>, isReverse?: boolean) => T[];
68
- export declare const mostSimilar: <T extends import("@thi.ng/vectors").ReadonlyVec>(colors: T[], key: Fn<ReadonlyColor, number>) => T;
68
+ export declare const mostSimilar: <T extends import("@thi.ng/vectors/api").ReadonlyVec>(colors: T[], key: Fn<ReadonlyColor, number>) => T;
69
69
  //# sourceMappingURL=sort.d.ts.map
package/transform.d.ts CHANGED
@@ -10,7 +10,7 @@ import type { ColorMatrix, ReadonlyColor } from "./api.js";
10
10
  * @param src - source color
11
11
  * @param clampOut - true, if result should be clamped to [0..1]
12
12
  */
13
- export declare const transform: (out: import("@thi.ng/vectors").Vec | null, mat: ColorMatrix, src: import("@thi.ng/vectors").ReadonlyVec, clampOut?: boolean) => import("@thi.ng/vectors").Vec;
13
+ export declare const transform: (out: import("@thi.ng/vectors").Vec | null, mat: ColorMatrix, src: import("@thi.ng/vectors/api").ReadonlyVec, clampOut?: boolean) => import("@thi.ng/vectors").Vec;
14
14
  /**
15
15
  * Concatenates given color matrices by pairwise multiplying them in
16
16
  * left-right order. Returns combined result matrix to be used with