@thi.ng/color 5.7.22 → 5.7.24

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**: 2025-01-29T16:25:48Z
3
+ - **Last updated**: 2025-02-13T16:03:11Z
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/api.d.ts CHANGED
@@ -42,7 +42,7 @@ export interface ChannelSpec {
42
42
  * color spaces to be slightly outside that sRGB gamut. These are soft
43
43
  * limits, for orientation only.
44
44
  *
45
- * @defaultValue [0,1]
45
+ * @defaultValue `[0,1]`
46
46
  */
47
47
  range?: Range;
48
48
  /**
@@ -161,7 +161,7 @@ export interface TypedColor<T> extends IColor, IDeref<Color>, IEqualsDelta<T>, I
161
161
  clamp(): this;
162
162
  /**
163
163
  * Randomizes all color channels based on channel ranges defined for this
164
- * color type (usually [0..1] interval). Alpha channel will remain
164
+ * color type (usually `[0,1]` interval). Alpha channel will remain
165
165
  * untouched.
166
166
  *
167
167
  * @param rnd -
package/clamp.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Color, ReadonlyColor } from "./api.js";
2
2
  /**
3
- * Clamps all color channels to [0,1] interval and calls `ensureAlpha` to ensure
4
- * alpha channel is defined (if missing sets it to `alpha`, default: 1).
3
+ * Clamps all color channels to `[0,1]` interval and calls `ensureAlpha` to
4
+ * ensure alpha channel is defined (if missing sets it to `alpha`, default: 1).
5
5
  *
6
6
  * @remarks
7
7
  * If `out` is null, the resulting color will be written back into `src`.
@@ -17,8 +17,8 @@ import type { Color, ReadonlyColor } from "./api.js";
17
17
  */
18
18
  export declare const clamp: (out: Color | null, src: ReadonlyColor, alpha?: number) => import("@thi.ng/vectors").Vec;
19
19
  /**
20
- * Similar to {@link clamp}, but calls `ensureHue` to fold (instead of
21
- * clamping) the hue into [0,1] interval.
20
+ * Similar to {@link clamp}, but calls `ensureHue` to fold (instead of clamping)
21
+ * the hue into the `[0,1]` interval.
22
22
  *
23
23
  * @remarks
24
24
  * If `out` is null, the resulting color will be written back into `src`.
@@ -13,7 +13,7 @@ import type { CosGradientSpec, CosineGradientOpts, CosineGradientPreset } from "
13
13
  export declare const COSINE_GRADIENTS: Record<CosineGradientPreset, CosGradientSpec>;
14
14
  /**
15
15
  * Computes a single linear RGBA color for given gradient spec and normalized
16
- * position `t` (in [0..1] interval).
16
+ * position `t` (in `[0,1]` interval).
17
17
  *
18
18
  * @param spec -
19
19
  * @param t -
@@ -39,7 +39,7 @@ export declare const cosineGradient: (n: number, spec: CosGradientSpec, tx?: FnU
39
39
  *
40
40
  * @remarks
41
41
  * Intended use case for this function: 1D texturemap/tonemap generation, e.g.
42
- * for dataviz etc. Also @see {@link multiColorGradientBuffer}.
42
+ * for dataviz etc. Also see {@link multiColorGradientBuffer}.
43
43
  *
44
44
  * @param n - number of colors
45
45
  * @param spec - gradient spec
@@ -62,8 +62,7 @@ export declare const cosineCoeffs: FnU2<ReadonlyColor, CosGradientSpec>;
62
62
  * an array of `n+1` linear RGBA color samples.
63
63
  *
64
64
  * @remarks
65
- * See
66
- * [`tween()`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
65
+ * See [`tween`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
67
66
  *
68
67
  * @example
69
68
  * ```ts tangle:../export/cosine-gradient.ts
package/css/css.d.ts CHANGED
@@ -9,7 +9,7 @@ export type CSSConversions = Partial<Record<ColorMode, Fn<any, string>>>;
9
9
  * {@link setDefaultCSSConversions} to change default.
10
10
  *
11
11
  * Reference:
12
- * - https://www.w3.org/TR/css-color-3/
12
+ * https://www.w3.org/TR/css-color-3/
13
13
  */
14
14
  export declare const CSS_LEVEL3: CSSConversions;
15
15
  /**
@@ -20,7 +20,7 @@ export declare const CSS_LEVEL3: CSSConversions;
20
20
  * Use {@link setDefaultCSSConversions} to use as default.
21
21
  *
22
22
  * Reference:
23
- * - https://www.w3.org/TR/css-color-4/
23
+ * https://www.w3.org/TR/css-color-4/
24
24
  */
25
25
  export declare const CSS_LEVEL4: CSSConversions;
26
26
  /**
@@ -9,7 +9,7 @@ import { type IParsedColor } from "../api.js";
9
9
  * The following syntax versions are supported:
10
10
  *
11
11
  * - CSS named colors
12
- * - CSS system colors @see {@link CSS_SYSTEM_COLORS}
12
+ * - CSS system colors, see {@link CSS_SYSTEM_COLORS}
13
13
  * - hex3/4/6/8
14
14
  * - `rgb(r% g% b% / a%?)`
15
15
  * - `rgb(r g b / a?)`
package/distance.d.ts CHANGED
@@ -21,7 +21,8 @@ export declare const distHsv: ColorDistance;
21
21
  * a cyclinder (using Law of Cosines).
22
22
  *
23
23
  * @remarks
24
- * Reference:
24
+ * References:
25
+ *
25
26
  * - https://math.stackexchange.com/a/3612602
26
27
  * - https://en.wikipedia.org/wiki/Law_of_cosines
27
28
  *
@@ -90,6 +91,7 @@ export declare const distRgbBlue: ColorDistance;
90
91
  *
91
92
  * @remarks
92
93
  * References:
94
+ *
93
95
  * - https://en.wikipedia.org/wiki/Color_difference#CIEDE2000
94
96
  * - http://www2.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf
95
97
  *
@@ -109,6 +111,7 @@ export declare const distCIEDE2000: (weights?: ReadonlyVec) => ColorDistance;
109
111
  * `distCMC(a, b) !== distCMC(b, a)`
110
112
  *
111
113
  * References:
114
+ *
112
115
  * - https://en.wikipedia.org/wiki/Color_difference#CMC_l:c_(1984)
113
116
  */
114
117
  export declare const distCMC: (kl?: number, kc?: number) => ColorDistance;
package/gradients.d.ts CHANGED
@@ -9,8 +9,7 @@ import type { GradientOpts } from "./api/gradients.js";
9
9
  * array of numbers will be returned.
10
10
  *
11
11
  * @remarks
12
- * See
13
- * [`tween()`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
12
+ * See [`tween`](https://docs.thi.ng/umbrella/transducers/functions/tween.html)
14
13
  *
15
14
  * @example
16
15
  * ```ts tangle:../export/multi-color-gradient.ts
@@ -56,7 +55,7 @@ export declare function multiColorGradient<T extends TypedColor<any>>(opts: Grad
56
55
  *
57
56
  * @remarks
58
57
  * Intended use case for this function: 1D texturemap/tonemap generation, e.g.
59
- * for dataviz etc. Also @see {@link cosineGradientBuffer}.
58
+ * for dataviz etc. Also see {@link cosineGradientBuffer}.
60
59
  *
61
60
  * @param opts -
62
61
  * @param buffer - target buffer/array
package/hcy/hcy.d.ts CHANGED
@@ -28,7 +28,7 @@ export declare class HCY implements TypedColor<HCY> {
28
28
  /**
29
29
  * @remarks
30
30
  * Note: As with other hue-based color modes in this package, the hue is stored
31
- * normalized (in [0..1] interval) and NOT as degrees.
31
+ * normalized (in `[0,1]` interval) and NOT as degrees.
32
32
  */
33
33
  export declare const hcy: ColorFactory<HCY>;
34
34
  //# sourceMappingURL=hcy.d.ts.map
package/hsi/hsi.d.ts CHANGED
@@ -28,7 +28,7 @@ export declare class HSI implements TypedColor<HSI> {
28
28
  /**
29
29
  * @remarks
30
30
  * Note: As with other hue-based color modes in this package, the hue is stored
31
- * normalized (in [0..1] interval) and NOT as degrees.
31
+ * normalized (in `[0,1]` interval) and NOT as degrees.
32
32
  */
33
33
  export declare const hsi: ColorFactory<HSI>;
34
34
  //# sourceMappingURL=hsi.d.ts.map
package/hsl/hsl.d.ts CHANGED
@@ -28,7 +28,7 @@ export declare class HSL implements TypedColor<HSL> {
28
28
  /**
29
29
  * @remarks
30
30
  * Note: As with other hue-based color modes in this package, the hue is stored
31
- * normalized (in [0..1] interval) and NOT as degrees.
31
+ * normalized (in `[0,1]` interval) and NOT as degrees.
32
32
  */
33
33
  export declare const hsl: ColorFactory<HSL>;
34
34
  //# sourceMappingURL=hsl.d.ts.map
package/hsv/hsv.d.ts CHANGED
@@ -28,7 +28,7 @@ export declare class HSV implements TypedColor<HSV> {
28
28
  /**
29
29
  * @remarks
30
30
  * Note: As with other hue-based color modes in this package, the hue is stored
31
- * normalized (in [0..1] interval) and NOT as degrees.
31
+ * normalized (in `[0,1]` interval) and NOT as degrees.
32
32
  */
33
33
  export declare const hsv: ColorFactory<HSV>;
34
34
  //# sourceMappingURL=hsv.d.ts.map
package/lab/lab-css.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import type { ReadonlyColor } from "../api.js";
2
2
  /**
3
3
  * @remarks
4
- * Only supported in CSS Color Level 4 onwards
5
- * https://www.w3.org/TR/css-color-4/#specifying-lab-lch
6
- * https://test.csswg.org/harness/results/css-color-4_dev/grouped/ (test reports)
4
+ * Only supported in CSS Color Level 4 onwards.
5
+ *
6
+ * References:
7
+ *
8
+ * - https://www.w3.org/TR/css-color-4/#specifying-lab-lch
9
+ * - https://test.csswg.org/harness/results/css-color-4_dev/grouped/ (test reports)
7
10
  *
8
11
  * @param src -
9
12
  */
package/lch/lch-css.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import type { ReadonlyColor } from "../api.js";
2
2
  /**
3
3
  * @remarks
4
- * Only supported in CSS Color Level 4 onwards
5
- * https://www.w3.org/TR/css-color-4/#specifying-lab-lch
6
- * https://test.csswg.org/harness/results/css-color-4_dev/grouped/ (test reports)
4
+ * Only supported in CSS Color Level 4 onwards.
5
+ *
6
+ * References:
7
+ *
8
+ * - https://www.w3.org/TR/css-color-4/#specifying-lab-lch
9
+ * - https://test.csswg.org/harness/results/css-color-4_dev/grouped/ (test reports)
7
10
  *
8
11
  * @param src -
9
12
  */
package/lch/lch.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare class LCH implements TypedColor<LCH> {
31
31
  *
32
32
  * @remarks
33
33
  * Note: As with other hue-based color modes in this package, the hue is stored
34
- * normalized (in [0..1] interval) and NOT as degrees.
34
+ * normalized (in `[0,1]` interval) and NOT as degrees.
35
35
  */
36
36
  export declare const lch: ColorFactory<LCH>;
37
37
  //# sourceMappingURL=lch.d.ts.map
package/mix.d.ts CHANGED
@@ -14,8 +14,8 @@ export declare const defMix: FnU4<FnN3, ColorMixFn>;
14
14
  * Single channel interpolation for (normalized) hues. Always interpolates via
15
15
  * smallest angle difference, i.e. such that the effective `abs(a-b) <= 0.5`.
16
16
  *
17
- * @param a - start hue in [0,1) interval
18
- * @param b - end hue in [0,1) interval
17
+ * @param a - start hue in `[0,1)` interval
18
+ * @param b - end hue in `[0,1)` interval
19
19
  * @param t - interpolation factor
20
20
  */
21
21
  export declare const mixH: FnN3;
@@ -30,7 +30,7 @@ export declare const mixN: FnN3;
30
30
  export declare const mixHNNN: ColorMixFn;
31
31
  export declare const mixNNHN: ColorMixFn;
32
32
  /**
33
- * Channelwise linear interpolation between colors `a` and `b` using `t` [0..1]
33
+ * Channelwise linear interpolation between colors `a` and `b` using `t` `[0,1]`
34
34
  * as blend factor.
35
35
  *
36
36
  * @param out -
@@ -41,7 +41,7 @@ export declare const mixNNHN: ColorMixFn;
41
41
  export declare const mixNNNN: ColorMixFn;
42
42
  /**
43
43
  * Channelwise and {@link ColorMode}-aware interpolation between colors `a` and
44
- * `b` using `t` [0..1] as blend factor. `a` and `b` MUST be of same color
44
+ * `b` using `t` `[0,1]` as blend factor. `a` and `b` MUST be of same color
45
45
  * type.
46
46
  *
47
47
  * @remarks
@@ -1,9 +1,12 @@
1
1
  import type { ReadonlyColor } from "../api.js";
2
2
  /**
3
3
  * @remarks
4
- * Only supported in CSS Color Level 4 onwards
5
- * https://www.w3.org/TR/css-color-4/#specifying-lab-lch
6
- * https://test.csswg.org/harness/results/css-color-4_dev/grouped/ (test reports)
4
+ * Only supported in CSS Color Level 4 onwards.
5
+ *
6
+ * References:
7
+ *
8
+ * - https://www.w3.org/TR/css-color-4/#specifying-lab-lch
9
+ * - https://test.csswg.org/harness/results/css-color-4_dev/grouped/ (test reports)
7
10
  *
8
11
  * @param src -
9
12
  */
@@ -2,6 +2,7 @@ import type { ReadonlyColor } from "../api.js";
2
2
  /**
3
3
  * @remarks
4
4
  * Only supported in CSS Color Level 4 onwards
5
+ *
5
6
  * - https://www.w3.org/TR/css-color-4/#specifying-oklab-oklch
6
7
  * - https://test.csswg.org/harness/results/css-color-4_dev/grouped/ (test reports)
7
8
  *
@@ -2,7 +2,7 @@ import type { ColorOp } from "../api.js";
2
2
  /**
3
3
  * @remarks
4
4
  * Reference:
5
- * - https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
5
+ * https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
6
6
  *
7
7
  * @param out
8
8
  * @param src
package/oklch/oklch.d.ts CHANGED
@@ -30,7 +30,7 @@ export declare class Oklch implements TypedColor<Oklch> {
30
30
  *
31
31
  * @remarks
32
32
  * Note: As with other hue-based color modes in this package, the hue is stored
33
- * normalized (in [0..1] interval) and NOT as degrees.
33
+ * normalized (in `[0,1]` interval) and NOT as degrees.
34
34
  *
35
35
  * Reference: https://bottosson.github.io/posts/oklab/
36
36
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/color",
3
- "version": "5.7.22",
3
+ "version": "5.7.24",
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",
@@ -43,23 +43,23 @@
43
43
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
44
44
  },
45
45
  "dependencies": {
46
- "@thi.ng/api": "^8.11.19",
47
- "@thi.ng/arrays": "^2.10.14",
48
- "@thi.ng/binary": "^3.4.42",
49
- "@thi.ng/checks": "^3.6.22",
50
- "@thi.ng/compare": "^2.4.11",
51
- "@thi.ng/compose": "^3.0.22",
52
- "@thi.ng/defmulti": "^3.0.58",
53
- "@thi.ng/errors": "^2.5.25",
54
- "@thi.ng/math": "^5.11.19",
55
- "@thi.ng/random": "^4.1.10",
56
- "@thi.ng/strings": "^3.9.4",
57
- "@thi.ng/transducers": "^9.2.17",
58
- "@thi.ng/vectors": "^7.12.19"
46
+ "@thi.ng/api": "^8.11.20",
47
+ "@thi.ng/arrays": "^2.10.15",
48
+ "@thi.ng/binary": "^3.4.43",
49
+ "@thi.ng/checks": "^3.6.23",
50
+ "@thi.ng/compare": "^2.4.12",
51
+ "@thi.ng/compose": "^3.0.23",
52
+ "@thi.ng/defmulti": "^3.0.60",
53
+ "@thi.ng/errors": "^2.5.26",
54
+ "@thi.ng/math": "^5.11.20",
55
+ "@thi.ng/random": "^4.1.11",
56
+ "@thi.ng/strings": "^3.9.5",
57
+ "@thi.ng/transducers": "^9.2.18",
58
+ "@thi.ng/vectors": "^7.12.20"
59
59
  },
60
60
  "devDependencies": {
61
- "esbuild": "^0.24.2",
62
- "typedoc": "^0.27.6",
61
+ "esbuild": "^0.25.0",
62
+ "typedoc": "^0.27.7",
63
63
  "typescript": "^5.7.3"
64
64
  },
65
65
  "keywords": [
@@ -446,5 +446,5 @@
446
446
  "vectors"
447
447
  ]
448
448
  },
449
- "gitHead": "fc1d498e8d4b690db873c30cc594352a804e7a65\n"
449
+ "gitHead": "9a0b33253fef092aaf301decf6ecd54317874d4c\n"
450
450
  }
@@ -2,6 +2,7 @@ import { type SRGB } from "../srgb/srgb.js";
2
2
  /**
3
3
  * @remarks
4
4
  * Based on:
5
+ *
5
6
  * - https://github.com/neilbartlett/color-temperature/blob/develop/index.js
6
7
  * - http://www.zombieprototypes.com/?p=210
7
8
  *
package/rotate.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { Color, TypedColor } from "./api.js";
7
7
  * If `out` is null, the resulting will be written back into `src`.
8
8
  *
9
9
  * As with all hue-based color modes in this package, the hue is stored
10
- * normalized (in [0..1] interval) and NOT as degrees. The same goes for the
10
+ * normalized (in `[0,1]` interval) and NOT as degrees. The same goes for the
11
11
  * rotation angle `theta`.
12
12
  *
13
13
  * Only supported for hue based color modes:
package/transform.d.ts CHANGED
@@ -8,7 +8,7 @@ import type { ColorMatrix, ReadonlyColor } from "./api.js";
8
8
  * @param out - result
9
9
  * @param mat - transform matrix
10
10
  * @param src - source color
11
- * @param clampOut - true, if result should be clamped to [0..1]
11
+ * @param clampOut - true, if result should be clamped to `[0,1]`
12
12
  */
13
13
  export declare const transform: (out: import("./api.js").Color | null, mat: ColorMatrix, src: ReadonlyColor, clampOut?: boolean) => import("@thi.ng/vectors").Vec;
14
14
  /**
@@ -53,7 +53,7 @@ export declare const saturationMat: (x: number) => ColorMatrix;
53
53
  export declare const hueRotateMat: (theta: number) => ColorMatrix;
54
54
  /**
55
55
  * Color temperature adjustment matrix. `x` controls blue/yellow, `y` controls
56
- * green/magenta axis (both params in [-1,1] range).
56
+ * green/magenta axis (both params in `[-1,1]` range).
57
57
  *
58
58
  * @param x
59
59
  * @param y
package/xyy/xyy-xyz.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { ColorOp } from "../api.js";
2
2
  /**
3
3
  * @remarks
4
- * https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
5
- * https://gamedev.stackexchange.com/a/70049
4
+ * - https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
5
+ * - https://gamedev.stackexchange.com/a/70049
6
6
  *
7
7
  * @param out -
8
8
  * @param src -
package/xyz/xyz-xyy.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { ColorOp } from "../api.js";
2
2
  /**
3
3
  * @remarks
4
- * https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
5
- * https://gamedev.stackexchange.com/a/70049
4
+ * - https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
5
+ * - https://gamedev.stackexchange.com/a/70049
6
6
  *
7
7
  * @param out -
8
8
  * @param src -