tailwindcss-css-variables-color-palette-plugin
Version:
Color Palette plugin using CSS variables for TailwindCSS; forked from tailwindcss-css-variables-palette-plugin
802 lines (801 loc) • 26.3 kB
JavaScript
var $ = {}, I = {};
Object.defineProperty(I, "__esModule", {
value: !0
});
I.default = void 0;
function W(i, a) {
return {
handler: i,
config: a
};
}
W.withOptions = function(i, a = () => ({})) {
const l = function(h) {
return {
__options: h,
handler: i(h),
config: a(h)
};
};
return l.__isOptionsFunction = !0, l.__pluginFunction = i, l.__configFunction = a, l;
};
var ke = W;
I.default = ke;
Object.defineProperty($, "__esModule", {
value: !0
});
$.default = void 0;
var He = we(I);
function we(i) {
return i && i.__esModule ? i : {
default: i
};
}
var Re = He.default;
$.default = Re;
let O = $;
var Fe = (O.__esModule ? O : { default: O }).default, X = { exports: {} };
(function(i) {
(function(a) {
var l = /^\s+/, h = /\s+$/, c = 0, o = a.round, p = a.min, S = a.max, E = a.random;
function u(e, r) {
if (e = e || "", r = r || {}, e instanceof u)
return e;
if (!(this instanceof u))
return new u(e, r);
var t = ee(e);
this._originalInput = e, this._r = t.r, this._g = t.g, this._b = t.b, this._a = t.a, this._roundA = o(100 * this._a) / 100, this._format = r.format || t.format, this._gradientType = r.gradientType, this._r < 1 && (this._r = o(this._r)), this._g < 1 && (this._g = o(this._g)), this._b < 1 && (this._b = o(this._b)), this._ok = t.ok, this._tc_id = c++;
}
u.prototype = {
isDark: function() {
return this.getBrightness() < 128;
},
isLight: function() {
return !this.isDark();
},
isValid: function() {
return this._ok;
},
getOriginalInput: function() {
return this._originalInput;
},
getFormat: function() {
return this._format;
},
getAlpha: function() {
return this._a;
},
getBrightness: function() {
var e = this.toRgb();
return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
},
getLuminance: function() {
var e = this.toRgb(), r, t, n, f, s, g;
return r = e.r / 255, t = e.g / 255, n = e.b / 255, r <= 0.03928 ? f = r / 12.92 : f = a.pow((r + 0.055) / 1.055, 2.4), t <= 0.03928 ? s = t / 12.92 : s = a.pow((t + 0.055) / 1.055, 2.4), n <= 0.03928 ? g = n / 12.92 : g = a.pow((n + 0.055) / 1.055, 2.4), 0.2126 * f + 0.7152 * s + 0.0722 * g;
},
setAlpha: function(e) {
return this._a = D(e), this._roundA = o(100 * this._a) / 100, this;
},
toHsv: function() {
var e = L(this._r, this._g, this._b);
return { h: e.h * 360, s: e.s, v: e.v, a: this._a };
},
toHsvString: function() {
var e = L(this._r, this._g, this._b), r = o(e.h * 360), t = o(e.s * 100), n = o(e.v * 100);
return this._a == 1 ? "hsv(" + r + ", " + t + "%, " + n + "%)" : "hsva(" + r + ", " + t + "%, " + n + "%, " + this._roundA + ")";
},
toHsl: function() {
var e = N(this._r, this._g, this._b);
return { h: e.h * 360, s: e.s, l: e.l, a: this._a };
},
toHslString: function() {
var e = N(this._r, this._g, this._b), r = o(e.h * 360), t = o(e.s * 100), n = o(e.l * 100);
return this._a == 1 ? "hsl(" + r + ", " + t + "%, " + n + "%)" : "hsla(" + r + ", " + t + "%, " + n + "%, " + this._roundA + ")";
},
toHex: function(e) {
return B(this._r, this._g, this._b, e);
},
toHexString: function(e) {
return "#" + this.toHex(e);
},
toHex8: function(e) {
return ae(this._r, this._g, this._b, this._a, e);
},
toHex8String: function(e) {
return "#" + this.toHex8(e);
},
toRgb: function() {
return { r: o(this._r), g: o(this._g), b: o(this._b), a: this._a };
},
toRgbString: function() {
return this._a == 1 ? "rgb(" + o(this._r) + ", " + o(this._g) + ", " + o(this._b) + ")" : "rgba(" + o(this._r) + ", " + o(this._g) + ", " + o(this._b) + ", " + this._roundA + ")";
},
toPercentageRgb: function() {
return { r: o(d(this._r, 255) * 100) + "%", g: o(d(this._g, 255) * 100) + "%", b: o(d(this._b, 255) * 100) + "%", a: this._a };
},
toPercentageRgbString: function() {
return this._a == 1 ? "rgb(" + o(d(this._r, 255) * 100) + "%, " + o(d(this._g, 255) * 100) + "%, " + o(d(this._b, 255) * 100) + "%)" : "rgba(" + o(d(this._r, 255) * 100) + "%, " + o(d(this._g, 255) * 100) + "%, " + o(d(this._b, 255) * 100) + "%, " + this._roundA + ")";
},
toName: function() {
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : pe[B(this._r, this._g, this._b, !0)] || !1;
},
toFilter: function(e) {
var r = "#" + z(this._r, this._g, this._b, this._a), t = r, n = this._gradientType ? "GradientType = 1, " : "";
if (e) {
var f = u(e);
t = "#" + z(f._r, f._g, f._b, f._a);
}
return "progid:DXImageTransform.Microsoft.gradient(" + n + "startColorstr=" + r + ",endColorstr=" + t + ")";
},
toString: function(e) {
var r = !!e;
e = e || this._format;
var t = !1, n = this._a < 1 && this._a >= 0, f = !r && n && (e === "hex" || e === "hex6" || e === "hex3" || e === "hex4" || e === "hex8" || e === "name");
return f ? e === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (t = this.toRgbString()), e === "prgb" && (t = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (t = this.toHexString()), e === "hex3" && (t = this.toHexString(!0)), e === "hex4" && (t = this.toHex8String(!0)), e === "hex8" && (t = this.toHex8String()), e === "name" && (t = this.toName()), e === "hsl" && (t = this.toHslString()), e === "hsv" && (t = this.toHsvString()), t || this.toHexString());
},
clone: function() {
return u(this.toString());
},
_applyModification: function(e, r) {
var t = e.apply(null, [this].concat([].slice.call(r)));
return this._r = t._r, this._g = t._g, this._b = t._b, this.setAlpha(t._a), this;
},
lighten: function() {
return this._applyModification(ue, arguments);
},
brighten: function() {
return this._applyModification(he, arguments);
},
darken: function() {
return this._applyModification(oe, arguments);
},
desaturate: function() {
return this._applyModification(ie, arguments);
},
saturate: function() {
return this._applyModification(se, arguments);
},
greyscale: function() {
return this._applyModification(fe, arguments);
},
spin: function() {
return this._applyModification(le, arguments);
},
_applyCombination: function(e, r) {
return e.apply(null, [this].concat([].slice.call(r)));
},
analogous: function() {
return this._applyCombination(ve, arguments);
},
complement: function() {
return this._applyCombination(ce, arguments);
},
monochromatic: function() {
return this._applyCombination(_e, arguments);
},
splitcomplement: function() {
return this._applyCombination(be, arguments);
},
triad: function() {
return this._applyCombination(ge, arguments);
},
tetrad: function() {
return this._applyCombination(de, arguments);
}
}, u.fromRatio = function(e, r) {
if (typeof e == "object") {
var t = {};
for (var n in e)
e.hasOwnProperty(n) && (n === "a" ? t[n] = e[n] : t[n] = H(e[n]));
e = t;
}
return u(e, r);
};
function ee(e) {
var r = { r: 0, g: 0, b: 0 }, t = 1, n = null, f = null, s = null, g = !1, b = !1;
return typeof e == "string" && (e = Ae(e)), typeof e == "object" && (k(e.r) && k(e.g) && k(e.b) ? (r = te(e.r, e.g, e.b), g = !0, b = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : k(e.h) && k(e.s) && k(e.v) ? (n = H(e.s), f = H(e.v), r = ne(e.h, n, f), g = !0, b = "hsv") : k(e.h) && k(e.s) && k(e.l) && (n = H(e.s), s = H(e.l), r = re(e.h, n, s), g = !0, b = "hsl"), e.hasOwnProperty("a") && (t = e.a)), t = D(t), {
ok: g,
format: e.format || b,
r: p(255, S(r.r, 0)),
g: p(255, S(r.g, 0)),
b: p(255, S(r.b, 0)),
a: t
};
}
function te(e, r, t) {
return {
r: d(e, 255) * 255,
g: d(r, 255) * 255,
b: d(t, 255) * 255
};
}
function N(e, r, t) {
e = d(e, 255), r = d(r, 255), t = d(t, 255);
var n = S(e, r, t), f = p(e, r, t), s, g, b = (n + f) / 2;
if (n == f)
s = g = 0;
else {
var v = n - f;
switch (g = b > 0.5 ? v / (2 - n - f) : v / (n + f), n) {
case e:
s = (r - t) / v + (r < t ? 6 : 0);
break;
case r:
s = (t - e) / v + 2;
break;
case t:
s = (e - r) / v + 4;
break;
}
s /= 6;
}
return { h: s, s: g, l: b };
}
function re(e, r, t) {
var n, f, s;
e = d(e, 360), r = d(r, 100), t = d(t, 100);
function g(m, w, A) {
return A < 0 && (A += 1), A > 1 && (A -= 1), A < 1 / 6 ? m + (w - m) * 6 * A : A < 1 / 2 ? w : A < 2 / 3 ? m + (w - m) * (2 / 3 - A) * 6 : m;
}
if (r === 0)
n = f = s = t;
else {
var b = t < 0.5 ? t * (1 + r) : t + r - t * r, v = 2 * t - b;
n = g(v, b, e + 1 / 3), f = g(v, b, e), s = g(v, b, e - 1 / 3);
}
return { r: n * 255, g: f * 255, b: s * 255 };
}
function L(e, r, t) {
e = d(e, 255), r = d(r, 255), t = d(t, 255);
var n = S(e, r, t), f = p(e, r, t), s, g, b = n, v = n - f;
if (g = n === 0 ? 0 : v / n, n == f)
s = 0;
else {
switch (n) {
case e:
s = (r - t) / v + (r < t ? 6 : 0);
break;
case r:
s = (t - e) / v + 2;
break;
case t:
s = (e - r) / v + 4;
break;
}
s /= 6;
}
return { h: s, s: g, v: b };
}
function ne(e, r, t) {
e = d(e, 360) * 6, r = d(r, 100), t = d(t, 100);
var n = a.floor(e), f = e - n, s = t * (1 - r), g = t * (1 - f * r), b = t * (1 - (1 - f) * r), v = n % 6, m = [t, g, s, s, b, t][v], w = [b, t, t, g, s, s][v], A = [s, s, b, t, t, g][v];
return { r: m * 255, g: w * 255, b: A * 255 };
}
function B(e, r, t, n) {
var f = [
x(o(e).toString(16)),
x(o(r).toString(16)),
x(o(t).toString(16))
];
return n && f[0].charAt(0) == f[0].charAt(1) && f[1].charAt(0) == f[1].charAt(1) && f[2].charAt(0) == f[2].charAt(1) ? f[0].charAt(0) + f[1].charAt(0) + f[2].charAt(0) : f.join("");
}
function ae(e, r, t, n, f) {
var s = [
x(o(e).toString(16)),
x(o(r).toString(16)),
x(o(t).toString(16)),
x(U(n))
];
return f && s[0].charAt(0) == s[0].charAt(1) && s[1].charAt(0) == s[1].charAt(1) && s[2].charAt(0) == s[2].charAt(1) && s[3].charAt(0) == s[3].charAt(1) ? s[0].charAt(0) + s[1].charAt(0) + s[2].charAt(0) + s[3].charAt(0) : s.join("");
}
function z(e, r, t, n) {
var f = [
x(U(n)),
x(o(e).toString(16)),
x(o(r).toString(16)),
x(o(t).toString(16))
];
return f.join("");
}
u.equals = function(e, r) {
return !e || !r ? !1 : u(e).toRgbString() == u(r).toRgbString();
}, u.random = function() {
return u.fromRatio({
r: E(),
g: E(),
b: E()
});
};
function ie(e, r) {
r = r === 0 ? 0 : r || 10;
var t = u(e).toHsl();
return t.s -= r / 100, t.s = T(t.s), u(t);
}
function se(e, r) {
r = r === 0 ? 0 : r || 10;
var t = u(e).toHsl();
return t.s += r / 100, t.s = T(t.s), u(t);
}
function fe(e) {
return u(e).desaturate(100);
}
function ue(e, r) {
r = r === 0 ? 0 : r || 10;
var t = u(e).toHsl();
return t.l += r / 100, t.l = T(t.l), u(t);
}
function he(e, r) {
r = r === 0 ? 0 : r || 10;
var t = u(e).toRgb();
return t.r = S(0, p(255, t.r - o(255 * -(r / 100)))), t.g = S(0, p(255, t.g - o(255 * -(r / 100)))), t.b = S(0, p(255, t.b - o(255 * -(r / 100)))), u(t);
}
function oe(e, r) {
r = r === 0 ? 0 : r || 10;
var t = u(e).toHsl();
return t.l -= r / 100, t.l = T(t.l), u(t);
}
function le(e, r) {
var t = u(e).toHsl(), n = (t.h + r) % 360;
return t.h = n < 0 ? 360 + n : n, u(t);
}
function ce(e) {
var r = u(e).toHsl();
return r.h = (r.h + 180) % 360, u(r);
}
function ge(e) {
var r = u(e).toHsl(), t = r.h;
return [
u(e),
u({ h: (t + 120) % 360, s: r.s, l: r.l }),
u({ h: (t + 240) % 360, s: r.s, l: r.l })
];
}
function de(e) {
var r = u(e).toHsl(), t = r.h;
return [
u(e),
u({ h: (t + 90) % 360, s: r.s, l: r.l }),
u({ h: (t + 180) % 360, s: r.s, l: r.l }),
u({ h: (t + 270) % 360, s: r.s, l: r.l })
];
}
function be(e) {
var r = u(e).toHsl(), t = r.h;
return [
u(e),
u({ h: (t + 72) % 360, s: r.s, l: r.l }),
u({ h: (t + 216) % 360, s: r.s, l: r.l })
];
}
function ve(e, r, t) {
r = r || 6, t = t || 30;
var n = u(e).toHsl(), f = 360 / t, s = [u(e)];
for (n.h = (n.h - (f * r >> 1) + 720) % 360; --r; )
n.h = (n.h + f) % 360, s.push(u(n));
return s;
}
function _e(e, r) {
r = r || 6;
for (var t = u(e).toHsv(), n = t.h, f = t.s, s = t.v, g = [], b = 1 / r; r--; )
g.push(u({ h: n, s: f, v: s })), s = (s + b) % 1;
return g;
}
u.mix = function(e, r, t) {
t = t === 0 ? 0 : t || 50;
var n = u(e).toRgb(), f = u(r).toRgb(), s = t / 100, g = {
r: (f.r - n.r) * s + n.r,
g: (f.g - n.g) * s + n.g,
b: (f.b - n.b) * s + n.b,
a: (f.a - n.a) * s + n.a
};
return u(g);
}, u.readability = function(e, r) {
var t = u(e), n = u(r);
return (a.max(t.getLuminance(), n.getLuminance()) + 0.05) / (a.min(t.getLuminance(), n.getLuminance()) + 0.05);
}, u.isReadable = function(e, r, t) {
var n = u.readability(e, r), f, s;
switch (s = !1, f = Se(t), f.level + f.size) {
case "AAsmall":
case "AAAlarge":
s = n >= 4.5;
break;
case "AAlarge":
s = n >= 3;
break;
case "AAAsmall":
s = n >= 7;
break;
}
return s;
}, u.mostReadable = function(e, r, t) {
var n = null, f = 0, s, g, b, v;
t = t || {}, g = t.includeFallbackColors, b = t.level, v = t.size;
for (var m = 0; m < r.length; m++)
s = u.readability(e, r[m]), s > f && (f = s, n = u(r[m]));
return u.isReadable(e, n, { level: b, size: v }) || !g ? n : (t.includeFallbackColors = !1, u.mostReadable(e, ["#fff", "#000"], t));
};
var C = u.names = {
aliceblue: "f0f8ff",
antiquewhite: "faebd7",
aqua: "0ff",
aquamarine: "7fffd4",
azure: "f0ffff",
beige: "f5f5dc",
bisque: "ffe4c4",
black: "000",
blanchedalmond: "ffebcd",
blue: "00f",
blueviolet: "8a2be2",
brown: "a52a2a",
burlywood: "deb887",
burntsienna: "ea7e5d",
cadetblue: "5f9ea0",
chartreuse: "7fff00",
chocolate: "d2691e",
coral: "ff7f50",
cornflowerblue: "6495ed",
cornsilk: "fff8dc",
crimson: "dc143c",
cyan: "0ff",
darkblue: "00008b",
darkcyan: "008b8b",
darkgoldenrod: "b8860b",
darkgray: "a9a9a9",
darkgreen: "006400",
darkgrey: "a9a9a9",
darkkhaki: "bdb76b",
darkmagenta: "8b008b",
darkolivegreen: "556b2f",
darkorange: "ff8c00",
darkorchid: "9932cc",
darkred: "8b0000",
darksalmon: "e9967a",
darkseagreen: "8fbc8f",
darkslateblue: "483d8b",
darkslategray: "2f4f4f",
darkslategrey: "2f4f4f",
darkturquoise: "00ced1",
darkviolet: "9400d3",
deeppink: "ff1493",
deepskyblue: "00bfff",
dimgray: "696969",
dimgrey: "696969",
dodgerblue: "1e90ff",
firebrick: "b22222",
floralwhite: "fffaf0",
forestgreen: "228b22",
fuchsia: "f0f",
gainsboro: "dcdcdc",
ghostwhite: "f8f8ff",
gold: "ffd700",
goldenrod: "daa520",
gray: "808080",
green: "008000",
greenyellow: "adff2f",
grey: "808080",
honeydew: "f0fff0",
hotpink: "ff69b4",
indianred: "cd5c5c",
indigo: "4b0082",
ivory: "fffff0",
khaki: "f0e68c",
lavender: "e6e6fa",
lavenderblush: "fff0f5",
lawngreen: "7cfc00",
lemonchiffon: "fffacd",
lightblue: "add8e6",
lightcoral: "f08080",
lightcyan: "e0ffff",
lightgoldenrodyellow: "fafad2",
lightgray: "d3d3d3",
lightgreen: "90ee90",
lightgrey: "d3d3d3",
lightpink: "ffb6c1",
lightsalmon: "ffa07a",
lightseagreen: "20b2aa",
lightskyblue: "87cefa",
lightslategray: "789",
lightslategrey: "789",
lightsteelblue: "b0c4de",
lightyellow: "ffffe0",
lime: "0f0",
limegreen: "32cd32",
linen: "faf0e6",
magenta: "f0f",
maroon: "800000",
mediumaquamarine: "66cdaa",
mediumblue: "0000cd",
mediumorchid: "ba55d3",
mediumpurple: "9370db",
mediumseagreen: "3cb371",
mediumslateblue: "7b68ee",
mediumspringgreen: "00fa9a",
mediumturquoise: "48d1cc",
mediumvioletred: "c71585",
midnightblue: "191970",
mintcream: "f5fffa",
mistyrose: "ffe4e1",
moccasin: "ffe4b5",
navajowhite: "ffdead",
navy: "000080",
oldlace: "fdf5e6",
olive: "808000",
olivedrab: "6b8e23",
orange: "ffa500",
orangered: "ff4500",
orchid: "da70d6",
palegoldenrod: "eee8aa",
palegreen: "98fb98",
paleturquoise: "afeeee",
palevioletred: "db7093",
papayawhip: "ffefd5",
peachpuff: "ffdab9",
peru: "cd853f",
pink: "ffc0cb",
plum: "dda0dd",
powderblue: "b0e0e6",
purple: "800080",
rebeccapurple: "663399",
red: "f00",
rosybrown: "bc8f8f",
royalblue: "4169e1",
saddlebrown: "8b4513",
salmon: "fa8072",
sandybrown: "f4a460",
seagreen: "2e8b57",
seashell: "fff5ee",
sienna: "a0522d",
silver: "c0c0c0",
skyblue: "87ceeb",
slateblue: "6a5acd",
slategray: "708090",
slategrey: "708090",
snow: "fffafa",
springgreen: "00ff7f",
steelblue: "4682b4",
tan: "d2b48c",
teal: "008080",
thistle: "d8bfd8",
tomato: "ff6347",
turquoise: "40e0d0",
violet: "ee82ee",
wheat: "f5deb3",
white: "fff",
whitesmoke: "f5f5f5",
yellow: "ff0",
yellowgreen: "9acd32"
}, pe = u.hexNames = me(C);
function me(e) {
var r = {};
for (var t in e)
e.hasOwnProperty(t) && (r[e[t]] = t);
return r;
}
function D(e) {
return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
}
function d(e, r) {
xe(e) && (e = "100%");
var t = ye(e);
return e = p(r, S(0, parseFloat(e))), t && (e = parseInt(e * r, 10) / 100), a.abs(e - r) < 1e-6 ? 1 : e % r / parseFloat(r);
}
function T(e) {
return p(1, S(0, e));
}
function _(e) {
return parseInt(e, 16);
}
function xe(e) {
return typeof e == "string" && e.indexOf(".") != -1 && parseFloat(e) === 1;
}
function ye(e) {
return typeof e == "string" && e.indexOf("%") != -1;
}
function x(e) {
return e.length == 1 ? "0" + e : "" + e;
}
function H(e) {
return e <= 1 && (e = e * 100 + "%"), e;
}
function U(e) {
return a.round(parseFloat(e) * 255).toString(16);
}
function j(e) {
return _(e) / 255;
}
var y = function() {
var e = "[-\\+]?\\d+%?", r = "[-\\+]?\\d*\\.\\d+%?", t = "(?:" + r + ")|(?:" + e + ")", n = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?", f = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?";
return {
CSS_UNIT: new RegExp(t),
rgb: new RegExp("rgb" + n),
rgba: new RegExp("rgba" + f),
hsl: new RegExp("hsl" + n),
hsla: new RegExp("hsla" + f),
hsv: new RegExp("hsv" + n),
hsva: new RegExp("hsva" + f),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
}();
function k(e) {
return !!y.CSS_UNIT.exec(e);
}
function Ae(e) {
e = e.replace(l, "").replace(h, "").toLowerCase();
var r = !1;
if (C[e])
e = C[e], r = !0;
else if (e == "transparent")
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
var t;
return (t = y.rgb.exec(e)) ? { r: t[1], g: t[2], b: t[3] } : (t = y.rgba.exec(e)) ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = y.hsl.exec(e)) ? { h: t[1], s: t[2], l: t[3] } : (t = y.hsla.exec(e)) ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = y.hsv.exec(e)) ? { h: t[1], s: t[2], v: t[3] } : (t = y.hsva.exec(e)) ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = y.hex8.exec(e)) ? {
r: _(t[1]),
g: _(t[2]),
b: _(t[3]),
a: j(t[4]),
format: r ? "name" : "hex8"
} : (t = y.hex6.exec(e)) ? {
r: _(t[1]),
g: _(t[2]),
b: _(t[3]),
format: r ? "name" : "hex"
} : (t = y.hex4.exec(e)) ? {
r: _(t[1] + "" + t[1]),
g: _(t[2] + "" + t[2]),
b: _(t[3] + "" + t[3]),
a: j(t[4] + "" + t[4]),
format: r ? "name" : "hex8"
} : (t = y.hex3.exec(e)) ? {
r: _(t[1] + "" + t[1]),
g: _(t[2] + "" + t[2]),
b: _(t[3] + "" + t[3]),
format: r ? "name" : "hex"
} : !1;
}
function Se(e) {
var r, t;
return e = e || { level: "AA", size: "small" }, r = (e.level || "AA").toUpperCase(), t = (e.size || "small").toLowerCase(), r !== "AA" && r !== "AAA" && (r = "AA"), t !== "small" && t !== "large" && (t = "small"), { level: r, size: t };
}
i.exports ? i.exports = u : window.tinycolor = u;
})(Math);
})(X);
const M = X.exports, P = 2, Z = 5, Te = 4, Pe = 0.16, Me = 0.05, $e = 0.05, Ie = 0.15, G = (i, a, l) => {
let h;
return Math.round(i.h) >= 60 && Math.round(i.h) <= 240 ? h = l ? Math.round(i.h) - P * a : Math.round(i.h) + P * a : h = l ? Math.round(i.h) + P * a : Math.round(i.h) - P * a, (h < 0 || h >= 360) && (h = Math.abs(Math.abs(h) - 360)), h;
}, V = (i, a, l) => {
if (i.h === 0 && i.s === 0)
return i.s;
let h = l ? i.s - Pe * a : i.s + Me * a;
return h > 1 && (h = 1), h < 0.06 && (h = 0.06), l && a === Z && h > 0.1 && (h = 0.1), Number(h.toFixed(2));
}, q = (i, a, l) => {
let h;
return h = l ? i.v + $e * a : i.v - Ie * a, h > 1 && (h = 1), Number(h.toFixed(2));
}, Ee = (i) => {
const a = [], l = M(i), h = l.toHsv();
for (let c = Z; c > 0; c -= 1) {
const o = M({
h: G(h, c, !0),
s: V(h, c, !0),
v: q(h, c, !0)
}).toHexString();
a.push(o);
}
a.push(i);
for (let c = 1; c <= Te; c += 1) {
const o = M({
h: G(h, c),
s: V(h, c),
v: q(h, c)
}).toHexString();
a.push(o);
}
return {
DEFAULT: l.toHexString(),
50: a[0],
100: a[1],
200: a[2],
300: a[3],
400: a[4],
500: l.toHexString(),
600: a[6],
700: a[7],
800: a[8],
900: a[9]
};
};
function J(i) {
const a = i.replace(/##/g, "#"), l = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);
if (!l)
return null;
const [, h, c, o] = l;
return {
r: parseInt(h, 16),
g: parseInt(c, 16),
b: parseInt(o, 16)
};
}
function Q(i, a, l) {
const h = (c) => `0${c.toString(16)}`.slice(-2);
return `#${h(i)}${h(a)}${h(l)}`;
}
const R = (i, a) => {
const l = J(`#${i}`);
if (!l)
return "";
const h = Math.round(l.r + (255 - l.r) * a), c = Math.round(l.g + (255 - l.g) * a), o = Math.round(l.b + (255 - l.b) * a);
return Q(h, c, o);
}, F = (i, a) => {
const l = J(i);
if (!l)
return "";
const h = Math.round(l.r * a), c = Math.round(l.g * a), o = Math.round(l.b * a);
return Q(h, c, o);
}, Y = (i) => {
i = M(i).toHexString();
const a = {
50: 0.9,
100: 0.8,
200: 0.6,
300: 0.4,
400: 0.2,
600: 0.8,
700: 0.6,
800: 0.4,
900: 0.2,
950: 0.1
};
return {
DEFAULT: i,
50: R(i, a[50]),
100: R(i, a[100]),
200: R(i, a[200]),
300: R(i, a[300]),
400: R(i, a[400]),
500: i,
600: F(i, a[600]),
700: F(i, a[700]),
800: F(i, a[800]),
900: F(i, a[900]),
950: F(i, a[950])
};
}, Ce = (i, a, l) => {
let h;
return l === "antd" ? h = Ee(a) : h = Y(a), h;
}, Oe = (i, a) => {
const l = Object.keys(i).map((c) => ({ name: c, value: i[c] })), h = {};
return l.forEach((c) => {
const o = Ce(c.name, c.value, a);
h[c.name] = o;
}), h;
}, K = (i, a = "") => Object.keys(i).reduce((l, h) => {
const c = i[h], o = h === "DEFAULT" ? { [`--color${a}`]: c } : { [`--color${a}-${h}`]: c }, p = typeof c == "string" ? o : K(c, `-${h}`);
return { ...l, ...p };
}, {}), Ne = Fe.withOptions(function(i) {
return function({ addBase: a, theme: l }) {
a({
":root": K(l("colors"))
});
};
}, function(i) {
const a = Oe(i == null ? void 0 : i.colors, i == null ? void 0 : i.algo);
return {
content: [],
theme: {
extend: {
colors: {
inherit: "inherit",
current: "currentColor",
transparent: "transparent",
black: "#000",
white: "#fff",
...a
}
}
}
};
}), Le = { paletteCssVariablesPlugin: Ne, generatePalette: Y };
export {
Le as default
};