@soybeanjs/colord 0.0.7 → 0.0.8
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-CLzIbIN2.js → colord-CiL21DdP.js} +12 -6
- package/dist/{colord-Dc09uNcG.d.ts → colord-DjohCNUk.d.ts} +4 -67
- package/dist/colord.d.ts +1 -1
- package/dist/colord.js +8 -8
- package/dist/extend-Cjbo01n8.js +15 -0
- package/dist/{extend-D_jQFvDk.d.ts → extend-DmcZT4-q.d.ts} +2 -1
- package/dist/{get-SLuYLSG9.js → get-DjkEJgax.js} +1 -1
- package/dist/{hsv-OOAVcaRH.js → hsv-6f-Avk00.js} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +9 -20
- package/dist/lab-BXLaTQvQ.js +27 -0
- package/dist/{lab-9NsKpGel.js → lab-DklZwOkG.js} +3 -3
- package/dist/{manipulate-DCHNBCkU.js → manipulate-DJ-cBonL.js} +3 -3
- package/dist/oklch-sYjVoJRG.js +186 -0
- package/dist/palette/index.d.ts +30 -0
- package/dist/palette/index.js +518 -0
- package/dist/plugins/a11y.d.ts +2 -2
- package/dist/plugins/a11y.js +3 -3
- package/dist/plugins/cmyk.d.ts +2 -2
- package/dist/plugins/cmyk.js +1 -1
- package/dist/plugins/harmonies.d.ts +1 -1
- package/dist/plugins/hwb.d.ts +2 -2
- package/dist/plugins/hwb.js +2 -2
- package/dist/plugins/lab.d.ts +2 -2
- package/dist/plugins/lab.js +6 -27
- package/dist/plugins/lch.d.ts +2 -2
- package/dist/plugins/lch.js +4 -4
- package/dist/plugins/minify.d.ts +1 -1
- package/dist/plugins/minify.js +1 -1
- package/dist/plugins/mix.d.ts +2 -2
- package/dist/plugins/mix.js +6 -6
- package/dist/plugins/names.d.ts +1 -1
- package/dist/plugins/oklab.d.ts +2 -2
- package/dist/plugins/oklab.js +2 -2
- package/dist/plugins/oklch.d.ts +2 -2
- package/dist/plugins/oklch.js +3 -184
- package/dist/plugins/xyz.d.ts +2 -2
- package/dist/plugins/xyz.js +3 -3
- package/dist/{rgb-BVkoWOmR.js → rgb-BIWjP3hJ.js} +2 -2
- package/dist/types-B93dJkfp.d.ts +112 -0
- package/dist/{xyz-DsYRwYO_.js → xyz-Czd8MTub.js} +2 -2
- package/package.json +6 -1
- /package/dist/{utils-CshL9w1R.js → utils-BhDL0kto.js} +0 -0
package/dist/plugins/mix.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "../utils-
|
|
2
|
-
import "../rgb-
|
|
3
|
-
import "../hsv-
|
|
4
|
-
import { i as mix } from "../manipulate-
|
|
5
|
-
import "../xyz-
|
|
6
|
-
import "../lab-
|
|
1
|
+
import "../utils-BhDL0kto.js";
|
|
2
|
+
import "../rgb-BIWjP3hJ.js";
|
|
3
|
+
import "../hsv-6f-Avk00.js";
|
|
4
|
+
import { i as mix } from "../manipulate-DJ-cBonL.js";
|
|
5
|
+
import "../xyz-Czd8MTub.js";
|
|
6
|
+
import "../lab-DklZwOkG.js";
|
|
7
7
|
|
|
8
8
|
//#region src/plugins/mix.ts
|
|
9
9
|
/**
|
package/dist/plugins/names.d.ts
CHANGED
package/dist/plugins/oklab.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as OklabColor } from "../
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { f as OklabColor } from "../types-B93dJkfp.js";
|
|
2
|
+
import { t as Plugin } from "../extend-DmcZT4-q.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, v as ALPHA_PRECISION } from "../utils-
|
|
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, v as ALPHA_PRECISION } from "../utils-BhDL0kto.js";
|
|
2
|
+
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, t as clampLinearRgb } from "../rgb-BIWjP3hJ.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/oklab.ts
|
|
5
5
|
const clampOklab = (oklab) => {
|
package/dist/plugins/oklch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as OklchColor } from "../
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { p as OklchColor } from "../types-B93dJkfp.js";
|
|
2
|
+
import { t as Plugin } from "../extend-DmcZT4-q.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/oklch.d.ts
|
|
5
5
|
declare module '@soybeanjs/colord' {
|
package/dist/plugins/oklch.js
CHANGED
|
@@ -1,186 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "../utils-BhDL0kto.js";
|
|
2
|
+
import "../rgb-BIWjP3hJ.js";
|
|
3
|
+
import { n as oklch_default, t as oklchPlugin } from "../oklch-sYjVoJRG.js";
|
|
3
4
|
|
|
4
|
-
//#region src/models/oklch.ts
|
|
5
|
-
const clampOklch = (oklch) => {
|
|
6
|
-
const { l, c, h, alpha } = oklch;
|
|
7
|
-
return {
|
|
8
|
-
l: clamp(l, 0, 1),
|
|
9
|
-
c: clamp(c, 0, .37),
|
|
10
|
-
h: clampHue(h),
|
|
11
|
-
alpha: clamp(alpha)
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
const roundOklch = (oklch) => {
|
|
15
|
-
const { l, c, h, alpha } = oklch;
|
|
16
|
-
return {
|
|
17
|
-
l: round(l, 3),
|
|
18
|
-
c: round(c, 3),
|
|
19
|
-
h: round(h, 3),
|
|
20
|
-
alpha: round(alpha, ALPHA_PRECISION)
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Convert OKLCH to Linear RGB without gamut mapping
|
|
25
|
-
*/
|
|
26
|
-
const oklchToLinearRgb = (oklch) => {
|
|
27
|
-
const { l, c, h, alpha } = oklch;
|
|
28
|
-
const hRad = h * Math.PI / 180;
|
|
29
|
-
const [r, g, b] = mul3x3(OKLAB_M1_INV, mul3x3(OKLAB_M2_INV, [
|
|
30
|
-
l,
|
|
31
|
-
c * Math.cos(hRad),
|
|
32
|
-
c * Math.sin(hRad)
|
|
33
|
-
]).map((v) => v * v * v));
|
|
34
|
-
return {
|
|
35
|
-
r,
|
|
36
|
-
g,
|
|
37
|
-
b,
|
|
38
|
-
alpha
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Check if a linear RGB color is within sRGB gamut
|
|
43
|
-
*/
|
|
44
|
-
const isInGamut = (linearRgb, epsilon = 1e-6) => {
|
|
45
|
-
return linearRgb.r >= -epsilon && linearRgb.r <= 1 + epsilon && linearRgb.g >= -epsilon && linearRgb.g <= 1 + epsilon && linearRgb.b >= -epsilon && linearRgb.b <= 1 + epsilon;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Binary search to find maximum chroma that fits in sRGB gamut
|
|
49
|
-
* @param l - Lightness (0-1)
|
|
50
|
-
* @param h - Hue (0-360)
|
|
51
|
-
* @param alpha - Alpha (0-1)
|
|
52
|
-
* @returns Maximum chroma that fits in sRGB gamut
|
|
53
|
-
*/
|
|
54
|
-
const findGamutChroma = (l, h, alpha) => {
|
|
55
|
-
let min = 0;
|
|
56
|
-
let max = .37;
|
|
57
|
-
const epsilon = 1e-5;
|
|
58
|
-
if (isInGamut(oklchToLinearRgb({
|
|
59
|
-
l,
|
|
60
|
-
c: max,
|
|
61
|
-
h,
|
|
62
|
-
alpha
|
|
63
|
-
}), epsilon)) return max;
|
|
64
|
-
while (max - min > epsilon) {
|
|
65
|
-
const mid = (min + max) / 2;
|
|
66
|
-
if (isInGamut(oklchToLinearRgb({
|
|
67
|
-
l,
|
|
68
|
-
c: mid,
|
|
69
|
-
h,
|
|
70
|
-
alpha
|
|
71
|
-
}), epsilon)) min = mid;
|
|
72
|
-
else max = mid;
|
|
73
|
-
}
|
|
74
|
-
return min;
|
|
75
|
-
};
|
|
76
|
-
const oklchToRgb = (oklch) => {
|
|
77
|
-
const { l, h, alpha } = oklch;
|
|
78
|
-
let linearRgb = oklchToLinearRgb(oklch);
|
|
79
|
-
if (!isInGamut(linearRgb)) linearRgb = oklchToLinearRgb({
|
|
80
|
-
l,
|
|
81
|
-
c: findGamutChroma(l, h, alpha),
|
|
82
|
-
h,
|
|
83
|
-
alpha
|
|
84
|
-
});
|
|
85
|
-
linearRgb = clampLinearRgb(linearRgb);
|
|
86
|
-
return clampRgb(linearRgbToRgb(linearRgb));
|
|
87
|
-
};
|
|
88
|
-
const rgbToOklch = (rgb) => {
|
|
89
|
-
const lRgb = rgbToLinearRgb(rgb);
|
|
90
|
-
const [l, a, b] = mul3x3(OKLAB_M2, mul3x3(OKLAB_M1, [
|
|
91
|
-
lRgb.r,
|
|
92
|
-
lRgb.g,
|
|
93
|
-
lRgb.b
|
|
94
|
-
]).map((v) => Math.cbrt(v)));
|
|
95
|
-
const chroma = Math.sqrt(a * a + b * b);
|
|
96
|
-
let hue;
|
|
97
|
-
if (chroma < 1e-4) hue = 0;
|
|
98
|
-
else {
|
|
99
|
-
hue = Math.atan2(b, a) * (180 / Math.PI);
|
|
100
|
-
if (hue < 0) hue += 360;
|
|
101
|
-
}
|
|
102
|
-
return clampOklch({
|
|
103
|
-
l,
|
|
104
|
-
c: chroma,
|
|
105
|
-
h: hue,
|
|
106
|
-
alpha: rgb.alpha
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
const parseOklch = ({ l, c, h, alpha = 1 }) => {
|
|
110
|
-
if (!isPresent(l) || !isPresent(c) || !isPresent(h)) return null;
|
|
111
|
-
return clampOklch({
|
|
112
|
-
l: Number(l),
|
|
113
|
-
c: Number(c),
|
|
114
|
-
h: Number(h),
|
|
115
|
-
alpha: Number(alpha)
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
const parseOklchToRgb = (input) => {
|
|
119
|
-
const oklch = parseOklch(input);
|
|
120
|
-
if (!oklch) return null;
|
|
121
|
-
return oklchToRgb(oklch);
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Parsing syntax: oklch(L c h [/ alpha])
|
|
125
|
-
* - L: <number|percentage>
|
|
126
|
-
* - c: <number>
|
|
127
|
-
* - h: <number>
|
|
128
|
-
* - alpha: <number|percentage>
|
|
129
|
-
*/
|
|
130
|
-
const oklchMatcher = /^oklch\(\s*([+-]?[\d.]+)%?\s+([+-]?[\d.]+)\s+([+-]?[\d.]+)(deg|grad|rad|turn)?(?:\s*\/\s*([+-]?[\d.]+%?))?\s*\)$/i;
|
|
131
|
-
const parseOklchString = (input) => {
|
|
132
|
-
const match = oklchMatcher.exec(input);
|
|
133
|
-
if (!match) return null;
|
|
134
|
-
const [_, l, c, h, unit, alpha] = match;
|
|
135
|
-
return clampOklch({
|
|
136
|
-
l: parseValueToDecimal(l),
|
|
137
|
-
c: Number.parseFloat(c),
|
|
138
|
-
h: parseHue(h, unit),
|
|
139
|
-
alpha: parseAlpha(alpha)
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
const parseOklchStringToRgb = (input) => {
|
|
143
|
-
const oklch = parseOklchString(input);
|
|
144
|
-
if (!oklch) return null;
|
|
145
|
-
return oklchToRgb(oklch);
|
|
146
|
-
};
|
|
147
|
-
const toOklchString = (oklch) => {
|
|
148
|
-
const { l, c, h, alpha } = roundOklch(oklch);
|
|
149
|
-
return alpha < 1 ? `oklch(${l} ${c} ${h} / ${alpha})` : `oklch(${l} ${c} ${h})`;
|
|
150
|
-
};
|
|
151
|
-
const rgbToOklchString = (rgb) => {
|
|
152
|
-
return toOklchString(rgbToOklch(rgb));
|
|
153
|
-
};
|
|
154
|
-
const parseOklchBySource = (source) => {
|
|
155
|
-
if (!source || source.format !== "oklch") return null;
|
|
156
|
-
const { input } = source;
|
|
157
|
-
if (typeof input === "string") return parseOklchString(input);
|
|
158
|
-
if (typeof input === "object") return parseOklch(input);
|
|
159
|
-
return null;
|
|
160
|
-
};
|
|
161
|
-
const toOklchStringBySource = (source) => {
|
|
162
|
-
const oklch = parseOklchBySource(source);
|
|
163
|
-
if (!oklch) return null;
|
|
164
|
-
return toOklchString(oklch);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region src/plugins/oklch.ts
|
|
169
|
-
/**
|
|
170
|
-
* A plugin adding support for OKLCH colorspace.
|
|
171
|
-
* https://bottosson.github.io/posts/oklab/
|
|
172
|
-
*/
|
|
173
|
-
const oklchPlugin = (ColordClass, parsers) => {
|
|
174
|
-
ColordClass.prototype.toOklch = function toOklch() {
|
|
175
|
-
return roundOklch(parseOklchBySource(this.getSource()) || rgbToOklch(this.rgb));
|
|
176
|
-
};
|
|
177
|
-
ColordClass.prototype.toOklchString = function toOklchString$1() {
|
|
178
|
-
return toOklchStringBySource(this.getSource()) || rgbToOklchString(this.rgb);
|
|
179
|
-
};
|
|
180
|
-
parsers.string.push([parseOklchStringToRgb, "oklch"]);
|
|
181
|
-
parsers.object.push([parseOklchToRgb, "oklch"]);
|
|
182
|
-
};
|
|
183
|
-
var oklch_default = oklchPlugin;
|
|
184
|
-
|
|
185
|
-
//#endregion
|
|
186
5
|
export { oklch_default as default, oklchPlugin };
|
package/dist/plugins/xyz.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Plugin } from "../extend-
|
|
1
|
+
import { b as XyzColor } from "../types-B93dJkfp.js";
|
|
2
|
+
import { t as Plugin } from "../extend-DmcZT4-q.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,6 @@
|
|
|
1
|
-
import "../utils-
|
|
2
|
-
import "../rgb-
|
|
3
|
-
import { i as roundXyz, n as parseXyzToRgb, r as rgbToXyz, t as parseXyzBySource } from "../xyz-
|
|
1
|
+
import "../utils-BhDL0kto.js";
|
|
2
|
+
import "../rgb-BIWjP3hJ.js";
|
|
3
|
+
import { i as roundXyz, n as parseXyzToRgb, r as rgbToXyz, t as parseXyzBySource } from "../xyz-Czd8MTub.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/xyz.ts
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isPresent, l as round, o as parseAlpha, t as clamp, v as ALPHA_PRECISION } from "./utils-
|
|
1
|
+
import { i as isPresent, l as round, o as parseAlpha, t as clamp, v as ALPHA_PRECISION } from "./utils-BhDL0kto.js";
|
|
2
2
|
|
|
3
3
|
//#region src/models/rgb.ts
|
|
4
4
|
const clampRgb = (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}, ${g}, ${b}
|
|
143
|
+
return alpha < 1 ? `rgb(${r}, ${g}, ${b} / ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
//#endregion
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type WithAlpha<O> = O & {
|
|
3
|
+
alpha: number;
|
|
4
|
+
};
|
|
5
|
+
type RgbColor = WithAlpha<{
|
|
6
|
+
r: number;
|
|
7
|
+
g: number;
|
|
8
|
+
b: number;
|
|
9
|
+
}>;
|
|
10
|
+
type HslColor = WithAlpha<{
|
|
11
|
+
h: number;
|
|
12
|
+
s: number;
|
|
13
|
+
l: number;
|
|
14
|
+
}>;
|
|
15
|
+
type HsvColor = WithAlpha<{
|
|
16
|
+
h: number;
|
|
17
|
+
s: number;
|
|
18
|
+
v: number;
|
|
19
|
+
}>;
|
|
20
|
+
type HwbColor = WithAlpha<{
|
|
21
|
+
h: number;
|
|
22
|
+
w: number;
|
|
23
|
+
b: number;
|
|
24
|
+
}>;
|
|
25
|
+
type XyzColor = WithAlpha<{
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
z: number;
|
|
29
|
+
}>;
|
|
30
|
+
type LabColor = WithAlpha<{
|
|
31
|
+
l: number;
|
|
32
|
+
a: number;
|
|
33
|
+
b: number;
|
|
34
|
+
}>;
|
|
35
|
+
type LchColor = WithAlpha<{
|
|
36
|
+
l: number;
|
|
37
|
+
c: number;
|
|
38
|
+
h: number;
|
|
39
|
+
}>;
|
|
40
|
+
type CmykColor = WithAlpha<{
|
|
41
|
+
c: number;
|
|
42
|
+
m: number;
|
|
43
|
+
y: number;
|
|
44
|
+
k: number;
|
|
45
|
+
}>;
|
|
46
|
+
type OklabColor = WithAlpha<{
|
|
47
|
+
l: number;
|
|
48
|
+
a: number;
|
|
49
|
+
b: number;
|
|
50
|
+
}>;
|
|
51
|
+
type OklchColor = WithAlpha<{
|
|
52
|
+
l: number;
|
|
53
|
+
c: number;
|
|
54
|
+
h: number;
|
|
55
|
+
}>;
|
|
56
|
+
type PartialAlpha<O> = Omit<O, 'alpha'> & {
|
|
57
|
+
alpha?: number;
|
|
58
|
+
};
|
|
59
|
+
type ObjectColor = PartialAlpha<RgbColor> | PartialAlpha<HslColor> | PartialAlpha<HsvColor> | PartialAlpha<HwbColor> | PartialAlpha<XyzColor> | PartialAlpha<LabColor> | PartialAlpha<LchColor> | PartialAlpha<CmykColor> | PartialAlpha<OklabColor> | PartialAlpha<OklchColor>;
|
|
60
|
+
type AnyColor = string | ObjectColor;
|
|
61
|
+
type InputObject = Record<string, unknown>;
|
|
62
|
+
type Format = 'name' | 'hex' | 'rgb' | 'lrgb' | 'hsl' | 'hsv' | 'hwb' | 'xyz' | 'lab' | 'lch' | 'cmyk' | 'oklab' | 'oklch';
|
|
63
|
+
type Input = string | InputObject;
|
|
64
|
+
interface InputSource {
|
|
65
|
+
format: Format;
|
|
66
|
+
input: Input;
|
|
67
|
+
}
|
|
68
|
+
type ParseFunction<I extends Input> = (input: I) => RgbColor | null;
|
|
69
|
+
type Parser<I extends Input> = [ParseFunction<I>, Format];
|
|
70
|
+
type Parsers = {
|
|
71
|
+
string: Array<Parser<string>>;
|
|
72
|
+
object: Array<Parser<InputObject>>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* the palette color level
|
|
76
|
+
*
|
|
77
|
+
* the main color level is 500
|
|
78
|
+
*/
|
|
79
|
+
type PaletteColorLevel = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
|
|
80
|
+
type TailwindPaletteColorKey = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose';
|
|
81
|
+
/**
|
|
82
|
+
* the tailwind palette color
|
|
83
|
+
*
|
|
84
|
+
* the color format is `oklch` string
|
|
85
|
+
*/
|
|
86
|
+
type TailwindPaletteColor = { [K in TailwindPaletteColorKey]: { [L in PaletteColorLevel]: string } };
|
|
87
|
+
type OutputColorMap = {
|
|
88
|
+
hex: string;
|
|
89
|
+
rgb: RgbColor;
|
|
90
|
+
rgbString: string;
|
|
91
|
+
oklch: OklchColor;
|
|
92
|
+
oklchString: string;
|
|
93
|
+
hsl: HslColor;
|
|
94
|
+
hslString: string;
|
|
95
|
+
};
|
|
96
|
+
type OutputFormat = keyof OutputColorMap;
|
|
97
|
+
interface NearestPalette<F extends OutputFormat> {
|
|
98
|
+
/** current color */
|
|
99
|
+
current: OutputColorMap[F];
|
|
100
|
+
/** palette color key */
|
|
101
|
+
paletteKey: TailwindPaletteColorKey;
|
|
102
|
+
/** palette level */
|
|
103
|
+
level: PaletteColorLevel;
|
|
104
|
+
/** palette color */
|
|
105
|
+
color: OutputColorMap[F];
|
|
106
|
+
/** the color delta value */
|
|
107
|
+
delta: number;
|
|
108
|
+
/** palette colors */
|
|
109
|
+
palette: Record<PaletteColorLevel, OutputColorMap[F]>;
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { Parsers as _, HsvColor as a, XyzColor as b, InputSource as c, NearestPalette as d, OklabColor as f, PaletteColorLevel as g, OutputFormat as h, HslColor as i, LabColor as l, OutputColorMap as m, CmykColor as n, HwbColor as o, OklchColor as p, Format as r, Input as s, AnyColor as t, LchColor as u, RgbColor as v, TailwindPaletteColor as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as mul3x3, b as D65, f as M_SRGB_TO_XYZ_D65, i as isPresent, l as round, p as M_XYZ_D65_TO_SRGB, t as clamp, v as ALPHA_PRECISION } from "./utils-
|
|
2
|
-
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb } from "./rgb-
|
|
1
|
+
import { a as mul3x3, b as D65, f as M_SRGB_TO_XYZ_D65, i as isPresent, l as round, p as M_XYZ_D65_TO_SRGB, t as clamp, v as ALPHA_PRECISION } from "./utils-BhDL0kto.js";
|
|
2
|
+
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb } from "./rgb-BIWjP3hJ.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/xyz.ts
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soybeanjs/colord",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"description": "A tiny yet powerful tool for high-performance color manipulations and conversions",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Soybean",
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"import": "./dist/index.js",
|
|
26
26
|
"require": "./dist/index.js"
|
|
27
27
|
},
|
|
28
|
+
"./palette": {
|
|
29
|
+
"types": "./dist/palette/index.d.ts",
|
|
30
|
+
"import": "./dist/palette/index.js",
|
|
31
|
+
"require": "./dist/palette/index.js"
|
|
32
|
+
},
|
|
28
33
|
"./plugins/*": {
|
|
29
34
|
"types": "./dist/plugins/*.d.ts",
|
|
30
35
|
"import": "./dist/plugins/*.js",
|
|
File without changes
|