@soybeanjs/colord 0.4.2 → 0.5.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/dist/{colord-BB4wQYGd.js → colord-CFCSte7w.js} +10 -10
- package/dist/{colord-5yx_wwuH.d.ts → colord-CW-6f5TR.d.ts} +1 -2
- package/dist/colord.d.ts +1 -1
- package/dist/colord.js +1 -8
- package/dist/{extend-DD8Dqi45.d.ts → extend-CSAEXOEj.d.ts} +2 -2
- package/dist/{extend-DZhKU4TR.js → extend-I_t4rflW.js} +1 -1
- package/dist/{get-B9GsrsfV.js → get-KZZw_FUK.js} +1 -1
- package/dist/{hsv-OOAVcaRH.js → hsv-DDVddZxG.js} +2 -2
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -9
- package/dist/{lab-NxNRMUqK.js → lab-DNlzObm_.js} +4 -4
- package/dist/{manipulate-Cf2MhO9I.js → manipulate-CC84q9cZ.js} +4 -4
- package/dist/palette/index.d.ts +1 -2
- package/dist/palette/index.js +6 -13
- package/dist/plugins/a11y.d.ts +2 -2
- package/dist/plugins/a11y.js +3 -5
- package/dist/plugins/cmyk.d.ts +2 -2
- package/dist/plugins/cmyk.js +3 -4
- package/dist/plugins/harmonies.d.ts +1 -1
- package/dist/plugins/harmonies.js +1 -2
- package/dist/plugins/hwb.d.ts +2 -2
- package/dist/plugins/hwb.js +4 -5
- package/dist/plugins/lab.d.ts +2 -2
- package/dist/plugins/lab.js +25 -7
- package/dist/plugins/lch.d.ts +2 -2
- package/dist/plugins/lch.js +6 -8
- package/dist/plugins/minify.d.ts +1 -1
- package/dist/plugins/minify.js +2 -3
- package/dist/plugins/mix.d.ts +2 -2
- package/dist/plugins/mix.js +2 -8
- package/dist/plugins/names.d.ts +1 -1
- package/dist/plugins/names.js +1 -2
- package/dist/plugins/oklab.d.ts +2 -2
- package/dist/plugins/oklab.js +5 -6
- package/dist/plugins/xyz.d.ts +2 -2
- package/dist/plugins/xyz.js +2 -5
- package/dist/{rgb-DzRkOBLO.js → rgb-DS1WHzMx.js} +3 -3
- package/dist/{utils-CshL9w1R.js → utils-Ceb1031p.js} +1 -6
- package/dist/{xyz-WMIP19rd.js → xyz-B6AHOJgJ.js} +3 -3
- package/package.json +7 -7
- package/dist/lab-DRO6J6z8.js +0 -27
- /package/dist/{types-IZeCCEPk.d.ts → types-CqJOx44_.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as OKLAB_M2_INV, a as mul3x3, c as parseValueToDecimal, g as OKLAB_M2, h as OKLAB_M1_INV, i as isPresent, l as round, m as OKLAB_M1, n as clampHue, o as parseAlpha, s as parseHue, t as clamp
|
|
2
|
-
import { a as parseRgbString, c as roundRgb, i as parseRgb, n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, s as rgbToRgbString, t as clampLinearRgb } from "./rgb-
|
|
3
|
-
import { i as roundHsv, n as parseHsv, r as rgbToHsv } from "./hsv-
|
|
4
|
-
import { a as saturate, c as rgbToHsl, l as rgbToHslString, n as invert, o as parseHsl, r as lighten, s as parseHslString, t as changeAlpha, u as roundHsl } from "./manipulate-
|
|
5
|
-
import { t as getBrightness } from "./get-
|
|
1
|
+
import { _ as OKLAB_M2_INV, a as mul3x3, c as parseValueToDecimal, g as OKLAB_M2, h as OKLAB_M1_INV, i as isPresent, l as round, m as OKLAB_M1, n as clampHue, o as parseAlpha, s as parseHue, t as clamp } from "./utils-Ceb1031p.js";
|
|
2
|
+
import { a as parseRgbString, c as roundRgb, i as parseRgb, n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, s as rgbToRgbString, t as clampLinearRgb } from "./rgb-DS1WHzMx.js";
|
|
3
|
+
import { i as roundHsv, n as parseHsv, r as rgbToHsv } from "./hsv-DDVddZxG.js";
|
|
4
|
+
import { a as saturate, c as rgbToHsl, l as rgbToHslString, n as invert, o as parseHsl, r as lighten, s as parseHslString, t as changeAlpha, u as roundHsl } from "./manipulate-CC84q9cZ.js";
|
|
5
|
+
import { t as getBrightness } from "./get-KZZw_FUK.js";
|
|
6
6
|
|
|
7
7
|
//#region src/models/hex.ts
|
|
8
8
|
const hexMatcher = /^#([0-9a-f]{3,8})$/i;
|
|
@@ -54,7 +54,7 @@ const roundOklch = (oklch) => {
|
|
|
54
54
|
l: round(l, 3),
|
|
55
55
|
c: round(c, 3),
|
|
56
56
|
h: round(h, 3),
|
|
57
|
-
alpha: round(alpha,
|
|
57
|
+
alpha: round(alpha, 3)
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
@@ -267,7 +267,7 @@ var Colord = class {
|
|
|
267
267
|
rgb;
|
|
268
268
|
source;
|
|
269
269
|
constructor(input) {
|
|
270
|
-
const [rgb, format
|
|
270
|
+
const [rgb, format] = parse(input);
|
|
271
271
|
this.parsed = rgb;
|
|
272
272
|
this.rgb = this.parsed || {
|
|
273
273
|
r: 0,
|
|
@@ -275,8 +275,8 @@ var Colord = class {
|
|
|
275
275
|
b: 0,
|
|
276
276
|
alpha: 1
|
|
277
277
|
};
|
|
278
|
-
if (format
|
|
279
|
-
format
|
|
278
|
+
if (format && this.parsed) this.source = {
|
|
279
|
+
format,
|
|
280
280
|
input
|
|
281
281
|
};
|
|
282
282
|
}
|
|
@@ -415,7 +415,7 @@ var Colord = class {
|
|
|
415
415
|
}
|
|
416
416
|
alpha(value) {
|
|
417
417
|
if (typeof value === "number") return colord(changeAlpha(this.rgb, value));
|
|
418
|
-
return round(this.rgb.alpha,
|
|
418
|
+
return round(this.rgb.alpha, 3);
|
|
419
419
|
}
|
|
420
420
|
hue(value) {
|
|
421
421
|
const hsl = rgbToHsl(this.rgb);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as HsvColor, c as InputSource, f as OklchColor, i as HslColor, m as RgbColor, t as AnyColor } from "./types-
|
|
1
|
+
import { a as HsvColor, c as InputSource, f as OklchColor, i as HslColor, m as RgbColor, t as AnyColor } from "./types-CqJOx44_.js";
|
|
2
2
|
|
|
3
3
|
//#region src/colord.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Parses the given input color and creates a new `Colord` instance.
|
|
7
6
|
* See accepted input formats: https://github.com/omgovich/colord#color-parsing
|
package/dist/colord.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as colord, t as Colord } from "./colord-
|
|
1
|
+
import { n as colord, t as Colord } from "./colord-CW-6f5TR.js";
|
|
2
2
|
export { Colord, colord };
|
package/dist/colord.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./rgb-DzRkOBLO.js";
|
|
3
|
-
import { n as colord, t as Colord } from "./colord-BB4wQYGd.js";
|
|
4
|
-
import "./hsv-OOAVcaRH.js";
|
|
5
|
-
import "./manipulate-Cf2MhO9I.js";
|
|
6
|
-
import "./xyz-WMIP19rd.js";
|
|
7
|
-
import "./lab-NxNRMUqK.js";
|
|
8
|
-
import "./get-B9GsrsfV.js";
|
|
1
|
+
import { n as colord, t as Colord } from "./colord-CFCSte7w.js";
|
|
9
2
|
|
|
10
3
|
export { Colord, colord };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as Parsers } from "./types-
|
|
2
|
-
import { t as Colord } from "./colord-
|
|
1
|
+
import { p as Parsers } from "./types-CqJOx44_.js";
|
|
2
|
+
import { t as Colord } from "./colord-CW-6f5TR.js";
|
|
3
3
|
|
|
4
4
|
//#region src/extend.d.ts
|
|
5
5
|
type Plugin = (ColordClass: typeof Colord, parsers: Parsers) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isPresent, l as round, n as clampHue, t as clamp
|
|
1
|
+
import { i as isPresent, l as round, n as clampHue, t as clamp } from "./utils-Ceb1031p.js";
|
|
2
2
|
|
|
3
3
|
//#region src/models/hsv.ts
|
|
4
4
|
const clampHsv = (hsv) => ({
|
|
@@ -11,7 +11,7 @@ const roundHsv = (hsv) => ({
|
|
|
11
11
|
h: round(hsv.h, 3),
|
|
12
12
|
s: round(hsv.s, 3),
|
|
13
13
|
v: round(hsv.v, 3),
|
|
14
|
-
alpha: round(hsv.alpha,
|
|
14
|
+
alpha: round(hsv.alpha, 3)
|
|
15
15
|
});
|
|
16
16
|
const hsvToRgb = (hsv) => {
|
|
17
17
|
const h = hsv.h / 360 * 6;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as HsvColor, d as OklabColor, f as OklchColor, h as XyzColor, i as HslColor, l as LabColor, m as RgbColor, o as HwbColor, r as Format, s as Input, t as AnyColor, u as LchColor } from "./types-
|
|
2
|
-
import { n as colord, t as Colord } from "./colord-
|
|
3
|
-
import { n as extend, t as Plugin } from "./extend-
|
|
1
|
+
import { a as HsvColor, d as OklabColor, f as OklchColor, h as XyzColor, i as HslColor, l as LabColor, m as RgbColor, o as HwbColor, r as Format, s as Input, t as AnyColor, u as LchColor } from "./types-CqJOx44_.js";
|
|
2
|
+
import { n as colord, t as Colord } from "./colord-CW-6f5TR.js";
|
|
3
|
+
import { n as extend, t as Plugin } from "./extend-CSAEXOEj.js";
|
|
4
4
|
|
|
5
5
|
//#region src/shared/parse.d.ts
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Returns a color model name for the input passed to the function.
|
|
9
8
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import { i as getFormat, n as colord, r as random, t as Colord } from "./colord-BB4wQYGd.js";
|
|
4
|
-
import "./hsv-OOAVcaRH.js";
|
|
5
|
-
import "./manipulate-Cf2MhO9I.js";
|
|
6
|
-
import "./xyz-WMIP19rd.js";
|
|
7
|
-
import "./lab-NxNRMUqK.js";
|
|
8
|
-
import "./get-B9GsrsfV.js";
|
|
9
|
-
import { t as extend } from "./extend-DZhKU4TR.js";
|
|
1
|
+
import { i as getFormat, n as colord, r as random, t as Colord } from "./colord-CFCSte7w.js";
|
|
2
|
+
import { t as extend } from "./extend-I_t4rflW.js";
|
|
10
3
|
|
|
11
4
|
export { Colord, colord, extend, getFormat, random };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as mul3x3, d as M_D65_TO_D50, i as isPresent, l as round, o as parseAlpha, t as clamp, u as M_D50_TO_D65, v as
|
|
2
|
-
import { n as clampRgb } from "./rgb-
|
|
3
|
-
import { a as xyzToRgb, r as rgbToXyz } from "./xyz-
|
|
1
|
+
import { a as mul3x3, d as M_D65_TO_D50, i as isPresent, l as round, o as parseAlpha, t as clamp, u as M_D50_TO_D65, v as D50 } from "./utils-Ceb1031p.js";
|
|
2
|
+
import { n as clampRgb } from "./rgb-DS1WHzMx.js";
|
|
3
|
+
import { a as xyzToRgb, r as rgbToXyz } from "./xyz-B6AHOJgJ.js";
|
|
4
4
|
|
|
5
5
|
//#region src/models/lab.ts
|
|
6
6
|
const EPSILON = 216 / 24389;
|
|
@@ -25,7 +25,7 @@ const roundLab = (lab) => {
|
|
|
25
25
|
l: round(l, 3),
|
|
26
26
|
a: round(a, 3),
|
|
27
27
|
b: round(b, 3),
|
|
28
|
-
alpha: round(alpha,
|
|
28
|
+
alpha: round(alpha, 3)
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp
|
|
2
|
-
import { r as rgbToHsv, t as hsvToRgb } from "./hsv-
|
|
3
|
-
import { n as labToRgb, o as rgbToLab, t as clampLab } from "./lab-
|
|
1
|
+
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp } from "./utils-Ceb1031p.js";
|
|
2
|
+
import { r as rgbToHsv, t as hsvToRgb } from "./hsv-DDVddZxG.js";
|
|
3
|
+
import { n as labToRgb, o as rgbToLab, t as clampLab } from "./lab-DNlzObm_.js";
|
|
4
4
|
|
|
5
5
|
//#region src/models/hsl.ts
|
|
6
6
|
const clampHsl = (hsl) => {
|
|
@@ -18,7 +18,7 @@ const roundHsl = (hsl) => {
|
|
|
18
18
|
h: round(h, 3),
|
|
19
19
|
s: round(s, 3),
|
|
20
20
|
l: round(l, 3),
|
|
21
|
-
alpha: round(alpha,
|
|
21
|
+
alpha: round(alpha, 3)
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
const hslToHsv = (hsl) => {
|
package/dist/palette/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { f as OklchColor, i as HslColor, m as RgbColor, t as AnyColor } from "../types-
|
|
1
|
+
import { f as OklchColor, i as HslColor, m as RgbColor, t as AnyColor } from "../types-CqJOx44_.js";
|
|
2
2
|
|
|
3
3
|
//#region src/palette/types.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* the palette color level
|
|
7
6
|
*
|
package/dist/palette/index.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import
|
|
4
|
-
import "../hsv-OOAVcaRH.js";
|
|
5
|
-
import "../manipulate-Cf2MhO9I.js";
|
|
6
|
-
import "../xyz-WMIP19rd.js";
|
|
7
|
-
import "../lab-NxNRMUqK.js";
|
|
8
|
-
import "../get-B9GsrsfV.js";
|
|
9
|
-
import { t as extend } from "../extend-DZhKU4TR.js";
|
|
10
|
-
import { t as labPlugin } from "../lab-DRO6J6z8.js";
|
|
1
|
+
import { n as colord, o as keysOf } from "../colord-CFCSte7w.js";
|
|
2
|
+
import { t as extend } from "../extend-I_t4rflW.js";
|
|
3
|
+
import labPlugin from "../plugins/lab.js";
|
|
11
4
|
|
|
12
5
|
//#region src/palette/constant.ts
|
|
13
6
|
const simplePalette = {
|
|
@@ -1962,10 +1955,10 @@ function generateNearestPalette(input, format = "oklch") {
|
|
|
1962
1955
|
let isFound = false;
|
|
1963
1956
|
keysOf(tailwindPalette).forEach((paletteKey) => {
|
|
1964
1957
|
if (isFound) return;
|
|
1965
|
-
const palette
|
|
1966
|
-
keysOf(palette
|
|
1958
|
+
const palette = tailwindPalette[paletteKey];
|
|
1959
|
+
keysOf(palette).forEach((level) => {
|
|
1967
1960
|
if (isFound) return;
|
|
1968
|
-
const color = getPaletteColorByFormat(palette
|
|
1961
|
+
const color = getPaletteColorByFormat(palette[level], format);
|
|
1969
1962
|
const delta = inputColor.delta(color);
|
|
1970
1963
|
if (delta < minDelta) {
|
|
1971
1964
|
minDelta = delta;
|
package/dist/plugins/a11y.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as AnyColor } from "../types-
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { t as AnyColor } from "../types-CqJOx44_.js";
|
|
2
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/a11y.d.ts
|
|
5
5
|
interface ReadabilityOptions {
|
package/dist/plugins/a11y.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { l as round, r as floor } from "../utils-
|
|
2
|
-
import "../
|
|
3
|
-
import { i as getLuminance, n as getContrast } from "../get-B9GsrsfV.js";
|
|
1
|
+
import { l as round, r as floor } from "../utils-Ceb1031p.js";
|
|
2
|
+
import { i as getLuminance, n as getContrast } from "../get-KZZw_FUK.js";
|
|
4
3
|
|
|
5
4
|
//#region src/plugins/a11y.ts
|
|
6
5
|
/**
|
|
@@ -29,7 +28,6 @@ const a11yPlugin = (ColordClass) => {
|
|
|
29
28
|
return this.contrast(color2) >= getMinimalContrast(options);
|
|
30
29
|
};
|
|
31
30
|
};
|
|
32
|
-
var a11y_default = a11yPlugin;
|
|
33
31
|
|
|
34
32
|
//#endregion
|
|
35
|
-
export { a11yPlugin,
|
|
33
|
+
export { a11yPlugin, a11yPlugin as default };
|
package/dist/plugins/cmyk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as CmykColor } from "../types-
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { n as CmykColor } from "../types-CqJOx44_.js";
|
|
2
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/cmyk.d.ts
|
|
5
5
|
declare module '@soybeanjs/colord' {
|
package/dist/plugins/cmyk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isPresent, l as round, o as parseAlpha, t as clamp
|
|
1
|
+
import { i as isPresent, l as round, o as parseAlpha, t as clamp } from "../utils-Ceb1031p.js";
|
|
2
2
|
|
|
3
3
|
//#region src/models/cmyk.ts
|
|
4
4
|
/**
|
|
@@ -24,7 +24,7 @@ const roundCmyk = (cmyk) => {
|
|
|
24
24
|
m: round(m, 2),
|
|
25
25
|
y: round(y, 2),
|
|
26
26
|
k: round(k, 2),
|
|
27
|
-
alpha: round(alpha,
|
|
27
|
+
alpha: round(alpha, 3)
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -115,7 +115,6 @@ const cmykPlugin = (ColordClass, parsers) => {
|
|
|
115
115
|
parsers.object.push([parseCmyk, "cmyk"]);
|
|
116
116
|
parsers.string.push([parseCmykString, "cmyk"]);
|
|
117
117
|
};
|
|
118
|
-
var cmyk_default = cmykPlugin;
|
|
119
118
|
|
|
120
119
|
//#endregion
|
|
121
|
-
export { cmykPlugin,
|
|
120
|
+
export { cmykPlugin, cmykPlugin as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/harmonies.d.ts
|
|
4
4
|
type HarmonyType = 'analogous' | 'complementary' | 'double-split-complementary' | 'rectangle' | 'split-complementary' | 'tetradic' | 'triadic';
|
|
@@ -48,7 +48,6 @@ const harmoniesPlugin = (ColordClass) => {
|
|
|
48
48
|
return hueShifts[type].map((shift) => this.rotate(shift));
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
var harmonies_default = harmoniesPlugin;
|
|
52
51
|
|
|
53
52
|
//#endregion
|
|
54
|
-
export {
|
|
53
|
+
export { harmoniesPlugin as default, harmoniesPlugin };
|
package/dist/plugins/hwb.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as HwbColor } from "../types-
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { o as HwbColor } from "../types-CqJOx44_.js";
|
|
2
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/hwb.d.ts
|
|
5
5
|
declare module '@soybeanjs/colord' {
|
package/dist/plugins/hwb.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp
|
|
2
|
-
import { r as rgbToHsv, t as hsvToRgb } from "../hsv-
|
|
1
|
+
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp } from "../utils-Ceb1031p.js";
|
|
2
|
+
import { r as rgbToHsv, t as hsvToRgb } from "../hsv-DDVddZxG.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/hwb.ts
|
|
5
5
|
const clampHwb = (hwb) => {
|
|
@@ -17,7 +17,7 @@ const roundHwb = (hwb) => {
|
|
|
17
17
|
h: round(h, 3),
|
|
18
18
|
w: round(w, 3),
|
|
19
19
|
b: round(b, 3),
|
|
20
|
-
alpha: round(alpha,
|
|
20
|
+
alpha: round(alpha, 3)
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
const rgbToHwb = (rgb) => {
|
|
@@ -86,7 +86,6 @@ const hwbPlugin = (ColordClass, parsers) => {
|
|
|
86
86
|
parsers.string.push([parseHwbString, "hwb"]);
|
|
87
87
|
parsers.object.push([parseHwb, "hwb"]);
|
|
88
88
|
};
|
|
89
|
-
var hwb_default = hwbPlugin;
|
|
90
89
|
|
|
91
90
|
//#endregion
|
|
92
|
-
export {
|
|
91
|
+
export { hwbPlugin as default, hwbPlugin };
|
package/dist/plugins/lab.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as LabColor, t as AnyColor } from "../types-
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { l as LabColor, t as AnyColor } from "../types-CqJOx44_.js";
|
|
2
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/lab.d.ts
|
|
5
5
|
declare module '@soybeanjs/colord' {
|
package/dist/plugins/lab.js
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import "../utils-
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "../lab-NxNRMUqK.js";
|
|
5
|
-
import "../get-B9GsrsfV.js";
|
|
6
|
-
import { n as lab_default, t as labPlugin } from "../lab-DRO6J6z8.js";
|
|
1
|
+
import { l as round, t as clamp } from "../utils-Ceb1031p.js";
|
|
2
|
+
import { a as parseLabString, c as roundLab, i as parseLabBySource, l as toLabStringBySource, o as rgbToLab, r as parseLab, s as rgbToLabString } from "../lab-DNlzObm_.js";
|
|
3
|
+
import { r as getDeltaE2000 } from "../get-KZZw_FUK.js";
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
//#region src/plugins/lab.ts
|
|
6
|
+
/**
|
|
7
|
+
* A plugin adding support for CIELAB color space.
|
|
8
|
+
* https://en.wikipedia.org/wiki/CIELAB_color_space
|
|
9
|
+
*/
|
|
10
|
+
const labPlugin = (ColordClass, parsers) => {
|
|
11
|
+
ColordClass.prototype.toLab = function toLab() {
|
|
12
|
+
return roundLab(parseLabBySource(this.getSource()) || rgbToLab(this.rgb));
|
|
13
|
+
};
|
|
14
|
+
ColordClass.prototype.toLabString = function toLabString() {
|
|
15
|
+
return toLabStringBySource(this.getSource()) || rgbToLabString(this.rgb);
|
|
16
|
+
};
|
|
17
|
+
ColordClass.prototype.delta = function delta(color = "#FFF") {
|
|
18
|
+
const compared = color instanceof ColordClass ? color : new ColordClass(color);
|
|
19
|
+
return clamp(round(getDeltaE2000(this.toLab(), compared.toLab()) / 100, 3));
|
|
20
|
+
};
|
|
21
|
+
parsers.string.push([parseLabString, "lab"]);
|
|
22
|
+
parsers.object.push([parseLab, "lab"]);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { labPlugin as default, labPlugin };
|
package/dist/plugins/lch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as LchColor } from "../types-
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { u as LchColor } from "../types-CqJOx44_.js";
|
|
2
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/lch.d.ts
|
|
5
5
|
declare module '@soybeanjs/colord' {
|
package/dist/plugins/lch.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp
|
|
2
|
-
import { n as clampRgb } from "../rgb-
|
|
3
|
-
import "../
|
|
4
|
-
import { n as labToRgb, o as rgbToLab } from "../lab-NxNRMUqK.js";
|
|
1
|
+
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp } from "../utils-Ceb1031p.js";
|
|
2
|
+
import { n as clampRgb } from "../rgb-DS1WHzMx.js";
|
|
3
|
+
import { n as labToRgb, o as rgbToLab } from "../lab-DNlzObm_.js";
|
|
5
4
|
|
|
6
5
|
//#region src/models/lch.ts
|
|
7
6
|
/**
|
|
@@ -24,7 +23,7 @@ const roundLch = (lab) => {
|
|
|
24
23
|
l: round(l, 3),
|
|
25
24
|
c: round(c, 3),
|
|
26
25
|
h: round(h, 3),
|
|
27
|
-
alpha: round(alpha,
|
|
26
|
+
alpha: round(alpha, 3)
|
|
28
27
|
};
|
|
29
28
|
};
|
|
30
29
|
/**
|
|
@@ -184,13 +183,12 @@ const lchPlugin = (ColordClass, parsers) => {
|
|
|
184
183
|
ColordClass.prototype.toLch = function toLch() {
|
|
185
184
|
return roundLch(parseLchBySource(this.getSource()) || rgbToLch(this.rgb));
|
|
186
185
|
};
|
|
187
|
-
ColordClass.prototype.toLchString = function toLchString
|
|
186
|
+
ColordClass.prototype.toLchString = function toLchString() {
|
|
188
187
|
return toLchStringBySource(this.getSource()) || rgbToLchString(this.rgb);
|
|
189
188
|
};
|
|
190
189
|
parsers.string.push([parseLchString, "lch"]);
|
|
191
190
|
parsers.object.push([parseLch, "lch"]);
|
|
192
191
|
};
|
|
193
|
-
var lch_default = lchPlugin;
|
|
194
192
|
|
|
195
193
|
//#endregion
|
|
196
|
-
export {
|
|
194
|
+
export { lchPlugin as default, lchPlugin };
|
package/dist/plugins/minify.d.ts
CHANGED
package/dist/plugins/minify.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as round } from "../utils-
|
|
1
|
+
import { l as round } from "../utils-Ceb1031p.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/minify.ts
|
|
4
4
|
/**
|
|
@@ -55,7 +55,6 @@ const minifyPlugin = (ColordClass) => {
|
|
|
55
55
|
return findShortestString(variants);
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
|
-
var minify_default = minifyPlugin;
|
|
59
58
|
|
|
60
59
|
//#endregion
|
|
61
|
-
export {
|
|
60
|
+
export { minifyPlugin as default, minifyPlugin };
|
package/dist/plugins/mix.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as AnyColor } from "../types-
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { t as AnyColor } from "../types-CqJOx44_.js";
|
|
2
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/mix.d.ts
|
|
5
5
|
declare module '@soybeanjs/colord' {
|
package/dist/plugins/mix.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../rgb-DzRkOBLO.js";
|
|
3
|
-
import "../hsv-OOAVcaRH.js";
|
|
4
|
-
import { i as mix } from "../manipulate-Cf2MhO9I.js";
|
|
5
|
-
import "../xyz-WMIP19rd.js";
|
|
6
|
-
import "../lab-NxNRMUqK.js";
|
|
1
|
+
import { i as mix } from "../manipulate-CC84q9cZ.js";
|
|
7
2
|
|
|
8
3
|
//#region src/plugins/mix.ts
|
|
9
4
|
/**
|
|
@@ -33,7 +28,6 @@ const mixPlugin = (ColordClass) => {
|
|
|
33
28
|
return mixPalette(this, "#808080", count);
|
|
34
29
|
};
|
|
35
30
|
};
|
|
36
|
-
var mix_default = mixPlugin;
|
|
37
31
|
|
|
38
32
|
//#endregion
|
|
39
|
-
export {
|
|
33
|
+
export { mixPlugin as default, mixPlugin };
|
package/dist/plugins/names.d.ts
CHANGED
package/dist/plugins/names.js
CHANGED
|
@@ -195,7 +195,6 @@ const namesPlugin = (ColordClass, parsers) => {
|
|
|
195
195
|
};
|
|
196
196
|
parsers.string.push([parseColorName, "name"]);
|
|
197
197
|
};
|
|
198
|
-
var names_default = namesPlugin;
|
|
199
198
|
|
|
200
199
|
//#endregion
|
|
201
|
-
export {
|
|
200
|
+
export { namesPlugin as default, namesPlugin };
|
package/dist/plugins/oklab.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as OklabColor } from "../types-
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { d as OklabColor } from "../types-CqJOx44_.js";
|
|
2
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/oklab.d.ts
|
|
5
5
|
declare module '@soybeanjs/colord' {
|
package/dist/plugins/oklab.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as OKLAB_M2_INV, a as mul3x3, c as parseValueToDecimal, g as OKLAB_M2, h as OKLAB_M1_INV, i as isPresent, l as round, m as OKLAB_M1, o as parseAlpha, t as clamp
|
|
2
|
-
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, t as clampLinearRgb } from "../rgb-
|
|
1
|
+
import { _ as OKLAB_M2_INV, a as mul3x3, c as parseValueToDecimal, g as OKLAB_M2, h as OKLAB_M1_INV, i as isPresent, l as round, m as OKLAB_M1, o as parseAlpha, t as clamp } from "../utils-Ceb1031p.js";
|
|
2
|
+
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, t as clampLinearRgb } from "../rgb-DS1WHzMx.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/oklab.ts
|
|
5
5
|
const clampOklab = (oklab) => {
|
|
@@ -17,7 +17,7 @@ const roundOklab = (oklab) => {
|
|
|
17
17
|
l: round(l, 3),
|
|
18
18
|
a: round(a, 3),
|
|
19
19
|
b: round(b, 3),
|
|
20
|
-
alpha: round(alpha,
|
|
20
|
+
alpha: round(alpha, 3)
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
const oklabToRgb = (oklab) => {
|
|
@@ -129,13 +129,12 @@ const oklabPlugin = (ColordClass, parsers) => {
|
|
|
129
129
|
ColordClass.prototype.toOklab = function toOklab() {
|
|
130
130
|
return roundOklab(parseOklabBySource(this.getSource()) || rgbToOklab(this.rgb));
|
|
131
131
|
};
|
|
132
|
-
ColordClass.prototype.toOklabString = function toOklabString
|
|
132
|
+
ColordClass.prototype.toOklabString = function toOklabString() {
|
|
133
133
|
return toOklabStringBySource(this.getSource()) || rgbToOklabString(this.rgb);
|
|
134
134
|
};
|
|
135
135
|
parsers.string.push([parseOklabString, "oklab"]);
|
|
136
136
|
parsers.object.push([parseOklab, "oklab"]);
|
|
137
137
|
};
|
|
138
|
-
var oklab_default = oklabPlugin;
|
|
139
138
|
|
|
140
139
|
//#endregion
|
|
141
|
-
export {
|
|
140
|
+
export { oklabPlugin as default, oklabPlugin };
|
package/dist/plugins/xyz.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as XyzColor } from "../types-
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { h as XyzColor } from "../types-CqJOx44_.js";
|
|
2
|
+
import { t as Plugin } from "../extend-CSAEXOEj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/xyz.d.ts
|
|
5
5
|
declare module '@soybeanjs/colord' {
|
package/dist/plugins/xyz.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../rgb-DzRkOBLO.js";
|
|
3
|
-
import { i as roundXyz, n as parseXyzBySource, r as rgbToXyz, t as parseXyz } from "../xyz-WMIP19rd.js";
|
|
1
|
+
import { i as roundXyz, n as parseXyzBySource, r as rgbToXyz, t as parseXyz } from "../xyz-B6AHOJgJ.js";
|
|
4
2
|
|
|
5
3
|
//#region src/plugins/xyz.ts
|
|
6
4
|
/**
|
|
@@ -14,7 +12,6 @@ const xyzPlugin = (ColordClass, parsers) => {
|
|
|
14
12
|
};
|
|
15
13
|
parsers.object.push([parseXyz, "xyz"]);
|
|
16
14
|
};
|
|
17
|
-
var xyz_default = xyzPlugin;
|
|
18
15
|
|
|
19
16
|
//#endregion
|
|
20
|
-
export {
|
|
17
|
+
export { xyzPlugin as default, xyzPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isPresent, l as round, o as parseAlpha, t as clamp
|
|
1
|
+
import { i as isPresent, l as round, o as parseAlpha, t as clamp } from "./utils-Ceb1031p.js";
|
|
2
2
|
|
|
3
3
|
//#region src/models/rgb.ts
|
|
4
4
|
const clampRgb = (rgb) => {
|
|
@@ -16,7 +16,7 @@ const roundRgb = (rgb) => {
|
|
|
16
16
|
r: round(r, 2),
|
|
17
17
|
g: round(g, 2),
|
|
18
18
|
b: round(b, 2),
|
|
19
|
-
alpha: round(alpha,
|
|
19
|
+
alpha: round(alpha, 3)
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
const clampLinearRgb = (rgb) => {
|
|
@@ -140,7 +140,7 @@ function parseValue(str) {
|
|
|
140
140
|
}
|
|
141
141
|
const rgbToRgbString = (rgb) => {
|
|
142
142
|
const { r, g, b, alpha } = roundRgb(rgb);
|
|
143
|
-
return alpha < 1 ? `rgb(${r}
|
|
143
|
+
return alpha < 1 ? `rgb(${r} ${g} ${b} / ${alpha})` : `rgb(${r} ${g} ${b})`;
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
//#endregion
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
//#region src/constants/common.ts
|
|
2
2
|
/**
|
|
3
|
-
* We used to work with 2 digits after the decimal point, but it wasn't accurate enough,
|
|
4
|
-
* so the library produced colors that were perceived differently.
|
|
5
|
-
*/
|
|
6
|
-
const ALPHA_PRECISION = 3;
|
|
7
|
-
/**
|
|
8
3
|
* Valid CSS <angle> units.
|
|
9
4
|
* https://developer.mozilla.org/en-US/docs/Web/CSS/angle
|
|
10
5
|
*/
|
|
@@ -253,4 +248,4 @@ function parseValueToDecimal(value) {
|
|
|
253
248
|
}
|
|
254
249
|
|
|
255
250
|
//#endregion
|
|
256
|
-
export { OKLAB_M2_INV as _, mul3x3 as a,
|
|
251
|
+
export { OKLAB_M2_INV as _, mul3x3 as a, parseValueToDecimal as c, M_D65_TO_D50 as d, M_SRGB_TO_XYZ_D65 as f, OKLAB_M2 as g, OKLAB_M1_INV as h, isPresent as i, round as l, OKLAB_M1 as m, clampHue as n, parseAlpha as o, M_XYZ_D65_TO_SRGB as p, floor as r, parseHue as s, clamp as t, M_D50_TO_D65 as u, D50 as v, D65 as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as mul3x3,
|
|
2
|
-
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb } from "./rgb-
|
|
1
|
+
import { a as mul3x3, f as M_SRGB_TO_XYZ_D65, i as isPresent, l as round, p as M_XYZ_D65_TO_SRGB, t as clamp, y as D65 } from "./utils-Ceb1031p.js";
|
|
2
|
+
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb } from "./rgb-DS1WHzMx.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/xyz.ts
|
|
5
5
|
/**
|
|
@@ -22,7 +22,7 @@ const roundXyz = (xyz) => {
|
|
|
22
22
|
x: round(x, 4),
|
|
23
23
|
y: round(y, 4),
|
|
24
24
|
z: round(z, 4),
|
|
25
|
-
alpha: round(alpha,
|
|
25
|
+
alpha: round(alpha, 3)
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soybeanjs/colord",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"description": "A tiny yet powerful tool for high-performance color manipulations and conversions",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Soybean",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@soybeanjs/cli": "1.
|
|
46
|
+
"@soybeanjs/cli": "1.7.1",
|
|
47
47
|
"@soybeanjs/eslint-config": "1.7.5",
|
|
48
|
-
"@types/node": "25.
|
|
49
|
-
"eslint": "
|
|
50
|
-
"lint-staged": "16.
|
|
48
|
+
"@types/node": "25.5.2",
|
|
49
|
+
"eslint": "10.2.0",
|
|
50
|
+
"lint-staged": "16.4.0",
|
|
51
51
|
"simple-git-hooks": "2.13.1",
|
|
52
|
-
"tsdown": "0.
|
|
52
|
+
"tsdown": "0.21.7",
|
|
53
53
|
"tsx": "4.21.0",
|
|
54
|
-
"typescript": "
|
|
54
|
+
"typescript": "6.0.2"
|
|
55
55
|
},
|
|
56
56
|
"simple-git-hooks": {
|
|
57
57
|
"commit-msg": "pnpm soy git-commit-verify",
|
package/dist/lab-DRO6J6z8.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { l as round, t as clamp } from "./utils-CshL9w1R.js";
|
|
2
|
-
import { a as parseLabString, c as roundLab, i as parseLabBySource, l as toLabStringBySource, o as rgbToLab, r as parseLab, s as rgbToLabString } from "./lab-NxNRMUqK.js";
|
|
3
|
-
import { r as getDeltaE2000 } from "./get-B9GsrsfV.js";
|
|
4
|
-
|
|
5
|
-
//#region src/plugins/lab.ts
|
|
6
|
-
/**
|
|
7
|
-
* A plugin adding support for CIELAB color space.
|
|
8
|
-
* https://en.wikipedia.org/wiki/CIELAB_color_space
|
|
9
|
-
*/
|
|
10
|
-
const labPlugin = (ColordClass, parsers) => {
|
|
11
|
-
ColordClass.prototype.toLab = function toLab() {
|
|
12
|
-
return roundLab(parseLabBySource(this.getSource()) || rgbToLab(this.rgb));
|
|
13
|
-
};
|
|
14
|
-
ColordClass.prototype.toLabString = function toLabString() {
|
|
15
|
-
return toLabStringBySource(this.getSource()) || rgbToLabString(this.rgb);
|
|
16
|
-
};
|
|
17
|
-
ColordClass.prototype.delta = function delta(color = "#FFF") {
|
|
18
|
-
const compared = color instanceof ColordClass ? color : new ColordClass(color);
|
|
19
|
-
return clamp(round(getDeltaE2000(this.toLab(), compared.toLab()) / 100, 3));
|
|
20
|
-
};
|
|
21
|
-
parsers.string.push([parseLabString, "lab"]);
|
|
22
|
-
parsers.object.push([parseLab, "lab"]);
|
|
23
|
-
};
|
|
24
|
-
var lab_default = labPlugin;
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { lab_default as n, labPlugin as t };
|
|
File without changes
|