@thi.ng/color 5.2.17 → 5.3.0
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 +12 -1
- package/README.md +2 -2
- package/distance.d.ts +9 -0
- package/distance.js +13 -0
- package/hue.d.ts +10 -0
- package/hue.js +18 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/invert.js +1 -1
- package/package.json +23 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-
|
|
3
|
+
- **Last updated**: 2023-02-10T13:55:29Z
|
|
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.
|
|
@@ -9,6 +9,17 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [5.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@5.3.0) (2023-02-10)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add hue() function ([c5c3dd5](https://github.com/thi-ng/umbrella/commit/c5c3dd5))
|
|
17
|
+
- add distLch() ([f1b509d](https://github.com/thi-ng/umbrella/commit/f1b509d))
|
|
18
|
+
|
|
19
|
+
#### 🩹 Bug fixes
|
|
20
|
+
|
|
21
|
+
- fix invert() for HSL ([84d0640](https://github.com/thi-ng/umbrella/commit/84d0640))
|
|
22
|
+
|
|
12
23
|
## [5.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@5.2.0) (2022-09-21)
|
|
13
24
|
|
|
14
25
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -571,7 +571,7 @@ concatenation (see `concat()`) for more efficient application.
|
|
|
571
571
|
|
|
572
572
|
## Support packages
|
|
573
573
|
|
|
574
|
-
- [@thi.ng/color-palettes](https://github.com/thi-ng/umbrella/tree/develop/packages/color-palettes) - Collection of
|
|
574
|
+
- [@thi.ng/color-palettes](https://github.com/thi-ng/umbrella/tree/develop/packages/color-palettes) - Collection of 200+ image based color themes & composable theme query filters
|
|
575
575
|
|
|
576
576
|
## Related packages
|
|
577
577
|
|
|
@@ -598,7 +598,7 @@ For Node.js REPL:
|
|
|
598
598
|
const color = await import("@thi.ng/color");
|
|
599
599
|
```
|
|
600
600
|
|
|
601
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 15.
|
|
601
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 15.25 KB
|
|
602
602
|
|
|
603
603
|
## Dependencies
|
|
604
604
|
|
package/distance.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ export declare const distChannel: (id: number) => ColorDistance;
|
|
|
15
15
|
* @param b -
|
|
16
16
|
*/
|
|
17
17
|
export declare const distHsv: ColorDistance;
|
|
18
|
+
/**
|
|
19
|
+
* Similar to {@link distHsv}, but computes distance between two LCH colors
|
|
20
|
+
* (with different channel order), i.e. the eucledian distance between points in
|
|
21
|
+
* a cyclinder.
|
|
22
|
+
*
|
|
23
|
+
* @param a -
|
|
24
|
+
* @param b -
|
|
25
|
+
*/
|
|
26
|
+
export declare const distLch: ColorDistance;
|
|
18
27
|
/**
|
|
19
28
|
* Computes difference in saturation between two HSV colors.
|
|
20
29
|
*
|
package/distance.js
CHANGED
|
@@ -25,6 +25,19 @@ export const distHsv = (a, b) => {
|
|
|
25
25
|
const bb = cossin(b[0] * TAU, b[1]);
|
|
26
26
|
return hypot(aa[0] - bb[0], aa[1] - bb[1], a[2] - b[2]);
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Similar to {@link distHsv}, but computes distance between two LCH colors
|
|
30
|
+
* (with different channel order), i.e. the eucledian distance between points in
|
|
31
|
+
* a cyclinder.
|
|
32
|
+
*
|
|
33
|
+
* @param a -
|
|
34
|
+
* @param b -
|
|
35
|
+
*/
|
|
36
|
+
export const distLch = (a, b) => {
|
|
37
|
+
const aa = cossin(a[2] * TAU, a[1]);
|
|
38
|
+
const bb = cossin(b[2] * TAU, b[1]);
|
|
39
|
+
return hypot(aa[0] - bb[0], aa[1] - bb[1], a[0] - b[0]);
|
|
40
|
+
};
|
|
28
41
|
/**
|
|
29
42
|
* Computes difference in saturation between two HSV colors.
|
|
30
43
|
*
|
package/hue.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TypedColor } from "./api.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the (normalized) hue of given color.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Since LCH uses different hue values than the more familiar HSV/HSL color
|
|
7
|
+
* wheel, LCH colors will be first converted to HSV to ensure uniform results.
|
|
8
|
+
*/
|
|
9
|
+
export declare const hue: import("@thi.ng/defmulti").MultiFn1<TypedColor<any>, number>;
|
|
10
|
+
//# sourceMappingURL=hue.d.ts.map
|
package/hue.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DEFAULT, defmulti } from "@thi.ng/defmulti/defmulti";
|
|
2
|
+
import { hsv } from "./hsv/hsv.js";
|
|
3
|
+
import { __dispatch0 } from "./internal/dispatch.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the (normalized) hue of given color.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Since LCH uses different hue values than the more familiar HSV/HSL color
|
|
9
|
+
* wheel, LCH colors will be first converted to HSV to ensure uniform results.
|
|
10
|
+
*/
|
|
11
|
+
export const hue = defmulti(__dispatch0, {
|
|
12
|
+
hcy: "hsv",
|
|
13
|
+
hsi: "hsv",
|
|
14
|
+
hsl: "hsv",
|
|
15
|
+
}, {
|
|
16
|
+
[DEFAULT]: (col) => hsv(col)[0],
|
|
17
|
+
hsv: (col) => col[0],
|
|
18
|
+
});
|
package/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export * from "./color-range.js";
|
|
|
47
47
|
export * from "./cosine-gradients.js";
|
|
48
48
|
export * from "./distance.js";
|
|
49
49
|
export * from "./gradients.js";
|
|
50
|
+
export * from "./hue.js";
|
|
50
51
|
export * from "./invert.js";
|
|
51
52
|
export * from "./is-black.js";
|
|
52
53
|
export * from "./is-gamut.js";
|
package/index.js
CHANGED
|
@@ -47,6 +47,7 @@ export * from "./color-range.js";
|
|
|
47
47
|
export * from "./cosine-gradients.js";
|
|
48
48
|
export * from "./distance.js";
|
|
49
49
|
export * from "./gradients.js";
|
|
50
|
+
export * from "./hue.js";
|
|
50
51
|
export * from "./invert.js";
|
|
51
52
|
export * from "./is-black.js";
|
|
52
53
|
export * from "./is-gamut.js";
|
package/invert.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/color",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
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,27 +36,27 @@
|
|
|
36
36
|
"tool:swatches": "tools:node-esm tools/index.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.
|
|
40
|
-
"@thi.ng/arrays": "^2.5.
|
|
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.4.
|
|
48
|
-
"@thi.ng/random": "^3.3.
|
|
49
|
-
"@thi.ng/strings": "^3.3.
|
|
50
|
-
"@thi.ng/transducers": "^8.3.
|
|
51
|
-
"@thi.ng/vectors": "^7.
|
|
39
|
+
"@thi.ng/api": "^8.7.1",
|
|
40
|
+
"@thi.ng/arrays": "^2.5.3",
|
|
41
|
+
"@thi.ng/binary": "^3.3.18",
|
|
42
|
+
"@thi.ng/checks": "^3.3.8",
|
|
43
|
+
"@thi.ng/compare": "^2.1.24",
|
|
44
|
+
"@thi.ng/compose": "^2.1.26",
|
|
45
|
+
"@thi.ng/defmulti": "^2.1.29",
|
|
46
|
+
"@thi.ng/errors": "^2.2.10",
|
|
47
|
+
"@thi.ng/math": "^5.4.2",
|
|
48
|
+
"@thi.ng/random": "^3.3.23",
|
|
49
|
+
"@thi.ng/strings": "^3.3.25",
|
|
50
|
+
"@thi.ng/transducers": "^8.3.32",
|
|
51
|
+
"@thi.ng/vectors": "^7.6.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@microsoft/api-extractor": "^7.
|
|
55
|
-
"@thi.ng/testament": "^0.3.
|
|
56
|
-
"rimraf": "^
|
|
54
|
+
"@microsoft/api-extractor": "^7.34.2",
|
|
55
|
+
"@thi.ng/testament": "^0.3.10",
|
|
56
|
+
"rimraf": "^4.1.2",
|
|
57
57
|
"tools": "^0.0.1",
|
|
58
|
-
"typedoc": "^0.23.
|
|
59
|
-
"typescript": "^4.9.
|
|
58
|
+
"typedoc": "^0.23.24",
|
|
59
|
+
"typescript": "^4.9.5"
|
|
60
60
|
},
|
|
61
61
|
"keywords": [
|
|
62
62
|
"color",
|
|
@@ -222,6 +222,9 @@
|
|
|
222
222
|
"./hsv/hsv": {
|
|
223
223
|
"default": "./hsv/hsv.js"
|
|
224
224
|
},
|
|
225
|
+
"./hue": {
|
|
226
|
+
"default": "./hue.js"
|
|
227
|
+
},
|
|
225
228
|
"./int/int-css": {
|
|
226
229
|
"default": "./int/int-css.js"
|
|
227
230
|
},
|
|
@@ -424,5 +427,5 @@
|
|
|
424
427
|
"vectors"
|
|
425
428
|
]
|
|
426
429
|
},
|
|
427
|
-
"gitHead": "
|
|
430
|
+
"gitHead": "2b5a99a8af71670780875637299be9118b01084d\n"
|
|
428
431
|
}
|