@soybeanjs/colord 0.0.1 → 0.0.2
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/plugins/a11y.d.ts +1 -1
- package/dist/plugins/cmyk.d.ts +1 -1
- package/dist/plugins/harmonies.d.ts +1 -1
- package/dist/plugins/hwb.d.ts +1 -1
- package/dist/plugins/lab.d.ts +1 -1
- package/dist/plugins/lch.d.ts +1 -1
- package/dist/plugins/minify.d.ts +1 -1
- package/dist/plugins/mix.d.ts +1 -1
- package/dist/plugins/names.d.ts +1 -1
- package/dist/plugins/oklab.d.ts +2 -1
- package/dist/plugins/oklab.js +7 -0
- package/dist/plugins/oklch.d.ts +2 -1
- package/dist/plugins/oklch.js +7 -0
- package/dist/plugins/xyz.d.ts +1 -1
- package/package.json +1 -1
package/dist/plugins/a11y.d.ts
CHANGED
package/dist/plugins/cmyk.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { i as CmykColor } from "../colord-xpgrVWRV.js";
|
|
|
2
2
|
import { t as Plugin } from "../extend-DrPfn2Q1.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/cmyk.d.ts
|
|
5
|
-
declare module '
|
|
5
|
+
declare module '@soybeanjs/colord' {
|
|
6
6
|
interface Colord {
|
|
7
7
|
/**
|
|
8
8
|
* Converts a color to CMYK color space and returns an object.
|
|
@@ -2,7 +2,7 @@ import { t as Plugin } from "../extend-DrPfn2Q1.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';
|
|
5
|
-
declare module '
|
|
5
|
+
declare module '@soybeanjs/colord' {
|
|
6
6
|
interface Colord {
|
|
7
7
|
/**
|
|
8
8
|
* Returns an array of harmony colors as `Colord` instances.
|
package/dist/plugins/hwb.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { c as HwbColor } from "../colord-xpgrVWRV.js";
|
|
|
2
2
|
import { t as Plugin } from "../extend-DrPfn2Q1.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/hwb.d.ts
|
|
5
|
-
declare module '
|
|
5
|
+
declare module '@soybeanjs/colord' {
|
|
6
6
|
interface Colord {
|
|
7
7
|
/**
|
|
8
8
|
* Converts a color to HWB (Hue-Whiteness-Blackness) color space and returns an object.
|
package/dist/plugins/lab.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { r as AnyColor, u as LabColor } from "../colord-xpgrVWRV.js";
|
|
|
2
2
|
import { t as Plugin } from "../extend-DrPfn2Q1.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/lab.d.ts
|
|
5
|
-
declare module '
|
|
5
|
+
declare module '@soybeanjs/colord' {
|
|
6
6
|
interface Colord {
|
|
7
7
|
/**
|
|
8
8
|
* Converts a color to CIELAB color space and returns an object.
|
package/dist/plugins/lch.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { d as LchColor } from "../colord-xpgrVWRV.js";
|
|
|
2
2
|
import { t as Plugin } from "../extend-DrPfn2Q1.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/lch.d.ts
|
|
5
|
-
declare module '
|
|
5
|
+
declare module '@soybeanjs/colord' {
|
|
6
6
|
interface Colord {
|
|
7
7
|
/**
|
|
8
8
|
* Converts a color to CIELCH (Lightness-Chroma-Hue) color space and returns an object.
|
package/dist/plugins/minify.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ interface MinificationOptions {
|
|
|
9
9
|
name?: boolean;
|
|
10
10
|
transparent?: boolean;
|
|
11
11
|
}
|
|
12
|
-
declare module '
|
|
12
|
+
declare module '@soybeanjs/colord' {
|
|
13
13
|
interface Colord {
|
|
14
14
|
/** Returns the shortest string representation of the color */
|
|
15
15
|
minify(options?: MinificationOptions): string;
|
package/dist/plugins/mix.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { r as AnyColor } from "../colord-xpgrVWRV.js";
|
|
|
2
2
|
import { t as Plugin } from "../extend-DrPfn2Q1.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/mix.d.ts
|
|
5
|
-
declare module '
|
|
5
|
+
declare module '@soybeanjs/colord' {
|
|
6
6
|
interface Colord {
|
|
7
7
|
/**
|
|
8
8
|
* Produces a mixture of two colors through CIE LAB color space and returns a new Colord instance.
|
package/dist/plugins/names.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { t as Plugin } from "../extend-DrPfn2Q1.js";
|
|
|
4
4
|
interface ConvertOptions {
|
|
5
5
|
closest?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare module '
|
|
7
|
+
declare module '@soybeanjs/colord' {
|
|
8
8
|
interface Colord {
|
|
9
9
|
/** Finds CSS color keyword that matches with the color value */
|
|
10
10
|
toName(options?: ConvertOptions): string | undefined;
|
package/dist/plugins/oklab.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { f as OklabColor } from "../colord-xpgrVWRV.js";
|
|
|
2
2
|
import { t as Plugin } from "../extend-DrPfn2Q1.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/oklab.d.ts
|
|
5
|
-
declare module '
|
|
5
|
+
declare module '@soybeanjs/colord' {
|
|
6
6
|
interface Colord {
|
|
7
7
|
toOklab(): OklabColor;
|
|
8
|
+
toOklabString(): string;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
/**
|
package/dist/plugins/oklab.js
CHANGED
|
@@ -83,6 +83,10 @@ const parseOklabString = (input) => {
|
|
|
83
83
|
alpha: parseAlpha(alpha)
|
|
84
84
|
}));
|
|
85
85
|
};
|
|
86
|
+
const rgbToOklabString = (rgb) => {
|
|
87
|
+
const { l, a, b, alpha } = roundOklab(rgbToOklab(rgb));
|
|
88
|
+
return alpha < 1 ? `oklab(${l}% ${a} ${b} / ${alpha})` : `oklab(${l}% ${a} ${b})`;
|
|
89
|
+
};
|
|
86
90
|
|
|
87
91
|
//#endregion
|
|
88
92
|
//#region src/plugins/oklab.ts
|
|
@@ -94,6 +98,9 @@ const oklabPlugin = (ColordClass, parsers) => {
|
|
|
94
98
|
ColordClass.prototype.toOklab = function toOklab() {
|
|
95
99
|
return roundOklab(rgbToOklab(this.rgb));
|
|
96
100
|
};
|
|
101
|
+
ColordClass.prototype.toOklabString = function toOklabString() {
|
|
102
|
+
return rgbToOklabString(this.rgb);
|
|
103
|
+
};
|
|
97
104
|
parsers.string.push([parseOklabString, "oklab"]);
|
|
98
105
|
parsers.object.push([parseOklab, "oklab"]);
|
|
99
106
|
};
|
package/dist/plugins/oklch.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { p as OklchColor } from "../colord-xpgrVWRV.js";
|
|
|
2
2
|
import { t as Plugin } from "../extend-DrPfn2Q1.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/oklch.d.ts
|
|
5
|
-
declare module '
|
|
5
|
+
declare module '@soybeanjs/colord' {
|
|
6
6
|
interface Colord {
|
|
7
7
|
toOklch(): OklchColor;
|
|
8
|
+
toOklchString(): string;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
/**
|
package/dist/plugins/oklch.js
CHANGED
|
@@ -92,6 +92,10 @@ const parseOklchString = (input) => {
|
|
|
92
92
|
alpha: parseAlpha(alpha)
|
|
93
93
|
}));
|
|
94
94
|
};
|
|
95
|
+
const rgbToOklchString = (rgb) => {
|
|
96
|
+
const { l, c, h, alpha } = roundOklch(rgbToOklch(rgb));
|
|
97
|
+
return alpha < 1 ? `oklch(${l}% ${c} ${h} / ${alpha})` : `oklch(${l}% ${c} ${h})`;
|
|
98
|
+
};
|
|
95
99
|
|
|
96
100
|
//#endregion
|
|
97
101
|
//#region src/plugins/oklch.ts
|
|
@@ -103,6 +107,9 @@ const oklchPlugin = (ColordClass, parsers) => {
|
|
|
103
107
|
ColordClass.prototype.toOklch = function toOklch() {
|
|
104
108
|
return roundOklch(rgbToOklch(this.rgb));
|
|
105
109
|
};
|
|
110
|
+
ColordClass.prototype.toOklchString = function toOklchString() {
|
|
111
|
+
return rgbToOklchString(this.rgb);
|
|
112
|
+
};
|
|
106
113
|
parsers.string.push([parseOklchString, "oklch"]);
|
|
107
114
|
parsers.object.push([parseOklch, "oklch"]);
|
|
108
115
|
};
|
package/dist/plugins/xyz.d.ts
CHANGED