@ai-matrx/kit 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/CHANGELOG.md +132 -0
- package/LICENSE +21 -0
- package/README.md +72 -0
- package/dist/autosave.cjs +92 -0
- package/dist/autosave.cjs.map +1 -0
- package/dist/autosave.d.cts +17 -0
- package/dist/autosave.d.ts +17 -0
- package/dist/autosave.js +72 -0
- package/dist/autosave.js.map +1 -0
- package/dist/clipboard.cjs +152 -0
- package/dist/clipboard.cjs.map +1 -0
- package/dist/clipboard.d.cts +17 -0
- package/dist/clipboard.d.ts +17 -0
- package/dist/clipboard.js +132 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/color-util.cjs +790 -0
- package/dist/color-util.cjs.map +1 -0
- package/dist/color-util.d.cts +235 -0
- package/dist/color-util.d.ts +235 -0
- package/dist/color-util.js +767 -0
- package/dist/color-util.js.map +1 -0
- package/dist/concurrency.cjs +59 -0
- package/dist/concurrency.cjs.map +1 -0
- package/dist/concurrency.d.cts +19 -0
- package/dist/concurrency.d.ts +19 -0
- package/dist/concurrency.js +38 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/confirm.cjs +344 -0
- package/dist/confirm.cjs.map +1 -0
- package/dist/confirm.d.cts +132 -0
- package/dist/confirm.d.ts +132 -0
- package/dist/confirm.js +312 -0
- package/dist/confirm.js.map +1 -0
- package/dist/delimiter-guard.cjs +172 -0
- package/dist/delimiter-guard.cjs.map +1 -0
- package/dist/delimiter-guard.d.cts +119 -0
- package/dist/delimiter-guard.d.ts +119 -0
- package/dist/delimiter-guard.js +151 -0
- package/dist/delimiter-guard.js.map +1 -0
- package/dist/drafts.cjs +223 -0
- package/dist/drafts.cjs.map +1 -0
- package/dist/drafts.d.cts +62 -0
- package/dist/drafts.d.ts +62 -0
- package/dist/drafts.js +201 -0
- package/dist/drafts.js.map +1 -0
- package/dist/idb-store.cjs +178 -0
- package/dist/idb-store.cjs.map +1 -0
- package/dist/idb-store.d.cts +111 -0
- package/dist/idb-store.d.ts +111 -0
- package/dist/idb-store.js +155 -0
- package/dist/idb-store.js.map +1 -0
- package/dist/idle-scheduler.cjs +268 -0
- package/dist/idle-scheduler.cjs.map +1 -0
- package/dist/idle-scheduler.d.cts +185 -0
- package/dist/idle-scheduler.d.ts +185 -0
- package/dist/idle-scheduler.js +246 -0
- package/dist/idle-scheduler.js.map +1 -0
- package/dist/index.cjs +3113 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +897 -0
- package/dist/index.d.ts +897 -0
- package/dist/index.js +3088 -0
- package/dist/index.js.map +1 -0
- package/dist/invalidation.cjs +64 -0
- package/dist/invalidation.cjs.map +1 -0
- package/dist/invalidation.d.cts +52 -0
- package/dist/invalidation.d.ts +52 -0
- package/dist/invalidation.js +43 -0
- package/dist/invalidation.js.map +1 -0
- package/dist/json-format.cjs +319 -0
- package/dist/json-format.cjs.map +1 -0
- package/dist/json-format.d.cts +148 -0
- package/dist/json-format.d.ts +148 -0
- package/dist/json-format.js +286 -0
- package/dist/json-format.js.map +1 -0
- package/dist/latest-request.cjs +36 -0
- package/dist/latest-request.cjs.map +1 -0
- package/dist/latest-request.d.cts +29 -0
- package/dist/latest-request.d.ts +29 -0
- package/dist/latest-request.js +16 -0
- package/dist/latest-request.js.map +1 -0
- package/dist/qr.cjs +109 -0
- package/dist/qr.cjs.map +1 -0
- package/dist/qr.d.cts +47 -0
- package/dist/qr.d.ts +47 -0
- package/dist/qr.js +78 -0
- package/dist/qr.js.map +1 -0
- package/dist/react-tree.cjs +69 -0
- package/dist/react-tree.cjs.map +1 -0
- package/dist/react-tree.d.cts +38 -0
- package/dist/react-tree.d.ts +38 -0
- package/dist/react-tree.js +38 -0
- package/dist/react-tree.js.map +1 -0
- package/dist/search-scoring.cjs +116 -0
- package/dist/search-scoring.cjs.map +1 -0
- package/dist/search-scoring.d.cts +77 -0
- package/dist/search-scoring.d.ts +77 -0
- package/dist/search-scoring.js +95 -0
- package/dist/search-scoring.js.map +1 -0
- package/dist/text-case.cjs +313 -0
- package/dist/text-case.cjs.map +1 -0
- package/dist/text-case.d.cts +53 -0
- package/dist/text-case.d.ts +53 -0
- package/dist/text-case.js +292 -0
- package/dist/text-case.js.map +1 -0
- package/dist/toast.cjs +74 -0
- package/dist/toast.cjs.map +1 -0
- package/dist/toast.d.cts +92 -0
- package/dist/toast.d.ts +92 -0
- package/dist/toast.js +54 -0
- package/dist/toast.js.map +1 -0
- package/dist/url-state.cjs +212 -0
- package/dist/url-state.cjs.map +1 -0
- package/dist/url-state.d.cts +90 -0
- package/dist/url-state.d.ts +90 -0
- package/dist/url-state.js +199 -0
- package/dist/url-state.js.map +1 -0
- package/package.json +286 -0
|
@@ -0,0 +1,790 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/color-util.ts
|
|
21
|
+
var color_util_exports = {};
|
|
22
|
+
__export(color_util_exports, {
|
|
23
|
+
createColorNormalizer: () => createColorNormalizer,
|
|
24
|
+
findNearestTailwindColor: () => findNearestTailwindColor,
|
|
25
|
+
formatCmykObject: () => formatCmykObject,
|
|
26
|
+
formatCmykString: () => formatCmykString,
|
|
27
|
+
formatHex: () => formatHex,
|
|
28
|
+
formatHexWith0x: () => formatHexWith0x,
|
|
29
|
+
formatHslObject: () => formatHslObject,
|
|
30
|
+
formatHslString: () => formatHslString,
|
|
31
|
+
formatHsvString: () => formatHsvString,
|
|
32
|
+
formatHwbString: () => formatHwbString,
|
|
33
|
+
formatLabString: () => formatLabString,
|
|
34
|
+
formatLchString: () => formatLchString,
|
|
35
|
+
formatRegularCmykString: () => formatRegularCmykString,
|
|
36
|
+
formatRgbObject: () => formatRgbObject,
|
|
37
|
+
formatRgbString: () => formatRgbString,
|
|
38
|
+
formatTailwindColor: () => formatTailwindColor,
|
|
39
|
+
getColorFromTailwind: () => getColorFromTailwind,
|
|
40
|
+
isDeviceCmyk: () => isDeviceCmyk,
|
|
41
|
+
parseHexOrRgb: () => parseHexOrRgb,
|
|
42
|
+
rgbDelta: () => rgbDelta,
|
|
43
|
+
rgbToLab: () => rgbToLab,
|
|
44
|
+
tailwindColors: () => tailwindColors
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(color_util_exports);
|
|
47
|
+
|
|
48
|
+
// src/color-util/lab-delta.ts
|
|
49
|
+
function round(value, digits = 0) {
|
|
50
|
+
const factor = Math.pow(10, digits);
|
|
51
|
+
return Math.round(factor * value) / factor + 0;
|
|
52
|
+
}
|
|
53
|
+
function clamp(value, min = 0, max = 1) {
|
|
54
|
+
return value > max ? max : value > min ? value : min;
|
|
55
|
+
}
|
|
56
|
+
function linearize(channel) {
|
|
57
|
+
const c = channel / 255;
|
|
58
|
+
return c < 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
59
|
+
}
|
|
60
|
+
var WHITE_X = 96.422;
|
|
61
|
+
var WHITE_Y = 100;
|
|
62
|
+
var WHITE_Z = 82.521;
|
|
63
|
+
var EPSILON = 216 / 24389;
|
|
64
|
+
var KAPPA = 24389 / 27;
|
|
65
|
+
function rgbToXyz(rgb) {
|
|
66
|
+
const r = linearize(rgb.r);
|
|
67
|
+
const g = linearize(rgb.g);
|
|
68
|
+
const b = linearize(rgb.b);
|
|
69
|
+
const d65 = {
|
|
70
|
+
x: 100 * (0.4124564 * r + 0.3575761 * g + 0.1804375 * b),
|
|
71
|
+
y: 100 * (0.2126729 * r + 0.7151522 * g + 0.072175 * b),
|
|
72
|
+
z: 100 * (0.0193339 * r + 0.119192 * g + 0.9503041 * b)
|
|
73
|
+
};
|
|
74
|
+
const d50 = {
|
|
75
|
+
x: 1.0478112 * d65.x + 0.0228866 * d65.y + -0.050127 * d65.z,
|
|
76
|
+
y: 0.0295424 * d65.x + 0.9904844 * d65.y + -0.0170491 * d65.z,
|
|
77
|
+
z: -92345e-7 * d65.x + 0.0150436 * d65.y + 0.7521316 * d65.z
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
x: clamp(d50.x, 0, WHITE_X),
|
|
81
|
+
y: clamp(d50.y, 0, WHITE_Y),
|
|
82
|
+
z: clamp(d50.z, 0, WHITE_Z)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function rgbToLab(rgb) {
|
|
86
|
+
const xyz = rgbToXyz(rgb);
|
|
87
|
+
let x = xyz.x / WHITE_X;
|
|
88
|
+
let y = xyz.y / WHITE_Y;
|
|
89
|
+
let z = xyz.z / WHITE_Z;
|
|
90
|
+
x = x > EPSILON ? Math.cbrt(x) : (KAPPA * x + 16) / 116;
|
|
91
|
+
y = y > EPSILON ? Math.cbrt(y) : (KAPPA * y + 16) / 116;
|
|
92
|
+
z = z > EPSILON ? Math.cbrt(z) : (KAPPA * z + 16) / 116;
|
|
93
|
+
return {
|
|
94
|
+
l: round(116 * y - 16, 2),
|
|
95
|
+
a: round(500 * (x - y), 2),
|
|
96
|
+
b: round(200 * (y - z), 2)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function ciede2000(lab1, lab2) {
|
|
100
|
+
const { l: l1, a: a1, b: b1 } = lab1;
|
|
101
|
+
const { l: l2, a: a2, b: b2 } = lab2;
|
|
102
|
+
const toDeg = 180 / Math.PI;
|
|
103
|
+
const toRad = Math.PI / 180;
|
|
104
|
+
const c1 = Math.pow(Math.pow(a1, 2) + Math.pow(b1, 2), 0.5);
|
|
105
|
+
const c2 = Math.pow(Math.pow(a2, 2) + Math.pow(b2, 2), 0.5);
|
|
106
|
+
const lBar = (l1 + l2) / 2;
|
|
107
|
+
const cBar7 = Math.pow((c1 + c2) / 2, 7);
|
|
108
|
+
const g = 0.5 * (1 - Math.pow(cBar7 / (cBar7 + Math.pow(25, 7)), 0.5));
|
|
109
|
+
const a1p = a1 * (1 + g);
|
|
110
|
+
const a2p = a2 * (1 + g);
|
|
111
|
+
const c1p = Math.pow(Math.pow(a1p, 2) + Math.pow(b1, 2), 0.5);
|
|
112
|
+
const c2p = Math.pow(Math.pow(a2p, 2) + Math.pow(b2, 2), 0.5);
|
|
113
|
+
const cBarP = (c1p + c2p) / 2;
|
|
114
|
+
let h1p = a1p === 0 && b1 === 0 ? 0 : Math.atan2(b1, a1p) * toDeg;
|
|
115
|
+
let h2p = a2p === 0 && b2 === 0 ? 0 : Math.atan2(b2, a2p) * toDeg;
|
|
116
|
+
if (h1p < 0) h1p += 360;
|
|
117
|
+
if (h2p < 0) h2p += 360;
|
|
118
|
+
let dhp = h2p - h1p;
|
|
119
|
+
const hAbs = Math.abs(h2p - h1p);
|
|
120
|
+
if (hAbs > 180 && h2p <= h1p) {
|
|
121
|
+
dhp += 360;
|
|
122
|
+
} else if (hAbs > 180 && h2p > h1p) {
|
|
123
|
+
dhp -= 360;
|
|
124
|
+
}
|
|
125
|
+
let hBarP = h1p + h2p;
|
|
126
|
+
if (hAbs <= 180) {
|
|
127
|
+
hBarP /= 2;
|
|
128
|
+
} else {
|
|
129
|
+
hBarP = (h1p + h2p < 360 ? hBarP + 360 : hBarP - 360) / 2;
|
|
130
|
+
}
|
|
131
|
+
const t = 1 - 0.17 * Math.cos(toRad * (hBarP - 30)) + 0.24 * Math.cos(2 * toRad * hBarP) + 0.32 * Math.cos(toRad * (3 * hBarP + 6)) - 0.2 * Math.cos(toRad * (4 * hBarP - 63));
|
|
132
|
+
const dL = l2 - l1;
|
|
133
|
+
const dCp = c2p - c1p;
|
|
134
|
+
const dHp = 2 * Math.sin(toRad * dhp / 2) * Math.pow(c1p * c2p, 0.5);
|
|
135
|
+
const sl = 1 + 0.015 * Math.pow(lBar - 50, 2) / Math.pow(20 + Math.pow(lBar - 50, 2), 0.5);
|
|
136
|
+
const sc = 1 + 0.045 * cBarP;
|
|
137
|
+
const sh = 1 + 0.015 * cBarP * t;
|
|
138
|
+
const dTheta = 30 * Math.exp(-1 * Math.pow((hBarP - 275) / 25, 2));
|
|
139
|
+
const cBarP7 = Math.pow(cBarP, 7);
|
|
140
|
+
const rt = -2 * Math.pow(cBarP7 / (cBarP7 + Math.pow(25, 7)), 0.5) * Math.sin(2 * toRad * dTheta);
|
|
141
|
+
return Math.pow(
|
|
142
|
+
Math.pow(dL / 1 / sl, 2) + Math.pow(dCp / 1 / sc, 2) + Math.pow(dHp / 1 / sh, 2) + rt * dCp * dHp / (1 * sc * 1 * sh),
|
|
143
|
+
0.5
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
function rgbDelta(rgb1, rgb2) {
|
|
147
|
+
return clamp(round(ciede2000(rgbToLab(rgb1), rgbToLab(rgb2)) / 100, 3));
|
|
148
|
+
}
|
|
149
|
+
var HEX_RE = /^#?([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
150
|
+
var RGB_FN_RE = /^rgba?\(\s*([+-]?[\d.]+)\s*[,\s]\s*([+-]?[\d.]+)\s*[,\s]\s*([+-]?[\d.]+)(?:\s*[,/]\s*[+-]?[\d.]+%?)?\s*\)$/i;
|
|
151
|
+
function parseHexOrRgb(input) {
|
|
152
|
+
const text = input.trim();
|
|
153
|
+
const hexMatch = text.match(HEX_RE);
|
|
154
|
+
if (hexMatch) {
|
|
155
|
+
const hex = hexMatch[1];
|
|
156
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
157
|
+
return {
|
|
158
|
+
r: parseInt(hex[0] + hex[0], 16),
|
|
159
|
+
g: parseInt(hex[1] + hex[1], 16),
|
|
160
|
+
b: parseInt(hex[2] + hex[2], 16)
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
r: parseInt(hex.slice(0, 2), 16),
|
|
165
|
+
g: parseInt(hex.slice(2, 4), 16),
|
|
166
|
+
b: parseInt(hex.slice(4, 6), 16)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
const rgbMatch = text.match(RGB_FN_RE);
|
|
170
|
+
if (rgbMatch) {
|
|
171
|
+
const r = Number(rgbMatch[1]);
|
|
172
|
+
const g = Number(rgbMatch[2]);
|
|
173
|
+
const b = Number(rgbMatch[3]);
|
|
174
|
+
if ([r, g, b].some((v) => Number.isNaN(v))) return null;
|
|
175
|
+
return { r: clamp(r, 0, 255), g: clamp(g, 0, 255), b: clamp(b, 0, 255) };
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/color-util/tailwind-colors.ts
|
|
181
|
+
var tailwindColors = [
|
|
182
|
+
{
|
|
183
|
+
name: "Slate",
|
|
184
|
+
shades: {
|
|
185
|
+
"50": "#f8fafc",
|
|
186
|
+
"100": "#f1f5f9",
|
|
187
|
+
"200": "#e2e8f0",
|
|
188
|
+
"300": "#cbd5e1",
|
|
189
|
+
"400": "#94a3b8",
|
|
190
|
+
"500": "#64748b",
|
|
191
|
+
"600": "#475569",
|
|
192
|
+
"700": "#334155",
|
|
193
|
+
"800": "#1e293b",
|
|
194
|
+
"900": "#0f172a",
|
|
195
|
+
"950": "#020617"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "Gray",
|
|
200
|
+
shades: {
|
|
201
|
+
"50": "#f9fafb",
|
|
202
|
+
"100": "#f3f4f6",
|
|
203
|
+
"200": "#e5e7eb",
|
|
204
|
+
"300": "#d1d5db",
|
|
205
|
+
"400": "#9ca3af",
|
|
206
|
+
"500": "#6b7280",
|
|
207
|
+
"600": "#4b5563",
|
|
208
|
+
"700": "#374151",
|
|
209
|
+
"800": "#1f2937",
|
|
210
|
+
"900": "#111827",
|
|
211
|
+
"950": "#030712"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: "Zinc",
|
|
216
|
+
shades: {
|
|
217
|
+
"50": "#fafafa",
|
|
218
|
+
"100": "#f4f4f5",
|
|
219
|
+
"200": "#e4e4e7",
|
|
220
|
+
"300": "#d4d4d8",
|
|
221
|
+
"400": "#a1a1aa",
|
|
222
|
+
"500": "#71717a",
|
|
223
|
+
"600": "#52525b",
|
|
224
|
+
"700": "#3f3f46",
|
|
225
|
+
"800": "#27272a",
|
|
226
|
+
"900": "#18181b",
|
|
227
|
+
"950": "#09090b"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "Neutral",
|
|
232
|
+
shades: {
|
|
233
|
+
"50": "#fafafa",
|
|
234
|
+
"100": "#f5f5f5",
|
|
235
|
+
"200": "#e5e5e5",
|
|
236
|
+
"300": "#d4d4d4",
|
|
237
|
+
"400": "#a3a3a3",
|
|
238
|
+
"500": "#737373",
|
|
239
|
+
"600": "#525252",
|
|
240
|
+
"700": "#404040",
|
|
241
|
+
"800": "#262626",
|
|
242
|
+
"900": "#171717",
|
|
243
|
+
"950": "#0a0a0a"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: "Stone",
|
|
248
|
+
shades: {
|
|
249
|
+
"50": "#fafaf9",
|
|
250
|
+
"100": "#f5f5f4",
|
|
251
|
+
"200": "#e7e5e4",
|
|
252
|
+
"300": "#d6d3d1",
|
|
253
|
+
"400": "#a8a29e",
|
|
254
|
+
"500": "#78716c",
|
|
255
|
+
"600": "#57534e",
|
|
256
|
+
"700": "#44403c",
|
|
257
|
+
"800": "#292524",
|
|
258
|
+
"900": "#1c1917",
|
|
259
|
+
"950": "#0c0a09"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: "Red",
|
|
264
|
+
shades: {
|
|
265
|
+
"50": "#fef2f2",
|
|
266
|
+
"100": "#fee2e2",
|
|
267
|
+
"200": "#fecaca",
|
|
268
|
+
"300": "#fca5a5",
|
|
269
|
+
"400": "#f87171",
|
|
270
|
+
"500": "#ef4444",
|
|
271
|
+
"600": "#dc2626",
|
|
272
|
+
"700": "#b91c1c",
|
|
273
|
+
"800": "#991b1b",
|
|
274
|
+
"900": "#7f1d1d",
|
|
275
|
+
"950": "#450a0a"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: "Orange",
|
|
280
|
+
shades: {
|
|
281
|
+
"50": "#fff7ed",
|
|
282
|
+
"100": "#ffedd5",
|
|
283
|
+
"200": "#fed7aa",
|
|
284
|
+
"300": "#fdba74",
|
|
285
|
+
"400": "#fb923c",
|
|
286
|
+
"500": "#f97316",
|
|
287
|
+
"600": "#ea580c",
|
|
288
|
+
"700": "#c2410c",
|
|
289
|
+
"800": "#9a3412",
|
|
290
|
+
"900": "#7c2d12",
|
|
291
|
+
"950": "#431407"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "Amber",
|
|
296
|
+
shades: {
|
|
297
|
+
"50": "#fffbeb",
|
|
298
|
+
"100": "#fef3c7",
|
|
299
|
+
"200": "#fde68a",
|
|
300
|
+
"300": "#fcd34d",
|
|
301
|
+
"400": "#fbbf24",
|
|
302
|
+
"500": "#f59e0b",
|
|
303
|
+
"600": "#d97706",
|
|
304
|
+
"700": "#b45309",
|
|
305
|
+
"800": "#92400e",
|
|
306
|
+
"900": "#78350f",
|
|
307
|
+
"950": "#451a03"
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: "Yellow",
|
|
312
|
+
shades: {
|
|
313
|
+
"50": "#fefce8",
|
|
314
|
+
"100": "#fef9c3",
|
|
315
|
+
"200": "#fef08a",
|
|
316
|
+
"300": "#fde047",
|
|
317
|
+
"400": "#facc15",
|
|
318
|
+
"500": "#eab308",
|
|
319
|
+
"600": "#ca8a04",
|
|
320
|
+
"700": "#a16207",
|
|
321
|
+
"800": "#854d0e",
|
|
322
|
+
"900": "#713f12",
|
|
323
|
+
"950": "#422006"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: "Lime",
|
|
328
|
+
shades: {
|
|
329
|
+
"50": "#f7fee7",
|
|
330
|
+
"100": "#ecfccb",
|
|
331
|
+
"200": "#d9f99d",
|
|
332
|
+
"300": "#bef264",
|
|
333
|
+
"400": "#a3e635",
|
|
334
|
+
"500": "#84cc16",
|
|
335
|
+
"600": "#65a30d",
|
|
336
|
+
"700": "#4d7c0f",
|
|
337
|
+
"800": "#3f6212",
|
|
338
|
+
"900": "#365314",
|
|
339
|
+
"950": "#1a2e05"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: "Green",
|
|
344
|
+
shades: {
|
|
345
|
+
"50": "#f0fdf4",
|
|
346
|
+
"100": "#dcfce7",
|
|
347
|
+
"200": "#bbf7d0",
|
|
348
|
+
"300": "#86efac",
|
|
349
|
+
"400": "#4ade80",
|
|
350
|
+
"500": "#22c55e",
|
|
351
|
+
"600": "#16a34a",
|
|
352
|
+
"700": "#15803d",
|
|
353
|
+
"800": "#166534",
|
|
354
|
+
"900": "#14532d",
|
|
355
|
+
"950": "#052e16"
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: "Emerald",
|
|
360
|
+
shades: {
|
|
361
|
+
"50": "#ecfdf5",
|
|
362
|
+
"100": "#d1fae5",
|
|
363
|
+
"200": "#a7f3d0",
|
|
364
|
+
"300": "#6ee7b7",
|
|
365
|
+
"400": "#34d399",
|
|
366
|
+
"500": "#10b981",
|
|
367
|
+
"600": "#059669",
|
|
368
|
+
"700": "#047857",
|
|
369
|
+
"800": "#065f46",
|
|
370
|
+
"900": "#064e3b",
|
|
371
|
+
"950": "#022c22"
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: "Teal",
|
|
376
|
+
shades: {
|
|
377
|
+
"50": "#f0fdfa",
|
|
378
|
+
"100": "#ccfbf1",
|
|
379
|
+
"200": "#99f6e4",
|
|
380
|
+
"300": "#5eead4",
|
|
381
|
+
"400": "#2dd4bf",
|
|
382
|
+
"500": "#14b8a6",
|
|
383
|
+
"600": "#0d9488",
|
|
384
|
+
"700": "#0f766e",
|
|
385
|
+
"800": "#115e59",
|
|
386
|
+
"900": "#134e4a",
|
|
387
|
+
"950": "#042f2e"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: "Cyan",
|
|
392
|
+
shades: {
|
|
393
|
+
"50": "#ecfeff",
|
|
394
|
+
"100": "#cffafe",
|
|
395
|
+
"200": "#a5f3fc",
|
|
396
|
+
"300": "#67e8f9",
|
|
397
|
+
"400": "#22d3ee",
|
|
398
|
+
"500": "#06b6d4",
|
|
399
|
+
"600": "#0891b2",
|
|
400
|
+
"700": "#0e7490",
|
|
401
|
+
"800": "#155e75",
|
|
402
|
+
"900": "#164e63",
|
|
403
|
+
"950": "#083344"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: "Sky",
|
|
408
|
+
shades: {
|
|
409
|
+
"50": "#f0f9ff",
|
|
410
|
+
"100": "#e0f2fe",
|
|
411
|
+
"200": "#bae6fd",
|
|
412
|
+
"300": "#7dd3fc",
|
|
413
|
+
"400": "#38bdf8",
|
|
414
|
+
"500": "#0ea5e9",
|
|
415
|
+
"600": "#0284c7",
|
|
416
|
+
"700": "#0369a1",
|
|
417
|
+
"800": "#075985",
|
|
418
|
+
"900": "#0c4a6e",
|
|
419
|
+
"950": "#082f49"
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: "Blue",
|
|
424
|
+
shades: {
|
|
425
|
+
"50": "#eff6ff",
|
|
426
|
+
"100": "#dbeafe",
|
|
427
|
+
"200": "#bfdbfe",
|
|
428
|
+
"300": "#93c5fd",
|
|
429
|
+
"400": "#60a5fa",
|
|
430
|
+
"500": "#3b82f6",
|
|
431
|
+
"600": "#2563eb",
|
|
432
|
+
"700": "#1d4ed8",
|
|
433
|
+
"800": "#1e40af",
|
|
434
|
+
"900": "#1e3a8a",
|
|
435
|
+
"950": "#172554"
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
name: "Indigo",
|
|
440
|
+
shades: {
|
|
441
|
+
"50": "#eef2ff",
|
|
442
|
+
"100": "#e0e7ff",
|
|
443
|
+
"200": "#c7d2fe",
|
|
444
|
+
"300": "#a5b4fc",
|
|
445
|
+
"400": "#818cf8",
|
|
446
|
+
"500": "#6366f1",
|
|
447
|
+
"600": "#4f46e5",
|
|
448
|
+
"700": "#4338ca",
|
|
449
|
+
"800": "#3730a3",
|
|
450
|
+
"900": "#312e81",
|
|
451
|
+
"950": "#1e1b4b"
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: "Violet",
|
|
456
|
+
shades: {
|
|
457
|
+
"50": "#f5f3ff",
|
|
458
|
+
"100": "#ede9fe",
|
|
459
|
+
"200": "#ddd6fe",
|
|
460
|
+
"300": "#c4b5fd",
|
|
461
|
+
"400": "#a78bfa",
|
|
462
|
+
"500": "#8b5cf6",
|
|
463
|
+
"600": "#7c3aed",
|
|
464
|
+
"700": "#6d28d9",
|
|
465
|
+
"800": "#5b21b6",
|
|
466
|
+
"900": "#4c1d95",
|
|
467
|
+
"950": "#2e1065"
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: "Purple",
|
|
472
|
+
shades: {
|
|
473
|
+
"50": "#faf5ff",
|
|
474
|
+
"100": "#f3e8ff",
|
|
475
|
+
"200": "#e9d5ff",
|
|
476
|
+
"300": "#d8b4fe",
|
|
477
|
+
"400": "#c084fc",
|
|
478
|
+
"500": "#a855f7",
|
|
479
|
+
"600": "#9333ea",
|
|
480
|
+
"700": "#7e22ce",
|
|
481
|
+
"800": "#6b21a8",
|
|
482
|
+
"900": "#581c87",
|
|
483
|
+
"950": "#3b0764"
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
name: "Fuchsia",
|
|
488
|
+
shades: {
|
|
489
|
+
"50": "#fdf4ff",
|
|
490
|
+
"100": "#fae8ff",
|
|
491
|
+
"200": "#f5d0fe",
|
|
492
|
+
"300": "#f0abfc",
|
|
493
|
+
"400": "#e879f9",
|
|
494
|
+
"500": "#d946ef",
|
|
495
|
+
"600": "#c026d3",
|
|
496
|
+
"700": "#a21caf",
|
|
497
|
+
"800": "#86198f",
|
|
498
|
+
"900": "#701a75",
|
|
499
|
+
"950": "#4a044e"
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
name: "Pink",
|
|
504
|
+
shades: {
|
|
505
|
+
"50": "#fdf2f8",
|
|
506
|
+
"100": "#fce7f3",
|
|
507
|
+
"200": "#fbcfe8",
|
|
508
|
+
"300": "#f9a8d4",
|
|
509
|
+
"400": "#f472b6",
|
|
510
|
+
"500": "#ec4899",
|
|
511
|
+
"600": "#db2777",
|
|
512
|
+
"700": "#be185d",
|
|
513
|
+
"800": "#9d174d",
|
|
514
|
+
"900": "#831843",
|
|
515
|
+
"950": "#500724"
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
name: "Rose",
|
|
520
|
+
shades: {
|
|
521
|
+
"50": "#fff1f2",
|
|
522
|
+
"100": "#ffe4e6",
|
|
523
|
+
"200": "#fecdd3",
|
|
524
|
+
"300": "#fda4af",
|
|
525
|
+
"400": "#fb7185",
|
|
526
|
+
"500": "#f43f5e",
|
|
527
|
+
"600": "#e11d48",
|
|
528
|
+
"700": "#be123c",
|
|
529
|
+
"800": "#9f1239",
|
|
530
|
+
"900": "#881337",
|
|
531
|
+
"950": "#4c0519"
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
];
|
|
535
|
+
|
|
536
|
+
// src/color-util/tailwind.ts
|
|
537
|
+
function getColorFromTailwind(tailwindColorString) {
|
|
538
|
+
const [colorName, shade] = tailwindColorString.split("-");
|
|
539
|
+
const colorGroup = tailwindColors.find((group) => group.name.toLowerCase() === (colorName ?? "").toLowerCase());
|
|
540
|
+
if (colorGroup) {
|
|
541
|
+
const shadeEntry = Object.entries(colorGroup.shades).find(([key]) => key === shade);
|
|
542
|
+
if (shadeEntry) {
|
|
543
|
+
return shadeEntry[1];
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return "";
|
|
547
|
+
}
|
|
548
|
+
function findNearestTailwindColor(inputColor) {
|
|
549
|
+
let measure;
|
|
550
|
+
if (typeof inputColor === "string") {
|
|
551
|
+
const rgb = parseHexOrRgb(inputColor);
|
|
552
|
+
if (!rgb) return "";
|
|
553
|
+
measure = (hexValue) => {
|
|
554
|
+
const target = parseHexOrRgb(hexValue);
|
|
555
|
+
return target ? rgbDelta(rgb, target) : Infinity;
|
|
556
|
+
};
|
|
557
|
+
} else {
|
|
558
|
+
measure = (hexValue) => inputColor.delta(hexValue);
|
|
559
|
+
}
|
|
560
|
+
let nearestColor = "";
|
|
561
|
+
let smallestDistance = Infinity;
|
|
562
|
+
tailwindColors.forEach((colorGroup) => {
|
|
563
|
+
Object.entries(colorGroup.shades).forEach(([shade, hexValue]) => {
|
|
564
|
+
const distance = measure(hexValue);
|
|
565
|
+
if (distance < smallestDistance) {
|
|
566
|
+
smallestDistance = distance;
|
|
567
|
+
nearestColor = `${colorGroup.name.toLowerCase()}-${shade}`;
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
});
|
|
571
|
+
return nearestColor;
|
|
572
|
+
}
|
|
573
|
+
function formatTailwindColor(tailwindColor) {
|
|
574
|
+
const tailwindColorNames = [
|
|
575
|
+
"Slate",
|
|
576
|
+
"Gray",
|
|
577
|
+
"Zinc",
|
|
578
|
+
"Neutral",
|
|
579
|
+
"Stone",
|
|
580
|
+
"Red",
|
|
581
|
+
"Orange",
|
|
582
|
+
"Amber",
|
|
583
|
+
"Yellow",
|
|
584
|
+
"Lime",
|
|
585
|
+
"Green",
|
|
586
|
+
"Emerald",
|
|
587
|
+
"Teal",
|
|
588
|
+
"Cyan",
|
|
589
|
+
"Blue",
|
|
590
|
+
"Indigo",
|
|
591
|
+
"Violet",
|
|
592
|
+
"Sky",
|
|
593
|
+
"Purple",
|
|
594
|
+
"Fuchsia",
|
|
595
|
+
"Pink",
|
|
596
|
+
"Rose"
|
|
597
|
+
];
|
|
598
|
+
const splitIndex = tailwindColor.search(/\d/);
|
|
599
|
+
if (splitIndex === -1) {
|
|
600
|
+
const colorName = tailwindColorNames.find((color) => tailwindColor.toLowerCase().includes(color.toLowerCase()));
|
|
601
|
+
if (colorName) {
|
|
602
|
+
return getColorFromTailwind(`${colorName.toLowerCase()}-500`);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
if (splitIndex > 0) {
|
|
606
|
+
const colorNamePart = tailwindColor.slice(0, splitIndex);
|
|
607
|
+
let shadePart = tailwindColor.slice(splitIndex);
|
|
608
|
+
const matchedColors = tailwindColorNames.filter((color) => colorNamePart.toLowerCase().includes(color.toLowerCase()));
|
|
609
|
+
matchedColors.sort((a, b) => colorNamePart.toLowerCase().indexOf(a.toLowerCase()) - colorNamePart.toLowerCase().indexOf(b.toLowerCase()));
|
|
610
|
+
if (matchedColors.length > 0) {
|
|
611
|
+
const colorName = matchedColors[0].toLowerCase();
|
|
612
|
+
let shade = Math.round(parseInt(shadePart) / 100) * 100;
|
|
613
|
+
const formattedColor = getColorFromTailwind(`${colorName}-${shade.toString()}`);
|
|
614
|
+
if (formattedColor) {
|
|
615
|
+
return formattedColor;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return "";
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// src/color-util/formats.ts
|
|
623
|
+
function formatHex(hex) {
|
|
624
|
+
return hex.startsWith("#") ? hex : `#${hex}`;
|
|
625
|
+
}
|
|
626
|
+
function formatRgbString(rgb) {
|
|
627
|
+
const rgbValues = rgb.replace(/[^\d,]/g, "").split(",");
|
|
628
|
+
if (rgbValues.length === 3) {
|
|
629
|
+
return `rgb(${rgbValues[0].trim()}, ${rgbValues[1].trim()}, ${rgbValues[2].trim()})`;
|
|
630
|
+
}
|
|
631
|
+
return "";
|
|
632
|
+
}
|
|
633
|
+
function formatRgbObject(rgbObject) {
|
|
634
|
+
const regex = /["']?r["']?\s*[:=]\s*(\d+)\s*[,]\s*["']?g["']?\s*[:=]\s*(\d+)\s*[,]\s*["']?b["']?\s*[:=]\s*(\d+)(?:\s*[,]\s*["']?a["']?\s*[:=]\s*(\d+))?/i;
|
|
635
|
+
const match = rgbObject.match(regex);
|
|
636
|
+
if (match) {
|
|
637
|
+
const r = match[1], g = match[2], b = match[3], a = match[4] || 1;
|
|
638
|
+
return `{"r":${r},"g":${g},"b":${b},"a":${a}}`;
|
|
639
|
+
}
|
|
640
|
+
return "";
|
|
641
|
+
}
|
|
642
|
+
function formatHslObject(hslObject) {
|
|
643
|
+
const regex = /["']?h["']?\s*[:=]\s*(\d+)\s*,\s*["']?s["']?\s*[:=]\s*(\d+)\s*,\s*["']?l["']?\s*[:=]\s*(\d+)(?:\s*,\s*["']?a["']?\s*[:=]\s*(\d+))?/i;
|
|
644
|
+
const match = hslObject.match(regex);
|
|
645
|
+
if (match) {
|
|
646
|
+
const h = match[1], s = match[2], l = match[3], a = match[4] || 1;
|
|
647
|
+
return `{"h":${h},"s":${s},"l":${l},"a":${a}}`;
|
|
648
|
+
}
|
|
649
|
+
return "";
|
|
650
|
+
}
|
|
651
|
+
function formatHslString(hslString) {
|
|
652
|
+
const hslValues = hslString.replace(/[^\d,%]/g, "").split(/\s*,\s*/);
|
|
653
|
+
if (hslValues.length === 3) {
|
|
654
|
+
return `hsl(${hslValues[0]}, ${hslValues[1]}%, ${hslValues[2]}%)`;
|
|
655
|
+
}
|
|
656
|
+
return "";
|
|
657
|
+
}
|
|
658
|
+
function formatHsvString(hsvString) {
|
|
659
|
+
const hsvValues = hsvString.replace(/[^\d%\s]/g, "").split(/\s+/).map((value) => parseInt(value.replace("%", ""), 10));
|
|
660
|
+
if (hsvValues.length === 3 && hsvValues.every((val) => !isNaN(val))) {
|
|
661
|
+
return `hsv(${hsvValues[0]}, ${hsvValues[1]}%, ${hsvValues[2]}%)`;
|
|
662
|
+
}
|
|
663
|
+
return "";
|
|
664
|
+
}
|
|
665
|
+
function formatRegularCmykString(cmykString) {
|
|
666
|
+
const cmykValues = cmykString.replace(/[^\d,]/g, "").split(/\s*,\s*/);
|
|
667
|
+
if (cmykValues.length === 4 && cmykValues.every((val) => !isNaN(Number(val)))) {
|
|
668
|
+
return `cmyk(${cmykValues[0]}, ${cmykValues[1]}, ${cmykValues[2]}, ${cmykValues[3]})`;
|
|
669
|
+
}
|
|
670
|
+
return "";
|
|
671
|
+
}
|
|
672
|
+
function formatCmykObject(cmykObject) {
|
|
673
|
+
const regex = /["']?c["']?\s*[:=]\s*(\d+)\s*,\s*["']?m["']?\s*[:=]\s*(\d+)\s*,\s*["']?y["']?\s*[:=]\s*(\d+)\s*,\s*["']?k["']?\s*[:=]\s*(\d+)(?:\s*,\s*["']?a["']?\s*[:=]\s*(\d+))?/i;
|
|
674
|
+
const match = cmykObject.match(regex);
|
|
675
|
+
if (match) {
|
|
676
|
+
const c = match[1], m = match[2], y = match[3], k = match[4], a = match[5] || 1;
|
|
677
|
+
return `{"c":${c},"m":${m},"y":${y},"k":${k},"a":${a}}`;
|
|
678
|
+
}
|
|
679
|
+
return "";
|
|
680
|
+
}
|
|
681
|
+
function formatCmykString(cmykString) {
|
|
682
|
+
const cmykValues = cmykString.replace(/[^\d%\s]/g, "").split(/\s+/).map((value) => parseInt(value.replace("%", ""), 10));
|
|
683
|
+
if (cmykValues.length === 4 && cmykValues.every((val) => !isNaN(val))) {
|
|
684
|
+
return `device-cmyk(${cmykValues[0]}% ${cmykValues[1]}% ${cmykValues[2]}% ${cmykValues[3]}%)`;
|
|
685
|
+
}
|
|
686
|
+
return "";
|
|
687
|
+
}
|
|
688
|
+
function isDeviceCmyk(cmykString) {
|
|
689
|
+
const regex = /device-cmyk\(\s*\d+%\s+\d+%\s+\d+%\s+\d+%\s*\)/;
|
|
690
|
+
return regex.test(cmykString);
|
|
691
|
+
}
|
|
692
|
+
function formatHwbString(hwbString) {
|
|
693
|
+
const hwbValues = hwbString.replace(/[^\d,%\s]/g, "").split(/\s+/);
|
|
694
|
+
if (hwbValues.length === 3) {
|
|
695
|
+
return `hwb(${hwbValues[0]}, ${hwbValues[1]}%, ${hwbValues[2]}%)`;
|
|
696
|
+
}
|
|
697
|
+
return "";
|
|
698
|
+
}
|
|
699
|
+
function formatLabString(labString) {
|
|
700
|
+
const match = labString.match(/(?:lab\()?\s*(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)\s*\)?/i);
|
|
701
|
+
if (match) {
|
|
702
|
+
const [, l, a, b] = match;
|
|
703
|
+
return `lab(${l} ${a} ${b})`;
|
|
704
|
+
}
|
|
705
|
+
return "";
|
|
706
|
+
}
|
|
707
|
+
function formatLchString(lchString) {
|
|
708
|
+
const match = lchString.match(/(?:lch\()?\s*(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)\s*\)?/i);
|
|
709
|
+
if (match) {
|
|
710
|
+
const [, l, c, h] = match;
|
|
711
|
+
return `lch(${l} ${c} ${h})`;
|
|
712
|
+
}
|
|
713
|
+
return "";
|
|
714
|
+
}
|
|
715
|
+
function formatHexWith0x(hex) {
|
|
716
|
+
if (hex.startsWith("0x")) {
|
|
717
|
+
return `#${hex.slice(2)}`;
|
|
718
|
+
}
|
|
719
|
+
return "";
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// src/color-util/normalize.ts
|
|
723
|
+
function createColorNormalizer({ isValid }) {
|
|
724
|
+
return function normalizeColorInput(colorInput) {
|
|
725
|
+
if (isValid(colorInput)) {
|
|
726
|
+
return { value: colorInput, type: "standard" };
|
|
727
|
+
}
|
|
728
|
+
if (isDeviceCmyk(colorInput)) {
|
|
729
|
+
return { value: colorInput, type: "device-cmyk" };
|
|
730
|
+
}
|
|
731
|
+
const hex = formatHex(colorInput);
|
|
732
|
+
if (isValid(hex)) {
|
|
733
|
+
return { value: hex, type: "hex" };
|
|
734
|
+
}
|
|
735
|
+
const rgbString = formatRgbString(colorInput);
|
|
736
|
+
if (isValid(rgbString)) {
|
|
737
|
+
return { value: rgbString, type: "rgb" };
|
|
738
|
+
}
|
|
739
|
+
const rgbObject = formatRgbObject(colorInput);
|
|
740
|
+
if (rgbObject !== "") {
|
|
741
|
+
return { value: rgbObject, type: "rgb-object" };
|
|
742
|
+
}
|
|
743
|
+
const hslObject = formatHslObject(colorInput);
|
|
744
|
+
if (hslObject !== "") {
|
|
745
|
+
return { value: hslObject, type: "hsl-object" };
|
|
746
|
+
}
|
|
747
|
+
const hslString = formatHslString(colorInput);
|
|
748
|
+
if (isValid(hslString)) {
|
|
749
|
+
return { value: hslString, type: "hsl" };
|
|
750
|
+
}
|
|
751
|
+
const hsvString = formatHsvString(colorInput);
|
|
752
|
+
if (isValid(hsvString)) {
|
|
753
|
+
return { value: hsvString, type: "hsv" };
|
|
754
|
+
}
|
|
755
|
+
const tailwindColor = formatTailwindColor(colorInput);
|
|
756
|
+
if (tailwindColor !== "") {
|
|
757
|
+
return { value: tailwindColor, type: "tailwind" };
|
|
758
|
+
}
|
|
759
|
+
const regularCmykString = formatRegularCmykString(colorInput);
|
|
760
|
+
if (regularCmykString !== "") {
|
|
761
|
+
return { value: regularCmykString, type: "cmyk" };
|
|
762
|
+
}
|
|
763
|
+
const cmykObject = formatCmykObject(colorInput);
|
|
764
|
+
if (cmykObject !== "") {
|
|
765
|
+
return { value: cmykObject, type: "cmyk-object" };
|
|
766
|
+
}
|
|
767
|
+
const cmykString = formatCmykString(colorInput);
|
|
768
|
+
if (isValid(cmykString)) {
|
|
769
|
+
return { value: cmykString, type: "cmyk-percentage" };
|
|
770
|
+
}
|
|
771
|
+
const hwbString = formatHwbString(colorInput);
|
|
772
|
+
if (isValid(hwbString)) {
|
|
773
|
+
return { value: hwbString, type: "hwb" };
|
|
774
|
+
}
|
|
775
|
+
const labString = formatLabString(colorInput);
|
|
776
|
+
if (labString !== "") {
|
|
777
|
+
return { value: labString, type: "lab" };
|
|
778
|
+
}
|
|
779
|
+
const lchString = formatLchString(colorInput);
|
|
780
|
+
if (lchString !== "") {
|
|
781
|
+
return { value: lchString, type: "lch" };
|
|
782
|
+
}
|
|
783
|
+
const hexWith0x = formatHexWith0x(colorInput);
|
|
784
|
+
if (isValid(hexWith0x)) {
|
|
785
|
+
return { value: hexWith0x, type: "hex-0x" };
|
|
786
|
+
}
|
|
787
|
+
return null;
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
//# sourceMappingURL=color-util.cjs.map
|