Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tinycolor2

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinycolor2 - npm Package Compare versions

Comparing version 1.6.0-beta.8 to 1.6.0-beta.9

570

cjs/tinycolor.js

@@ -8,8 +8,17 @@ // This file is autogenerated. It's used to publish CJS to npm.

function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
// https://github.com/bgrins/TinyColor
// Brian Grinstead, MIT License
const trimLeft = /^\s+/;
const trimRight = /\s+$/;
var trimLeft = /^\s+/;
var trimRight = /\s+$/;
function tinycolor(color, opts) {

@@ -27,11 +36,4 @@ color = color ? color : "";

}
var rgb = inputToRGB(color);
(this._originalInput = color),
(this._r = rgb.r),
(this._g = rgb.g),
(this._b = rgb.b),
(this._a = rgb.a),
(this._roundA = Math.round(100 * this._a) / 100),
(this._format = opts.format || rgb.format);
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
this._gradientType = opts.gradientType;

@@ -46,26 +48,24 @@

if (this._b < 1) this._b = Math.round(this._b);
this._ok = rgb.ok;
}
tinycolor.prototype = {
isDark: function () {
isDark: function isDark() {
return this.getBrightness() < 128;
},
isLight: function () {
isLight: function isLight() {
return !this.isDark();
},
isValid: function () {
isValid: function isValid() {
return this._ok;
},
getOriginalInput: function () {
getOriginalInput: function getOriginalInput() {
return this._originalInput;
},
getFormat: function () {
getFormat: function getFormat() {
return this._format;
},
getAlpha: function () {
getAlpha: function getAlpha() {
return this._a;
},
getBrightness: function () {
getBrightness: function getBrightness() {
//http://www.w3.org/TR/AERT#color-contrast

@@ -75,3 +75,3 @@ var rgb = this.toRgb();

},
getLuminance: function () {
getLuminance: function getLuminance() {
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef

@@ -83,12 +83,8 @@ var rgb = this.toRgb();

BsRGB = rgb.b / 255;
if (RsRGB <= 0.03928) R = RsRGB / 12.92;
else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
},
setAlpha: function (value) {
setAlpha: function setAlpha(value) {
this._a = boundAlpha(value);

@@ -98,7 +94,12 @@ this._roundA = Math.round(100 * this._a) / 100;

},
toHsv: function () {
toHsv: function toHsv() {
var hsv = rgbToHsv(this._r, this._g, this._b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
return {
h: hsv.h * 360,
s: hsv.s,
v: hsv.v,
a: this._a
};
},
toHsvString: function () {
toHsvString: function toHsvString() {
var hsv = rgbToHsv(this._r, this._g, this._b);

@@ -108,11 +109,14 @@ var h = Math.round(hsv.h * 360),

v = Math.round(hsv.v * 100);
return this._a == 1
? "hsv(" + h + ", " + s + "%, " + v + "%)"
: "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
},
toHsl: function () {
toHsl: function toHsl() {
var hsl = rgbToHsl(this._r, this._g, this._b);
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
return {
h: hsl.h * 360,
s: hsl.s,
l: hsl.l,
a: this._a
};
},
toHslString: function () {
toHslString: function toHslString() {
var hsl = rgbToHsl(this._r, this._g, this._b);

@@ -122,19 +126,17 @@ var h = Math.round(hsl.h * 360),

l = Math.round(hsl.l * 100);
return this._a == 1
? "hsl(" + h + ", " + s + "%, " + l + "%)"
: "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
},
toHex: function (allow3Char) {
toHex: function toHex(allow3Char) {
return rgbToHex(this._r, this._g, this._b, allow3Char);
},
toHexString: function (allow3Char) {
toHexString: function toHexString(allow3Char) {
return "#" + this.toHex(allow3Char);
},
toHex8: function (allow4Char) {
toHex8: function toHex8(allow4Char) {
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
},
toHex8String: function (allow4Char) {
toHex8String: function toHex8String(allow4Char) {
return "#" + this.toHex8(allow4Char);
},
toRgb: function () {
toRgb: function toRgb() {
return {

@@ -144,25 +146,9 @@ r: Math.round(this._r),

b: Math.round(this._b),
a: this._a,
a: this._a
};
},
toRgbString: function () {
return this._a == 1
? "rgb(" +
Math.round(this._r) +
", " +
Math.round(this._g) +
", " +
Math.round(this._b) +
")"
: "rgba(" +
Math.round(this._r) +
", " +
Math.round(this._g) +
", " +
Math.round(this._b) +
", " +
this._roundA +
")";
toRgbString: function toRgbString() {
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
},
toPercentageRgb: function () {
toPercentageRgb: function toPercentageRgb() {
return {

@@ -172,40 +158,21 @@ r: Math.round(bound01(this._r, 255) * 100) + "%",

b: Math.round(bound01(this._b, 255) * 100) + "%",
a: this._a,
a: this._a
};
},
toPercentageRgbString: function () {
return this._a == 1
? "rgb(" +
Math.round(bound01(this._r, 255) * 100) +
"%, " +
Math.round(bound01(this._g, 255) * 100) +
"%, " +
Math.round(bound01(this._b, 255) * 100) +
"%)"
: "rgba(" +
Math.round(bound01(this._r, 255) * 100) +
"%, " +
Math.round(bound01(this._g, 255) * 100) +
"%, " +
Math.round(bound01(this._b, 255) * 100) +
"%, " +
this._roundA +
")";
toPercentageRgbString: function toPercentageRgbString() {
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
},
toName: function () {
toName: function toName() {
if (this._a === 0) {
return "transparent";
}
if (this._a < 1) {
return false;
}
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
},
toFilter: function (secondColor) {
toFilter: function toFilter(secondColor) {
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
var secondHex8String = hex8String;
var gradientType = this._gradientType ? "GradientType = 1, " : "";
if (secondColor) {

@@ -215,29 +182,10 @@ var s = tinycolor(secondColor);

}
return (
"progid:DXImageTransform.Microsoft.gradient(" +
gradientType +
"startColorstr=" +
hex8String +
",endColorstr=" +
secondHex8String +
")"
);
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
},
toString: function (format) {
toString: function toString(format) {
var formatSet = !!format;
format = format || this._format;
var formattedString = false;
var hasAlpha = this._a < 1 && this._a >= 0;
var needsAlphaFormat =
!formatSet &&
hasAlpha &&
(format === "hex" ||
format === "hex6" ||
format === "hex3" ||
format === "hex4" ||
format === "hex8" ||
format === "name");
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
if (needsAlphaFormat) {

@@ -278,10 +226,8 @@ // Special case for "transparent", all other non-alpha formats

}
return formattedString || this.toHexString();
},
clone: function () {
clone: function clone() {
return tinycolor(this.toString());
},
_applyModification: function (fn, args) {
_applyModification: function _applyModification(fn, args) {
var color = fn.apply(null, [this].concat([].slice.call(args)));

@@ -294,38 +240,37 @@ this._r = color._r;

},
lighten: function () {
return this._applyModification(lighten, arguments);
lighten: function lighten() {
return this._applyModification(_lighten, arguments);
},
brighten: function () {
return this._applyModification(brighten, arguments);
brighten: function brighten() {
return this._applyModification(_brighten, arguments);
},
darken: function () {
return this._applyModification(darken, arguments);
darken: function darken() {
return this._applyModification(_darken, arguments);
},
desaturate: function () {
return this._applyModification(desaturate, arguments);
desaturate: function desaturate() {
return this._applyModification(_desaturate, arguments);
},
saturate: function () {
return this._applyModification(saturate, arguments);
saturate: function saturate() {
return this._applyModification(_saturate, arguments);
},
greyscale: function () {
return this._applyModification(greyscale, arguments);
greyscale: function greyscale() {
return this._applyModification(_greyscale, arguments);
},
spin: function () {
return this._applyModification(spin, arguments);
spin: function spin() {
return this._applyModification(_spin, arguments);
},
_applyCombination: function (fn, args) {
_applyCombination: function _applyCombination(fn, args) {
return fn.apply(null, [this].concat([].slice.call(args)));
},
analogous: function () {
return this._applyCombination(analogous, arguments);
analogous: function analogous() {
return this._applyCombination(_analogous, arguments);
},
complement: function () {
return this._applyCombination(complement, arguments);
complement: function complement() {
return this._applyCombination(_complement, arguments);
},
monochromatic: function () {
return this._applyCombination(monochromatic, arguments);
monochromatic: function monochromatic() {
return this._applyCombination(_monochromatic, arguments);
},
splitcomplement: function () {
return this._applyCombination(splitcomplement, arguments);
splitcomplement: function splitcomplement() {
return this._applyCombination(_splitcomplement, arguments);
},

@@ -336,8 +281,8 @@ // Disabled until https://github.com/bgrins/TinyColor/issues/254

// },
triad: function () {
triad: function triad() {
return this._applyCombination(polyad, [3]);
},
tetrad: function () {
tetrad: function tetrad() {
return this._applyCombination(polyad, [4]);
},
}
};

@@ -348,3 +293,3 @@

tinycolor.fromRatio = function (color, opts) {
if (typeof color == "object") {
if (_typeof(color) == "object") {
var newColor = {};

@@ -362,3 +307,2 @@ for (var i in color) {

}
return tinycolor(color, opts);

@@ -383,3 +327,7 @@ };

function inputToRGB(color) {
var rgb = { r: 0, g: 0, b: 0 };
var rgb = {
r: 0,
g: 0,
b: 0
};
var a = 1;

@@ -391,21 +339,11 @@ var s = null;

var format = false;
if (typeof color == "string") {
color = stringInputToObject(color);
}
if (typeof color == "object") {
if (
isValidCSSUnit(color.r) &&
isValidCSSUnit(color.g) &&
isValidCSSUnit(color.b)
) {
if (_typeof(color) == "object") {
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
rgb = rgbToRgb(color.r, color.g, color.b);
ok = true;
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
} else if (
isValidCSSUnit(color.h) &&
isValidCSSUnit(color.s) &&
isValidCSSUnit(color.v)
) {
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
s = convertToPercentage(color.s);

@@ -416,7 +354,3 @@ v = convertToPercentage(color.v);

format = "hsv";
} else if (
isValidCSSUnit(color.h) &&
isValidCSSUnit(color.s) &&
isValidCSSUnit(color.l)
) {
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
s = convertToPercentage(color.s);

@@ -428,3 +362,2 @@ l = convertToPercentage(color.l);

}
if (color.hasOwnProperty("a")) {

@@ -434,5 +367,3 @@ a = color.a;

}
a = boundAlpha(a);
return {

@@ -444,3 +375,3 @@ ok: ok,

b: Math.min(255, Math.max(rgb.b, 0)),
a: a,
a: a
};

@@ -464,3 +395,3 @@ }

g: bound01(g, 255) * 255,
b: bound01(b, 255) * 255,
b: bound01(b, 255) * 255
};

@@ -477,3 +408,2 @@ }

b = bound01(b, 255);
var max = Math.max(r, g, b),

@@ -484,3 +414,2 @@ min = Math.min(r, g, b);

l = (max + min) / 2;
if (max == min) {

@@ -502,7 +431,9 @@ h = s = 0; // achromatic

}
h /= 6;
}
return { h: h, s: s, l: l };
return {
h: h,
s: s,
l: l
};
}

@@ -516,7 +447,5 @@

var r, g, b;
h = bound01(h, 360);
s = bound01(s, 100);
l = bound01(l, 100);
function hue2rgb(p, q, t) {

@@ -530,3 +459,2 @@ if (t < 0) t += 1;

}
if (s === 0) {

@@ -541,4 +469,7 @@ r = g = b = l; // achromatic

}
return { r: r * 255, g: g * 255, b: b * 255 };
return {
r: r * 255,
g: g * 255,
b: b * 255
};
}

@@ -554,3 +485,2 @@

b = bound01(b, 255);
var max = Math.max(r, g, b),

@@ -561,6 +491,4 @@ min = Math.min(r, g, b);

v = max;
var d = max - min;
s = max === 0 ? 0 : d / max;
if (max == min) {

@@ -582,3 +510,7 @@ h = 0; // achromatic

}
return { h: h, s: s, v: v };
return {
h: h,
s: s,
v: v
};
}

@@ -594,3 +526,2 @@

v = bound01(v, 100);
var i = Math.floor(h),

@@ -605,4 +536,7 @@ f = h - i,

b = [p, p, t, v, v, q][mod];
return { r: r * 255, g: g * 255, b: b * 255 };
return {
r: r * 255,
g: g * 255,
b: b * 255
};
}

@@ -615,18 +549,8 @@

function rgbToHex(r, g, b, allow3Char) {
var hex = [
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
];
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
// Return a 3 character hex if possible
if (
allow3Char &&
hex[0].charAt(0) == hex[0].charAt(1) &&
hex[1].charAt(0) == hex[1].charAt(1) &&
hex[2].charAt(0) == hex[2].charAt(1)
) {
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");

@@ -640,22 +564,8 @@ }

function rgbaToHex(r, g, b, a, allow4Char) {
var hex = [
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
pad2(convertDecimalToHex(a)),
];
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
// Return a 4 character hex if possible
if (
allow4Char &&
hex[0].charAt(0) == hex[0].charAt(1) &&
hex[1].charAt(0) == hex[1].charAt(1) &&
hex[2].charAt(0) == hex[2].charAt(1) &&
hex[3].charAt(0) == hex[3].charAt(1)
) {
return (
hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0)
);
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");

@@ -668,9 +578,3 @@ }

function rgbaToArgbHex(r, g, b, a) {
var hex = [
pad2(convertDecimalToHex(a)),
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
];
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
return hex.join("");

@@ -685,3 +589,2 @@ }

};
tinycolor.random = function () {

@@ -691,3 +594,3 @@ return tinycolor.fromRatio({

g: Math.random(),
b: Math.random(),
b: Math.random()
});

@@ -701,3 +604,3 @@ };

function desaturate(color, amount) {
function _desaturate(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -709,4 +612,3 @@ var hsl = tinycolor(color).toHsl();

}
function saturate(color, amount) {
function _saturate(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -718,8 +620,6 @@ var hsl = tinycolor(color).toHsl();

}
function greyscale(color) {
function _greyscale(color) {
return tinycolor(color).desaturate(100);
}
function lighten(color, amount) {
function _lighten(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -731,4 +631,3 @@ var hsl = tinycolor(color).toHsl();

}
function brighten(color, amount) {
function _brighten(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -741,4 +640,3 @@ var rgb = tinycolor(color).toRgb();

}
function darken(color, amount) {
function _darken(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -753,3 +651,3 @@ var hsl = tinycolor(color).toHsl();

// Values outside of this range will be wrapped into this range.
function spin(color, amount) {
function _spin(color, amount) {
var hsl = tinycolor(color).toHsl();

@@ -766,3 +664,3 @@ var hue = (hsl.h + amount) % 360;

function complement(color) {
function _complement(color) {
var hsl = tinycolor(color).toHsl();

@@ -772,3 +670,2 @@ hsl.h = (hsl.h + 180) % 360;

}
function polyad(color, number) {

@@ -782,27 +679,30 @@ if (isNaN(number) || number <= 0) {

for (var i = 1; i < number; i++) {
result.push(tinycolor({ h: (hsl.h + i * step) % 360, s: hsl.s, l: hsl.l }));
result.push(tinycolor({
h: (hsl.h + i * step) % 360,
s: hsl.s,
l: hsl.l
}));
}
return result;
}
function splitcomplement(color) {
function _splitcomplement(color) {
var hsl = tinycolor(color).toHsl();
var h = hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),
];
return [tinycolor(color), tinycolor({
h: (h + 72) % 360,
s: hsl.s,
l: hsl.l
}), tinycolor({
h: (h + 216) % 360,
s: hsl.s,
l: hsl.l
})];
}
function analogous(color, results, slices) {
function _analogous(color, results, slices) {
results = results || 6;
slices = slices || 30;
var hsl = tinycolor(color).toHsl();
var part = 360 / slices;
var ret = [tinycolor(color)];
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results; ) {
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
hsl.h = (hsl.h + part) % 360;

@@ -813,4 +713,3 @@ ret.push(tinycolor(hsl));

}
function monochromatic(color, results) {
function _monochromatic(color, results) {
results = results || 6;

@@ -823,8 +722,10 @@ var hsv = tinycolor(color).toHsv();

var modification = 1 / results;
while (results--) {
ret.push(tinycolor({ h: h, s: s, v: v }));
ret.push(tinycolor({
h: h,
s: s,
v: v
}));
v = (v + modification) % 1;
}
return ret;

@@ -838,8 +739,5 @@ }

amount = amount === 0 ? 0 : amount || 50;
var rgb1 = tinycolor(color1).toRgb();
var rgb2 = tinycolor(color2).toRgb();
var p = amount / 100;
var rgba = {

@@ -849,5 +747,4 @@ r: (rgb2.r - rgb1.r) * p + rgb1.r,

b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a,
a: (rgb2.a - rgb1.a) * p + rgb1.a
};
return tinycolor(rgba);

@@ -865,6 +762,3 @@ };

var c2 = tinycolor(color2);
return (
(Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
(Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05)
);
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
};

@@ -885,5 +779,3 @@

var wcag2Parms, out;
out = false;
wcag2Parms = validateWCAG2Parms(wcag2);

@@ -923,3 +815,2 @@ switch (wcag2Parms.level + wcag2Parms.size) {

size = args.size;
for (var i = 0; i < colorList.length; i++) {

@@ -932,10 +823,6 @@ readability = tinycolor.readability(baseColor, colorList[i]);

}
if (
tinycolor.isReadable(baseColor, bestColor, {
level: level,
size: size,
}) ||
!includeFallbackColors
) {
if (tinycolor.isReadable(baseColor, bestColor, {
level: level,
size: size
}) || !includeFallbackColors) {
return bestColor;

@@ -951,3 +838,3 @@ } else {

// <https://www.w3.org/TR/css-color-4/#named-colors>
var names = (tinycolor.names = {
var names = tinycolor.names = {
aliceblue: "f0f8ff",

@@ -1101,7 +988,7 @@ antiquewhite: "faebd7",

yellow: "ff0",
yellowgreen: "9acd32",
});
yellowgreen: "9acd32"
};
// Make it easy to access colors via `hexNames[hex]`
var hexNames = (tinycolor.hexNames = flip(names));
var hexNames = tinycolor.hexNames = flip(names);

@@ -1125,7 +1012,5 @@ // Utilities

a = parseFloat(a);
if (isNaN(a) || a < 0 || a > 1) {
a = 1;
}
return a;

@@ -1137,3 +1022,2 @@ }

if (isOnePointZero(n)) n = "100%";
var processPercent = isPercentage(n);

@@ -1153,3 +1037,3 @@ n = Math.min(max, Math.max(0, parseFloat(n)));

// Convert into [0, 1] range if it isn't already
return (n % max) / parseFloat(max);
return n % max / parseFloat(max);
}

@@ -1188,3 +1072,2 @@

}
return n;

@@ -1201,4 +1084,3 @@ }

}
var matchers = (function () {
var matchers = function () {
// <http://www.w3.org/TR/css3-values/#integers>

@@ -1216,21 +1098,4 @@ var CSS_INTEGER = "[-\\+]?\\d+%?";

// Whitespace can take the place of commas or opening paren
var PERMISSIVE_MATCH3 =
"[\\s|\\(]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")\\s*\\)?";
var PERMISSIVE_MATCH4 =
"[\\s|\\(]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")\\s*\\)?";
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
return {

@@ -1247,5 +1112,5 @@ CSS_UNIT: new RegExp(CSS_UNIT),

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})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
})();
}();

@@ -1269,3 +1134,9 @@ // `isValidCSSUnit`

} else if (color == "transparent") {
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
return {
r: 0,
g: 0,
b: 0,
a: 0,
format: "name"
};
}

@@ -1278,21 +1149,48 @@

var match;
if ((match = matchers.rgb.exec(color))) {
return { r: match[1], g: match[2], b: match[3] };
if (match = matchers.rgb.exec(color)) {
return {
r: match[1],
g: match[2],
b: match[3]
};
}
if ((match = matchers.rgba.exec(color))) {
return { r: match[1], g: match[2], b: match[3], a: match[4] };
if (match = matchers.rgba.exec(color)) {
return {
r: match[1],
g: match[2],
b: match[3],
a: match[4]
};
}
if ((match = matchers.hsl.exec(color))) {
return { h: match[1], s: match[2], l: match[3] };
if (match = matchers.hsl.exec(color)) {
return {
h: match[1],
s: match[2],
l: match[3]
};
}
if ((match = matchers.hsla.exec(color))) {
return { h: match[1], s: match[2], l: match[3], a: match[4] };
if (match = matchers.hsla.exec(color)) {
return {
h: match[1],
s: match[2],
l: match[3],
a: match[4]
};
}
if ((match = matchers.hsv.exec(color))) {
return { h: match[1], s: match[2], v: match[3] };
if (match = matchers.hsv.exec(color)) {
return {
h: match[1],
s: match[2],
v: match[3]
};
}
if ((match = matchers.hsva.exec(color))) {
return { h: match[1], s: match[2], v: match[3], a: match[4] };
if (match = matchers.hsva.exec(color)) {
return {
h: match[1],
s: match[2],
v: match[3],
a: match[4]
};
}
if ((match = matchers.hex8.exec(color))) {
if (match = matchers.hex8.exec(color)) {
return {

@@ -1303,6 +1201,6 @@ r: parseIntFromHex(match[1]),

a: convertHexToDecimal(match[4]),
format: named ? "name" : "hex8",
format: named ? "name" : "hex8"
};
}
if ((match = matchers.hex6.exec(color))) {
if (match = matchers.hex6.exec(color)) {
return {

@@ -1312,6 +1210,6 @@ r: parseIntFromHex(match[1]),

b: parseIntFromHex(match[3]),
format: named ? "name" : "hex",
format: named ? "name" : "hex"
};
}
if ((match = matchers.hex4.exec(color))) {
if (match = matchers.hex4.exec(color)) {
return {

@@ -1322,6 +1220,6 @@ r: parseIntFromHex(match[1] + "" + match[1]),

a: convertHexToDecimal(match[4] + "" + match[4]),
format: named ? "name" : "hex8",
format: named ? "name" : "hex8"
};
}
if ((match = matchers.hex3.exec(color))) {
if (match = matchers.hex3.exec(color)) {
return {

@@ -1331,9 +1229,7 @@ r: parseIntFromHex(match[1] + "" + match[1]),

b: parseIntFromHex(match[3] + "" + match[3]),
format: named ? "name" : "hex",
format: named ? "name" : "hex"
};
}
return false;
}
function validateWCAG2Parms(parms) {

@@ -1343,3 +1239,6 @@ // return valid WCAG2 parms for isReadable.

var level, size;
parms = parms || { level: "AA", size: "small" };
parms = parms || {
level: "AA",
size: "small"
};
level = (parms.level || "AA").toUpperCase();

@@ -1353,3 +1252,6 @@ size = (parms.size || "small").toLowerCase();

}
return { level: level, size: size };
return {
level: level,
size: size
};
}

@@ -1356,0 +1258,0 @@

@@ -5,2 +5,2 @@ // This file is autogenerated.

// See https://github.com/bgrins/TinyColor/ for instructions.
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).tinycolor=r()}(this,(function(){"use strict";const t=/^\s+/,r=/\s+$/;function e(a,n){if(n=n||{},(a=a||"")instanceof e)return a;if(!(this instanceof e))return new e(a,n);var i=function(e){var a={r:0,g:0,b:0},n=1,i=null,o=null,h=null,s=!1,f=!1;"string"==typeof e&&(e=function(e){e=e.replace(t,"").replace(r,"").toLowerCase();var a,n=!1;if(v[e])e=v[e],n=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(a=N.rgb.exec(e))return{r:a[1],g:a[2],b:a[3]};if(a=N.rgba.exec(e))return{r:a[1],g:a[2],b:a[3],a:a[4]};if(a=N.hsl.exec(e))return{h:a[1],s:a[2],l:a[3]};if(a=N.hsla.exec(e))return{h:a[1],s:a[2],l:a[3],a:a[4]};if(a=N.hsv.exec(e))return{h:a[1],s:a[2],v:a[3]};if(a=N.hsva.exec(e))return{h:a[1],s:a[2],v:a[3],a:a[4]};if(a=N.hex8.exec(e))return{r:k(a[1]),g:k(a[2]),b:k(a[3]),a:R(a[4]),format:n?"name":"hex8"};if(a=N.hex6.exec(e))return{r:k(a[1]),g:k(a[2]),b:k(a[3]),format:n?"name":"hex"};if(a=N.hex4.exec(e))return{r:k(a[1]+""+a[1]),g:k(a[2]+""+a[2]),b:k(a[3]+""+a[3]),a:R(a[4]+""+a[4]),format:n?"name":"hex8"};if(a=N.hex3.exec(e))return{r:k(a[1]+""+a[1]),g:k(a[2]+""+a[2]),b:k(a[3]+""+a[3]),format:n?"name":"hex"};return!1}(e));"object"==typeof e&&(T(e.r)&&T(e.g)&&T(e.b)?(u=e.r,l=e.g,c=e.b,a={r:255*x(u,255),g:255*x(l,255),b:255*x(c,255)},s=!0,f="%"===String(e.r).substr(-1)?"prgb":"rgb"):T(e.h)&&T(e.s)&&T(e.v)?(i=S(e.s),o=S(e.v),a=function(t,r,e){t=6*x(t,360),r=x(r,100),e=x(e,100);var a=Math.floor(t),n=t-a,i=e*(1-r),o=e*(1-n*r),h=e*(1-(1-n)*r),s=a%6,f=[e,o,i,i,h,e][s],u=[h,e,e,o,i,i][s],l=[i,i,h,e,e,o][s];return{r:255*f,g:255*u,b:255*l}}(e.h,i,o),s=!0,f="hsv"):T(e.h)&&T(e.s)&&T(e.l)&&(i=S(e.s),h=S(e.l),a=function(t,r,e){var a,n,i;function o(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(r-t)*e:e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}if(t=x(t,360),r=x(r,100),e=x(e,100),0===r)a=n=i=e;else{var h=e<.5?e*(1+r):e+r-e*r,s=2*e-h;a=o(s,h,t+1/3),n=o(s,h,t),i=o(s,h,t-1/3)}return{r:255*a,g:255*n,b:255*i}}(e.h,i,h),s=!0,f="hsl"),e.hasOwnProperty("a")&&(n=e.a));var u,l,c;return n=y(n),{ok:s,format:e.format||f,r:Math.min(255,Math.max(a.r,0)),g:Math.min(255,Math.max(a.g,0)),b:Math.min(255,Math.max(a.b,0)),a:n}}(a);this._originalInput=a,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||i.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}function a(t,r,e){t=x(t,255),r=x(r,255),e=x(e,255);var a,n,i=Math.max(t,r,e),o=Math.min(t,r,e),h=(i+o)/2;if(i==o)a=n=0;else{var s=i-o;switch(n=h>.5?s/(2-i-o):s/(i+o),i){case t:a=(r-e)/s+(r<e?6:0);break;case r:a=(e-t)/s+2;break;case e:a=(t-r)/s+4}a/=6}return{h:a,s:n,l:h}}function n(t,r,e){t=x(t,255),r=x(r,255),e=x(e,255);var a,n,i=Math.max(t,r,e),o=Math.min(t,r,e),h=i,s=i-o;if(n=0===i?0:s/i,i==o)a=0;else{switch(i){case t:a=(r-e)/s+(r<e?6:0);break;case r:a=(e-t)/s+2;break;case e:a=(t-r)/s+4}a/=6}return{h:a,s:n,v:h}}function i(t,r,e,a){var n=[w(Math.round(t).toString(16)),w(Math.round(r).toString(16)),w(Math.round(e).toString(16))];return a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function o(t,r,e,a){return[w(H(a)),w(Math.round(t).toString(16)),w(Math.round(r).toString(16)),w(Math.round(e).toString(16))].join("")}function h(t,r){r=0===r?0:r||10;var a=e(t).toHsl();return a.s-=r/100,a.s=A(a.s),e(a)}function s(t,r){r=0===r?0:r||10;var a=e(t).toHsl();return a.s+=r/100,a.s=A(a.s),e(a)}function f(t){return e(t).desaturate(100)}function u(t,r){r=0===r?0:r||10;var a=e(t).toHsl();return a.l+=r/100,a.l=A(a.l),e(a)}function l(t,r){r=0===r?0:r||10;var a=e(t).toRgb();return a.r=Math.max(0,Math.min(255,a.r-Math.round(-r/100*255))),a.g=Math.max(0,Math.min(255,a.g-Math.round(-r/100*255))),a.b=Math.max(0,Math.min(255,a.b-Math.round(-r/100*255))),e(a)}function c(t,r){r=0===r?0:r||10;var a=e(t).toHsl();return a.l-=r/100,a.l=A(a.l),e(a)}function d(t,r){var a=e(t).toHsl(),n=(a.h+r)%360;return a.h=n<0?360+n:n,e(a)}function g(t){var r=e(t).toHsl();return r.h=(r.h+180)%360,e(r)}function b(t,r){if(isNaN(r)||r<=0)throw new Error("Argument to polyad must be a positive number");for(var a=e(t).toHsl(),n=[e(t)],i=360/r,o=1;o<r;o++)n.push(e({h:(a.h+o*i)%360,s:a.s,l:a.l}));return n}function m(t){var r=e(t).toHsl(),a=r.h;return[e(t),e({h:(a+72)%360,s:r.s,l:r.l}),e({h:(a+216)%360,s:r.s,l:r.l})]}function p(t,r,a){r=r||6,a=a||30;var n=e(t).toHsl(),i=360/a,o=[e(t)];for(n.h=(n.h-(i*r>>1)+720)%360;--r;)n.h=(n.h+i)%360,o.push(e(n));return o}function _(t,r){r=r||6;for(var a=e(t).toHsv(),n=a.h,i=a.s,o=a.v,h=[],s=1/r;r--;)h.push(e({h:n,s:i,v:o})),o=(o+s)%1;return h}e.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 t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,e,a=this.toRgb();return t=a.r/255,r=a.g/255,e=a.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))},setAlpha:function(t){return this._a=y(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=n(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=n(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),a=Math.round(100*t.v);return 1==this._a?"hsv("+r+", "+e+"%, "+a+"%)":"hsva("+r+", "+e+"%, "+a+"%, "+this._roundA+")"},toHsl:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=a(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+r+", "+e+"%, "+n+"%)":"hsla("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return i(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,r,e,a,n){var i=[w(Math.round(t).toString(16)),w(Math.round(r).toString(16)),w(Math.round(e).toString(16)),w(H(a))];if(n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1))return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0);return i.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*x(this._r,255))+"%",g:Math.round(100*x(this._g,255))+"%",b:Math.round(100*x(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*x(this._r,255))+"%, "+Math.round(100*x(this._g,255))+"%, "+Math.round(100*x(this._b,255))+"%)":"rgba("+Math.round(100*x(this._r,255))+"%, "+Math.round(100*x(this._g,255))+"%, "+Math.round(100*x(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(M[i(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var r="#"+o(this._r,this._g,this._b,this._a),a=r,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=e(t);a="#"+o(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+r+",endColorstr="+a+")"},toString:function(t){var r=!!t;t=t||this._format;var e=!1,a=this._a<1&&this._a>=0;return r||!a||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(e=this.toRgbString()),"prgb"===t&&(e=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(e=this.toHexString()),"hex3"===t&&(e=this.toHexString(!0)),"hex4"===t&&(e=this.toHex8String(!0)),"hex8"===t&&(e=this.toHex8String()),"name"===t&&(e=this.toName()),"hsl"===t&&(e=this.toHslString()),"hsv"===t&&(e=this.toHsvString()),e||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return e(this.toString())},_applyModification:function(t,r){var e=t.apply(null,[this].concat([].slice.call(r)));return this._r=e._r,this._g=e._g,this._b=e._b,this.setAlpha(e._a),this},lighten:function(){return this._applyModification(u,arguments)},brighten:function(){return this._applyModification(l,arguments)},darken:function(){return this._applyModification(c,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(s,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(d,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(p,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(_,arguments)},splitcomplement:function(){return this._applyCombination(m,arguments)},triad:function(){return this._applyCombination(b,[3])},tetrad:function(){return this._applyCombination(b,[4])}},e.fromRatio=function(t,r){if("object"==typeof t){var a={};for(var n in t)t.hasOwnProperty(n)&&(a[n]="a"===n?t[n]:S(t[n]));t=a}return e(t,r)},e.equals=function(t,r){return!(!t||!r)&&e(t).toRgbString()==e(r).toRgbString()},e.random=function(){return e.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},e.mix=function(t,r,a){a=0===a?0:a||50;var n=e(t).toRgb(),i=e(r).toRgb(),o=a/100;return e({r:(i.r-n.r)*o+n.r,g:(i.g-n.g)*o+n.g,b:(i.b-n.b)*o+n.b,a:(i.a-n.a)*o+n.a})},e.readability=function(t,r){var a=e(t),n=e(r);return(Math.max(a.getLuminance(),n.getLuminance())+.05)/(Math.min(a.getLuminance(),n.getLuminance())+.05)},e.isReadable=function(t,r,a){var n,i,o=e.readability(t,r);switch(i=!1,(n=function(t){var r,e;r=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),e=(t.size||"small").toLowerCase(),"AA"!==r&&"AAA"!==r&&(r="AA");"small"!==e&&"large"!==e&&(e="small");return{level:r,size:e}}(a)).level+n.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},e.mostReadable=function(t,r,a){var n,i,o,h,s=null,f=0;i=(a=a||{}).includeFallbackColors,o=a.level,h=a.size;for(var u=0;u<r.length;u++)(n=e.readability(t,r[u]))>f&&(f=n,s=e(r[u]));return e.isReadable(t,s,{level:o,size:h})||!i?s:(a.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],a))};var v=e.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"},M=e.hexNames=function(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}(v);function y(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function x(t,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var e=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function A(t){return Math.min(1,Math.max(0,t))}function k(t){return parseInt(t,16)}function w(t){return 1==t.length?"0"+t:""+t}function S(t){return t<=1&&(t=100*t+"%"),t}function H(t){return Math.round(255*parseFloat(t)).toString(16)}function R(t){return k(t)/255}var F,C,q,N=(C="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",q="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+C),rgba:new RegExp("rgba"+q),hsl:new RegExp("hsl"+C),hsla:new RegExp("hsla"+q),hsv:new RegExp("hsv"+C),hsva:new RegExp("hsva"+q),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 T(t){return!!N.CSS_UNIT.exec(t)}return e}));
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).tinycolor=r()}(this,(function(){"use strict";function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/,e=/\s+$/;function n(a,i){if(i=i||{},(a=a||"")instanceof n)return a;if(!(this instanceof n))return new n(a,i);var o=function(n){var a={r:0,g:0,b:0},i=1,o=null,h=null,s=null,f=!1,u=!1;"string"==typeof n&&(n=function(t){t=t.replace(r,"").replace(e,"").toLowerCase();var n,a=!1;if(y[t])t=y[t],a=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(n=T.rgb.exec(t))return{r:n[1],g:n[2],b:n[3]};if(n=T.rgba.exec(t))return{r:n[1],g:n[2],b:n[3],a:n[4]};if(n=T.hsl.exec(t))return{h:n[1],s:n[2],l:n[3]};if(n=T.hsla.exec(t))return{h:n[1],s:n[2],l:n[3],a:n[4]};if(n=T.hsv.exec(t))return{h:n[1],s:n[2],v:n[3]};if(n=T.hsva.exec(t))return{h:n[1],s:n[2],v:n[3],a:n[4]};if(n=T.hex8.exec(t))return{r:w(n[1]),g:w(n[2]),b:w(n[3]),a:F(n[4]),format:a?"name":"hex8"};if(n=T.hex6.exec(t))return{r:w(n[1]),g:w(n[2]),b:w(n[3]),format:a?"name":"hex"};if(n=T.hex4.exec(t))return{r:w(n[1]+""+n[1]),g:w(n[2]+""+n[2]),b:w(n[3]+""+n[3]),a:F(n[4]+""+n[4]),format:a?"name":"hex8"};if(n=T.hex3.exec(t))return{r:w(n[1]+""+n[1]),g:w(n[2]+""+n[2]),b:w(n[3]+""+n[3]),format:a?"name":"hex"};return!1}(n));"object"==t(n)&&(E(n.r)&&E(n.g)&&E(n.b)?(l=n.r,c=n.g,d=n.b,a={r:255*A(l,255),g:255*A(c,255),b:255*A(d,255)},f=!0,u="%"===String(n.r).substr(-1)?"prgb":"rgb"):E(n.h)&&E(n.s)&&E(n.v)?(o=H(n.s),h=H(n.v),a=function(t,r,e){t=6*A(t,360),r=A(r,100),e=A(e,100);var n=Math.floor(t),a=t-n,i=e*(1-r),o=e*(1-a*r),h=e*(1-(1-a)*r),s=n%6,f=[e,o,i,i,h,e][s],u=[h,e,e,o,i,i][s],l=[i,i,h,e,e,o][s];return{r:255*f,g:255*u,b:255*l}}(n.h,o,h),f=!0,u="hsv"):E(n.h)&&E(n.s)&&E(n.l)&&(o=H(n.s),s=H(n.l),a=function(t,r,e){var n,a,i;function o(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(r-t)*e:e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}if(t=A(t,360),r=A(r,100),e=A(e,100),0===r)n=a=i=e;else{var h=e<.5?e*(1+r):e+r-e*r,s=2*e-h;n=o(s,h,t+1/3),a=o(s,h,t),i=o(s,h,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(n.h,o,s),f=!0,u="hsl"),n.hasOwnProperty("a")&&(i=n.a));var l,c,d;return i=x(i),{ok:f,format:n.format||u,r:Math.min(255,Math.max(a.r,0)),g:Math.min(255,Math.max(a.g,0)),b:Math.min(255,Math.max(a.b,0)),a:i}}(a);this._originalInput=a,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=i.format||o.format,this._gradientType=i.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function a(t,r,e){t=A(t,255),r=A(r,255),e=A(e,255);var n,a,i=Math.max(t,r,e),o=Math.min(t,r,e),h=(i+o)/2;if(i==o)n=a=0;else{var s=i-o;switch(a=h>.5?s/(2-i-o):s/(i+o),i){case t:n=(r-e)/s+(r<e?6:0);break;case r:n=(e-t)/s+2;break;case e:n=(t-r)/s+4}n/=6}return{h:n,s:a,l:h}}function i(t,r,e){t=A(t,255),r=A(r,255),e=A(e,255);var n,a,i=Math.max(t,r,e),o=Math.min(t,r,e),h=i,s=i-o;if(a=0===i?0:s/i,i==o)n=0;else{switch(i){case t:n=(r-e)/s+(r<e?6:0);break;case r:n=(e-t)/s+2;break;case e:n=(t-r)/s+4}n/=6}return{h:n,s:a,v:h}}function o(t,r,e,n){var a=[S(Math.round(t).toString(16)),S(Math.round(r).toString(16)),S(Math.round(e).toString(16))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function h(t,r,e,n){return[S(R(n)),S(Math.round(t).toString(16)),S(Math.round(r).toString(16)),S(Math.round(e).toString(16))].join("")}function s(t,r){r=0===r?0:r||10;var e=n(t).toHsl();return e.s-=r/100,e.s=k(e.s),n(e)}function f(t,r){r=0===r?0:r||10;var e=n(t).toHsl();return e.s+=r/100,e.s=k(e.s),n(e)}function u(t){return n(t).desaturate(100)}function l(t,r){r=0===r?0:r||10;var e=n(t).toHsl();return e.l+=r/100,e.l=k(e.l),n(e)}function c(t,r){r=0===r?0:r||10;var e=n(t).toRgb();return e.r=Math.max(0,Math.min(255,e.r-Math.round(-r/100*255))),e.g=Math.max(0,Math.min(255,e.g-Math.round(-r/100*255))),e.b=Math.max(0,Math.min(255,e.b-Math.round(-r/100*255))),n(e)}function d(t,r){r=0===r?0:r||10;var e=n(t).toHsl();return e.l-=r/100,e.l=k(e.l),n(e)}function g(t,r){var e=n(t).toHsl(),a=(e.h+r)%360;return e.h=a<0?360+a:a,n(e)}function b(t){var r=n(t).toHsl();return r.h=(r.h+180)%360,n(r)}function m(t,r){if(isNaN(r)||r<=0)throw new Error("Argument to polyad must be a positive number");for(var e=n(t).toHsl(),a=[n(t)],i=360/r,o=1;o<r;o++)a.push(n({h:(e.h+o*i)%360,s:e.s,l:e.l}));return a}function p(t){var r=n(t).toHsl(),e=r.h;return[n(t),n({h:(e+72)%360,s:r.s,l:r.l}),n({h:(e+216)%360,s:r.s,l:r.l})]}function _(t,r,e){r=r||6,e=e||30;var a=n(t).toHsl(),i=360/e,o=[n(t)];for(a.h=(a.h-(i*r>>1)+720)%360;--r;)a.h=(a.h+i)%360,o.push(n(a));return o}function v(t,r){r=r||6;for(var e=n(t).toHsv(),a=e.h,i=e.s,o=e.v,h=[],s=1/r;r--;)h.push(n({h:a,s:i,v:o})),o=(o+s)%1;return h}n.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 t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,e,n=this.toRgb();return t=n.r/255,r=n.g/255,e=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))},setAlpha:function(t){return this._a=x(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=i(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+r+", "+e+"%, "+n+"%)":"hsva("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=a(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+r+", "+e+"%, "+n+"%)":"hsla("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return o(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,r,e,n,a){var i=[S(Math.round(t).toString(16)),S(Math.round(r).toString(16)),S(Math.round(e).toString(16)),S(R(n))];if(a&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1))return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0);return i.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*A(this._r,255))+"%",g:Math.round(100*A(this._g,255))+"%",b:Math.round(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*A(this._r,255))+"%, "+Math.round(100*A(this._g,255))+"%, "+Math.round(100*A(this._b,255))+"%)":"rgba("+Math.round(100*A(this._r,255))+"%, "+Math.round(100*A(this._g,255))+"%, "+Math.round(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(M[o(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var r="#"+h(this._r,this._g,this._b,this._a),e=r,a=this._gradientType?"GradientType = 1, ":"";if(t){var i=n(t);e="#"+h(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+r+",endColorstr="+e+")"},toString:function(t){var r=!!t;t=t||this._format;var e=!1,n=this._a<1&&this._a>=0;return r||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(e=this.toRgbString()),"prgb"===t&&(e=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(e=this.toHexString()),"hex3"===t&&(e=this.toHexString(!0)),"hex4"===t&&(e=this.toHex8String(!0)),"hex8"===t&&(e=this.toHex8String()),"name"===t&&(e=this.toName()),"hsl"===t&&(e=this.toHslString()),"hsv"===t&&(e=this.toHsvString()),e||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(this.toString())},_applyModification:function(t,r){var e=t.apply(null,[this].concat([].slice.call(r)));return this._r=e._r,this._g=e._g,this._b=e._b,this.setAlpha(e._a),this},lighten:function(){return this._applyModification(l,arguments)},brighten:function(){return this._applyModification(c,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(u,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(_,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(v,arguments)},splitcomplement:function(){return this._applyCombination(p,arguments)},triad:function(){return this._applyCombination(m,[3])},tetrad:function(){return this._applyCombination(m,[4])}},n.fromRatio=function(r,e){if("object"==t(r)){var a={};for(var i in r)r.hasOwnProperty(i)&&(a[i]="a"===i?r[i]:H(r[i]));r=a}return n(r,e)},n.equals=function(t,r){return!(!t||!r)&&n(t).toRgbString()==n(r).toRgbString()},n.random=function(){return n.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},n.mix=function(t,r,e){e=0===e?0:e||50;var a=n(t).toRgb(),i=n(r).toRgb(),o=e/100;return n({r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a})},n.readability=function(t,r){var e=n(t),a=n(r);return(Math.max(e.getLuminance(),a.getLuminance())+.05)/(Math.min(e.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,r,e){var a,i,o=n.readability(t,r);switch(i=!1,(a=function(t){var r,e;r=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),e=(t.size||"small").toLowerCase(),"AA"!==r&&"AAA"!==r&&(r="AA");"small"!==e&&"large"!==e&&(e="small");return{level:r,size:e}}(e)).level+a.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},n.mostReadable=function(t,r,e){var a,i,o,h,s=null,f=0;i=(e=e||{}).includeFallbackColors,o=e.level,h=e.size;for(var u=0;u<r.length;u++)(a=n.readability(t,r[u]))>f&&(f=a,s=n(r[u]));return n.isReadable(t,s,{level:o,size:h})||!i?s:(e.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],e))};var y=n.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"},M=n.hexNames=function(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}(y);function x(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function A(t,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var e=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function k(t){return Math.min(1,Math.max(0,t))}function w(t){return parseInt(t,16)}function S(t){return 1==t.length?"0"+t:""+t}function H(t){return t<=1&&(t=100*t+"%"),t}function R(t){return Math.round(255*parseFloat(t)).toString(16)}function F(t){return w(t)/255}var C,q,N,T=(q="[\\s|\\(]+("+(C="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+C+")[,|\\s]+("+C+")\\s*\\)?",N="[\\s|\\(]+("+C+")[,|\\s]+("+C+")[,|\\s]+("+C+")[,|\\s]+("+C+")\\s*\\)?",{CSS_UNIT:new RegExp(C),rgb:new RegExp("rgb"+q),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+q),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+q),hsva:new RegExp("hsva"+N),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 E(t){return!!T.CSS_UNIT.exec(t)}return n}));
// This file is autogenerated. It's used to publish ESM to npm.
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
// https://github.com/bgrins/TinyColor
// Brian Grinstead, MIT License
const trimLeft = /^\s+/;
const trimRight = /\s+$/;
var trimLeft = /^\s+/;
var trimRight = /\s+$/;
function tinycolor(color, opts) {

@@ -20,11 +29,4 @@ color = color ? color : "";

}
var rgb = inputToRGB(color);
(this._originalInput = color),
(this._r = rgb.r),
(this._g = rgb.g),
(this._b = rgb.b),
(this._a = rgb.a),
(this._roundA = Math.round(100 * this._a) / 100),
(this._format = opts.format || rgb.format);
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
this._gradientType = opts.gradientType;

@@ -39,26 +41,24 @@

if (this._b < 1) this._b = Math.round(this._b);
this._ok = rgb.ok;
}
tinycolor.prototype = {
isDark: function () {
isDark: function isDark() {
return this.getBrightness() < 128;
},
isLight: function () {
isLight: function isLight() {
return !this.isDark();
},
isValid: function () {
isValid: function isValid() {
return this._ok;
},
getOriginalInput: function () {
getOriginalInput: function getOriginalInput() {
return this._originalInput;
},
getFormat: function () {
getFormat: function getFormat() {
return this._format;
},
getAlpha: function () {
getAlpha: function getAlpha() {
return this._a;
},
getBrightness: function () {
getBrightness: function getBrightness() {
//http://www.w3.org/TR/AERT#color-contrast

@@ -68,3 +68,3 @@ var rgb = this.toRgb();

},
getLuminance: function () {
getLuminance: function getLuminance() {
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef

@@ -76,12 +76,8 @@ var rgb = this.toRgb();

BsRGB = rgb.b / 255;
if (RsRGB <= 0.03928) R = RsRGB / 12.92;
else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
},
setAlpha: function (value) {
setAlpha: function setAlpha(value) {
this._a = boundAlpha(value);

@@ -91,7 +87,12 @@ this._roundA = Math.round(100 * this._a) / 100;

},
toHsv: function () {
toHsv: function toHsv() {
var hsv = rgbToHsv(this._r, this._g, this._b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
return {
h: hsv.h * 360,
s: hsv.s,
v: hsv.v,
a: this._a
};
},
toHsvString: function () {
toHsvString: function toHsvString() {
var hsv = rgbToHsv(this._r, this._g, this._b);

@@ -101,11 +102,14 @@ var h = Math.round(hsv.h * 360),

v = Math.round(hsv.v * 100);
return this._a == 1
? "hsv(" + h + ", " + s + "%, " + v + "%)"
: "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
},
toHsl: function () {
toHsl: function toHsl() {
var hsl = rgbToHsl(this._r, this._g, this._b);
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
return {
h: hsl.h * 360,
s: hsl.s,
l: hsl.l,
a: this._a
};
},
toHslString: function () {
toHslString: function toHslString() {
var hsl = rgbToHsl(this._r, this._g, this._b);

@@ -115,19 +119,17 @@ var h = Math.round(hsl.h * 360),

l = Math.round(hsl.l * 100);
return this._a == 1
? "hsl(" + h + ", " + s + "%, " + l + "%)"
: "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
},
toHex: function (allow3Char) {
toHex: function toHex(allow3Char) {
return rgbToHex(this._r, this._g, this._b, allow3Char);
},
toHexString: function (allow3Char) {
toHexString: function toHexString(allow3Char) {
return "#" + this.toHex(allow3Char);
},
toHex8: function (allow4Char) {
toHex8: function toHex8(allow4Char) {
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
},
toHex8String: function (allow4Char) {
toHex8String: function toHex8String(allow4Char) {
return "#" + this.toHex8(allow4Char);
},
toRgb: function () {
toRgb: function toRgb() {
return {

@@ -137,25 +139,9 @@ r: Math.round(this._r),

b: Math.round(this._b),
a: this._a,
a: this._a
};
},
toRgbString: function () {
return this._a == 1
? "rgb(" +
Math.round(this._r) +
", " +
Math.round(this._g) +
", " +
Math.round(this._b) +
")"
: "rgba(" +
Math.round(this._r) +
", " +
Math.round(this._g) +
", " +
Math.round(this._b) +
", " +
this._roundA +
")";
toRgbString: function toRgbString() {
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
},
toPercentageRgb: function () {
toPercentageRgb: function toPercentageRgb() {
return {

@@ -165,40 +151,21 @@ r: Math.round(bound01(this._r, 255) * 100) + "%",

b: Math.round(bound01(this._b, 255) * 100) + "%",
a: this._a,
a: this._a
};
},
toPercentageRgbString: function () {
return this._a == 1
? "rgb(" +
Math.round(bound01(this._r, 255) * 100) +
"%, " +
Math.round(bound01(this._g, 255) * 100) +
"%, " +
Math.round(bound01(this._b, 255) * 100) +
"%)"
: "rgba(" +
Math.round(bound01(this._r, 255) * 100) +
"%, " +
Math.round(bound01(this._g, 255) * 100) +
"%, " +
Math.round(bound01(this._b, 255) * 100) +
"%, " +
this._roundA +
")";
toPercentageRgbString: function toPercentageRgbString() {
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
},
toName: function () {
toName: function toName() {
if (this._a === 0) {
return "transparent";
}
if (this._a < 1) {
return false;
}
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
},
toFilter: function (secondColor) {
toFilter: function toFilter(secondColor) {
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
var secondHex8String = hex8String;
var gradientType = this._gradientType ? "GradientType = 1, " : "";
if (secondColor) {

@@ -208,29 +175,10 @@ var s = tinycolor(secondColor);

}
return (
"progid:DXImageTransform.Microsoft.gradient(" +
gradientType +
"startColorstr=" +
hex8String +
",endColorstr=" +
secondHex8String +
")"
);
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
},
toString: function (format) {
toString: function toString(format) {
var formatSet = !!format;
format = format || this._format;
var formattedString = false;
var hasAlpha = this._a < 1 && this._a >= 0;
var needsAlphaFormat =
!formatSet &&
hasAlpha &&
(format === "hex" ||
format === "hex6" ||
format === "hex3" ||
format === "hex4" ||
format === "hex8" ||
format === "name");
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
if (needsAlphaFormat) {

@@ -271,10 +219,8 @@ // Special case for "transparent", all other non-alpha formats

}
return formattedString || this.toHexString();
},
clone: function () {
clone: function clone() {
return tinycolor(this.toString());
},
_applyModification: function (fn, args) {
_applyModification: function _applyModification(fn, args) {
var color = fn.apply(null, [this].concat([].slice.call(args)));

@@ -287,38 +233,37 @@ this._r = color._r;

},
lighten: function () {
return this._applyModification(lighten, arguments);
lighten: function lighten() {
return this._applyModification(_lighten, arguments);
},
brighten: function () {
return this._applyModification(brighten, arguments);
brighten: function brighten() {
return this._applyModification(_brighten, arguments);
},
darken: function () {
return this._applyModification(darken, arguments);
darken: function darken() {
return this._applyModification(_darken, arguments);
},
desaturate: function () {
return this._applyModification(desaturate, arguments);
desaturate: function desaturate() {
return this._applyModification(_desaturate, arguments);
},
saturate: function () {
return this._applyModification(saturate, arguments);
saturate: function saturate() {
return this._applyModification(_saturate, arguments);
},
greyscale: function () {
return this._applyModification(greyscale, arguments);
greyscale: function greyscale() {
return this._applyModification(_greyscale, arguments);
},
spin: function () {
return this._applyModification(spin, arguments);
spin: function spin() {
return this._applyModification(_spin, arguments);
},
_applyCombination: function (fn, args) {
_applyCombination: function _applyCombination(fn, args) {
return fn.apply(null, [this].concat([].slice.call(args)));
},
analogous: function () {
return this._applyCombination(analogous, arguments);
analogous: function analogous() {
return this._applyCombination(_analogous, arguments);
},
complement: function () {
return this._applyCombination(complement, arguments);
complement: function complement() {
return this._applyCombination(_complement, arguments);
},
monochromatic: function () {
return this._applyCombination(monochromatic, arguments);
monochromatic: function monochromatic() {
return this._applyCombination(_monochromatic, arguments);
},
splitcomplement: function () {
return this._applyCombination(splitcomplement, arguments);
splitcomplement: function splitcomplement() {
return this._applyCombination(_splitcomplement, arguments);
},

@@ -329,8 +274,8 @@ // Disabled until https://github.com/bgrins/TinyColor/issues/254

// },
triad: function () {
triad: function triad() {
return this._applyCombination(polyad, [3]);
},
tetrad: function () {
tetrad: function tetrad() {
return this._applyCombination(polyad, [4]);
},
}
};

@@ -341,3 +286,3 @@

tinycolor.fromRatio = function (color, opts) {
if (typeof color == "object") {
if (_typeof(color) == "object") {
var newColor = {};

@@ -355,3 +300,2 @@ for (var i in color) {

}
return tinycolor(color, opts);

@@ -376,3 +320,7 @@ };

function inputToRGB(color) {
var rgb = { r: 0, g: 0, b: 0 };
var rgb = {
r: 0,
g: 0,
b: 0
};
var a = 1;

@@ -384,21 +332,11 @@ var s = null;

var format = false;
if (typeof color == "string") {
color = stringInputToObject(color);
}
if (typeof color == "object") {
if (
isValidCSSUnit(color.r) &&
isValidCSSUnit(color.g) &&
isValidCSSUnit(color.b)
) {
if (_typeof(color) == "object") {
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
rgb = rgbToRgb(color.r, color.g, color.b);
ok = true;
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
} else if (
isValidCSSUnit(color.h) &&
isValidCSSUnit(color.s) &&
isValidCSSUnit(color.v)
) {
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
s = convertToPercentage(color.s);

@@ -409,7 +347,3 @@ v = convertToPercentage(color.v);

format = "hsv";
} else if (
isValidCSSUnit(color.h) &&
isValidCSSUnit(color.s) &&
isValidCSSUnit(color.l)
) {
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
s = convertToPercentage(color.s);

@@ -421,3 +355,2 @@ l = convertToPercentage(color.l);

}
if (color.hasOwnProperty("a")) {

@@ -427,5 +360,3 @@ a = color.a;

}
a = boundAlpha(a);
return {

@@ -437,3 +368,3 @@ ok: ok,

b: Math.min(255, Math.max(rgb.b, 0)),
a: a,
a: a
};

@@ -457,3 +388,3 @@ }

g: bound01(g, 255) * 255,
b: bound01(b, 255) * 255,
b: bound01(b, 255) * 255
};

@@ -470,3 +401,2 @@ }

b = bound01(b, 255);
var max = Math.max(r, g, b),

@@ -477,3 +407,2 @@ min = Math.min(r, g, b);

l = (max + min) / 2;
if (max == min) {

@@ -495,7 +424,9 @@ h = s = 0; // achromatic

}
h /= 6;
}
return { h: h, s: s, l: l };
return {
h: h,
s: s,
l: l
};
}

@@ -509,7 +440,5 @@

var r, g, b;
h = bound01(h, 360);
s = bound01(s, 100);
l = bound01(l, 100);
function hue2rgb(p, q, t) {

@@ -523,3 +452,2 @@ if (t < 0) t += 1;

}
if (s === 0) {

@@ -534,4 +462,7 @@ r = g = b = l; // achromatic

}
return { r: r * 255, g: g * 255, b: b * 255 };
return {
r: r * 255,
g: g * 255,
b: b * 255
};
}

@@ -547,3 +478,2 @@

b = bound01(b, 255);
var max = Math.max(r, g, b),

@@ -554,6 +484,4 @@ min = Math.min(r, g, b);

v = max;
var d = max - min;
s = max === 0 ? 0 : d / max;
if (max == min) {

@@ -575,3 +503,7 @@ h = 0; // achromatic

}
return { h: h, s: s, v: v };
return {
h: h,
s: s,
v: v
};
}

@@ -587,3 +519,2 @@

v = bound01(v, 100);
var i = Math.floor(h),

@@ -598,4 +529,7 @@ f = h - i,

b = [p, p, t, v, v, q][mod];
return { r: r * 255, g: g * 255, b: b * 255 };
return {
r: r * 255,
g: g * 255,
b: b * 255
};
}

@@ -608,18 +542,8 @@

function rgbToHex(r, g, b, allow3Char) {
var hex = [
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
];
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
// Return a 3 character hex if possible
if (
allow3Char &&
hex[0].charAt(0) == hex[0].charAt(1) &&
hex[1].charAt(0) == hex[1].charAt(1) &&
hex[2].charAt(0) == hex[2].charAt(1)
) {
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");

@@ -633,22 +557,8 @@ }

function rgbaToHex(r, g, b, a, allow4Char) {
var hex = [
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
pad2(convertDecimalToHex(a)),
];
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
// Return a 4 character hex if possible
if (
allow4Char &&
hex[0].charAt(0) == hex[0].charAt(1) &&
hex[1].charAt(0) == hex[1].charAt(1) &&
hex[2].charAt(0) == hex[2].charAt(1) &&
hex[3].charAt(0) == hex[3].charAt(1)
) {
return (
hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0)
);
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");

@@ -661,9 +571,3 @@ }

function rgbaToArgbHex(r, g, b, a) {
var hex = [
pad2(convertDecimalToHex(a)),
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
];
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
return hex.join("");

@@ -678,3 +582,2 @@ }

};
tinycolor.random = function () {

@@ -684,3 +587,3 @@ return tinycolor.fromRatio({

g: Math.random(),
b: Math.random(),
b: Math.random()
});

@@ -694,3 +597,3 @@ };

function desaturate(color, amount) {
function _desaturate(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -702,4 +605,3 @@ var hsl = tinycolor(color).toHsl();

}
function saturate(color, amount) {
function _saturate(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -711,8 +613,6 @@ var hsl = tinycolor(color).toHsl();

}
function greyscale(color) {
function _greyscale(color) {
return tinycolor(color).desaturate(100);
}
function lighten(color, amount) {
function _lighten(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -724,4 +624,3 @@ var hsl = tinycolor(color).toHsl();

}
function brighten(color, amount) {
function _brighten(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -734,4 +633,3 @@ var rgb = tinycolor(color).toRgb();

}
function darken(color, amount) {
function _darken(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -746,3 +644,3 @@ var hsl = tinycolor(color).toHsl();

// Values outside of this range will be wrapped into this range.
function spin(color, amount) {
function _spin(color, amount) {
var hsl = tinycolor(color).toHsl();

@@ -759,3 +657,3 @@ var hue = (hsl.h + amount) % 360;

function complement(color) {
function _complement(color) {
var hsl = tinycolor(color).toHsl();

@@ -765,3 +663,2 @@ hsl.h = (hsl.h + 180) % 360;

}
function polyad(color, number) {

@@ -775,27 +672,30 @@ if (isNaN(number) || number <= 0) {

for (var i = 1; i < number; i++) {
result.push(tinycolor({ h: (hsl.h + i * step) % 360, s: hsl.s, l: hsl.l }));
result.push(tinycolor({
h: (hsl.h + i * step) % 360,
s: hsl.s,
l: hsl.l
}));
}
return result;
}
function splitcomplement(color) {
function _splitcomplement(color) {
var hsl = tinycolor(color).toHsl();
var h = hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),
];
return [tinycolor(color), tinycolor({
h: (h + 72) % 360,
s: hsl.s,
l: hsl.l
}), tinycolor({
h: (h + 216) % 360,
s: hsl.s,
l: hsl.l
})];
}
function analogous(color, results, slices) {
function _analogous(color, results, slices) {
results = results || 6;
slices = slices || 30;
var hsl = tinycolor(color).toHsl();
var part = 360 / slices;
var ret = [tinycolor(color)];
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results; ) {
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
hsl.h = (hsl.h + part) % 360;

@@ -806,4 +706,3 @@ ret.push(tinycolor(hsl));

}
function monochromatic(color, results) {
function _monochromatic(color, results) {
results = results || 6;

@@ -816,8 +715,10 @@ var hsv = tinycolor(color).toHsv();

var modification = 1 / results;
while (results--) {
ret.push(tinycolor({ h: h, s: s, v: v }));
ret.push(tinycolor({
h: h,
s: s,
v: v
}));
v = (v + modification) % 1;
}
return ret;

@@ -831,8 +732,5 @@ }

amount = amount === 0 ? 0 : amount || 50;
var rgb1 = tinycolor(color1).toRgb();
var rgb2 = tinycolor(color2).toRgb();
var p = amount / 100;
var rgba = {

@@ -842,5 +740,4 @@ r: (rgb2.r - rgb1.r) * p + rgb1.r,

b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a,
a: (rgb2.a - rgb1.a) * p + rgb1.a
};
return tinycolor(rgba);

@@ -858,6 +755,3 @@ };

var c2 = tinycolor(color2);
return (
(Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
(Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05)
);
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
};

@@ -878,5 +772,3 @@

var wcag2Parms, out;
out = false;
wcag2Parms = validateWCAG2Parms(wcag2);

@@ -916,3 +808,2 @@ switch (wcag2Parms.level + wcag2Parms.size) {

size = args.size;
for (var i = 0; i < colorList.length; i++) {

@@ -925,10 +816,6 @@ readability = tinycolor.readability(baseColor, colorList[i]);

}
if (
tinycolor.isReadable(baseColor, bestColor, {
level: level,
size: size,
}) ||
!includeFallbackColors
) {
if (tinycolor.isReadable(baseColor, bestColor, {
level: level,
size: size
}) || !includeFallbackColors) {
return bestColor;

@@ -944,3 +831,3 @@ } else {

// <https://www.w3.org/TR/css-color-4/#named-colors>
var names = (tinycolor.names = {
var names = tinycolor.names = {
aliceblue: "f0f8ff",

@@ -1094,7 +981,7 @@ antiquewhite: "faebd7",

yellow: "ff0",
yellowgreen: "9acd32",
});
yellowgreen: "9acd32"
};
// Make it easy to access colors via `hexNames[hex]`
var hexNames = (tinycolor.hexNames = flip(names));
var hexNames = tinycolor.hexNames = flip(names);

@@ -1118,7 +1005,5 @@ // Utilities

a = parseFloat(a);
if (isNaN(a) || a < 0 || a > 1) {
a = 1;
}
return a;

@@ -1130,3 +1015,2 @@ }

if (isOnePointZero(n)) n = "100%";
var processPercent = isPercentage(n);

@@ -1146,3 +1030,3 @@ n = Math.min(max, Math.max(0, parseFloat(n)));

// Convert into [0, 1] range if it isn't already
return (n % max) / parseFloat(max);
return n % max / parseFloat(max);
}

@@ -1181,3 +1065,2 @@

}
return n;

@@ -1194,4 +1077,3 @@ }

}
var matchers = (function () {
var matchers = function () {
// <http://www.w3.org/TR/css3-values/#integers>

@@ -1209,21 +1091,4 @@ var CSS_INTEGER = "[-\\+]?\\d+%?";

// Whitespace can take the place of commas or opening paren
var PERMISSIVE_MATCH3 =
"[\\s|\\(]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")\\s*\\)?";
var PERMISSIVE_MATCH4 =
"[\\s|\\(]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")\\s*\\)?";
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
return {

@@ -1240,5 +1105,5 @@ CSS_UNIT: new RegExp(CSS_UNIT),

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})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
})();
}();

@@ -1262,3 +1127,9 @@ // `isValidCSSUnit`

} else if (color == "transparent") {
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
return {
r: 0,
g: 0,
b: 0,
a: 0,
format: "name"
};
}

@@ -1271,21 +1142,48 @@

var match;
if ((match = matchers.rgb.exec(color))) {
return { r: match[1], g: match[2], b: match[3] };
if (match = matchers.rgb.exec(color)) {
return {
r: match[1],
g: match[2],
b: match[3]
};
}
if ((match = matchers.rgba.exec(color))) {
return { r: match[1], g: match[2], b: match[3], a: match[4] };
if (match = matchers.rgba.exec(color)) {
return {
r: match[1],
g: match[2],
b: match[3],
a: match[4]
};
}
if ((match = matchers.hsl.exec(color))) {
return { h: match[1], s: match[2], l: match[3] };
if (match = matchers.hsl.exec(color)) {
return {
h: match[1],
s: match[2],
l: match[3]
};
}
if ((match = matchers.hsla.exec(color))) {
return { h: match[1], s: match[2], l: match[3], a: match[4] };
if (match = matchers.hsla.exec(color)) {
return {
h: match[1],
s: match[2],
l: match[3],
a: match[4]
};
}
if ((match = matchers.hsv.exec(color))) {
return { h: match[1], s: match[2], v: match[3] };
if (match = matchers.hsv.exec(color)) {
return {
h: match[1],
s: match[2],
v: match[3]
};
}
if ((match = matchers.hsva.exec(color))) {
return { h: match[1], s: match[2], v: match[3], a: match[4] };
if (match = matchers.hsva.exec(color)) {
return {
h: match[1],
s: match[2],
v: match[3],
a: match[4]
};
}
if ((match = matchers.hex8.exec(color))) {
if (match = matchers.hex8.exec(color)) {
return {

@@ -1296,6 +1194,6 @@ r: parseIntFromHex(match[1]),

a: convertHexToDecimal(match[4]),
format: named ? "name" : "hex8",
format: named ? "name" : "hex8"
};
}
if ((match = matchers.hex6.exec(color))) {
if (match = matchers.hex6.exec(color)) {
return {

@@ -1305,6 +1203,6 @@ r: parseIntFromHex(match[1]),

b: parseIntFromHex(match[3]),
format: named ? "name" : "hex",
format: named ? "name" : "hex"
};
}
if ((match = matchers.hex4.exec(color))) {
if (match = matchers.hex4.exec(color)) {
return {

@@ -1315,6 +1213,6 @@ r: parseIntFromHex(match[1] + "" + match[1]),

a: convertHexToDecimal(match[4] + "" + match[4]),
format: named ? "name" : "hex8",
format: named ? "name" : "hex8"
};
}
if ((match = matchers.hex3.exec(color))) {
if (match = matchers.hex3.exec(color)) {
return {

@@ -1324,9 +1222,7 @@ r: parseIntFromHex(match[1] + "" + match[1]),

b: parseIntFromHex(match[3] + "" + match[3]),
format: named ? "name" : "hex",
format: named ? "name" : "hex"
};
}
return false;
}
function validateWCAG2Parms(parms) {

@@ -1336,3 +1232,6 @@ // return valid WCAG2 parms for isReadable.

var level, size;
parms = parms || { level: "AA", size: "small" };
parms = parms || {
level: "AA",
size: "small"
};
level = (parms.level || "AA").toUpperCase();

@@ -1346,5 +1245,8 @@ size = (parms.size || "small").toLowerCase();

}
return { level: level, size: size };
return {
level: level,
size: size
};
}
export { tinycolor as default };
{
"version": "1.6.0-beta.8",
"version": "1.6.0-beta.9",
"name": "tinycolor2",

@@ -4,0 +4,0 @@ "description": "Fast Color Parsing and Manipulation",

@@ -33,4 +33,2 @@ # TinyColor

** Note: This support is in progress and was landed in [1.5.0](https://www.npmjs.com/package/tinycolor2/v/1.5.0) but has been temporarily reverted in 1.5.1 due to a bug report: https://github.com/bgrins/TinyColor/issues/249 **
It can be used as a module by downloading [npm/esm/tinycolor.js](https://github.com/bgrins/TinyColor/blob/master/npm/esm/tinycolor.js) or using https://esm.sh/tinycolor2.

@@ -37,0 +35,0 @@

@@ -11,8 +11,17 @@ // This file is autogenerated.

function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
// https://github.com/bgrins/TinyColor
// Brian Grinstead, MIT License
const trimLeft = /^\s+/;
const trimRight = /\s+$/;
var trimLeft = /^\s+/;
var trimRight = /\s+$/;
function tinycolor(color, opts) {

@@ -30,11 +39,4 @@ color = color ? color : "";

}
var rgb = inputToRGB(color);
(this._originalInput = color),
(this._r = rgb.r),
(this._g = rgb.g),
(this._b = rgb.b),
(this._a = rgb.a),
(this._roundA = Math.round(100 * this._a) / 100),
(this._format = opts.format || rgb.format);
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
this._gradientType = opts.gradientType;

@@ -49,26 +51,24 @@

if (this._b < 1) this._b = Math.round(this._b);
this._ok = rgb.ok;
}
tinycolor.prototype = {
isDark: function () {
isDark: function isDark() {
return this.getBrightness() < 128;
},
isLight: function () {
isLight: function isLight() {
return !this.isDark();
},
isValid: function () {
isValid: function isValid() {
return this._ok;
},
getOriginalInput: function () {
getOriginalInput: function getOriginalInput() {
return this._originalInput;
},
getFormat: function () {
getFormat: function getFormat() {
return this._format;
},
getAlpha: function () {
getAlpha: function getAlpha() {
return this._a;
},
getBrightness: function () {
getBrightness: function getBrightness() {
//http://www.w3.org/TR/AERT#color-contrast

@@ -78,3 +78,3 @@ var rgb = this.toRgb();

},
getLuminance: function () {
getLuminance: function getLuminance() {
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef

@@ -86,12 +86,8 @@ var rgb = this.toRgb();

BsRGB = rgb.b / 255;
if (RsRGB <= 0.03928) R = RsRGB / 12.92;
else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
},
setAlpha: function (value) {
setAlpha: function setAlpha(value) {
this._a = boundAlpha(value);

@@ -101,7 +97,12 @@ this._roundA = Math.round(100 * this._a) / 100;

},
toHsv: function () {
toHsv: function toHsv() {
var hsv = rgbToHsv(this._r, this._g, this._b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
return {
h: hsv.h * 360,
s: hsv.s,
v: hsv.v,
a: this._a
};
},
toHsvString: function () {
toHsvString: function toHsvString() {
var hsv = rgbToHsv(this._r, this._g, this._b);

@@ -111,11 +112,14 @@ var h = Math.round(hsv.h * 360),

v = Math.round(hsv.v * 100);
return this._a == 1
? "hsv(" + h + ", " + s + "%, " + v + "%)"
: "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
},
toHsl: function () {
toHsl: function toHsl() {
var hsl = rgbToHsl(this._r, this._g, this._b);
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
return {
h: hsl.h * 360,
s: hsl.s,
l: hsl.l,
a: this._a
};
},
toHslString: function () {
toHslString: function toHslString() {
var hsl = rgbToHsl(this._r, this._g, this._b);

@@ -125,19 +129,17 @@ var h = Math.round(hsl.h * 360),

l = Math.round(hsl.l * 100);
return this._a == 1
? "hsl(" + h + ", " + s + "%, " + l + "%)"
: "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
},
toHex: function (allow3Char) {
toHex: function toHex(allow3Char) {
return rgbToHex(this._r, this._g, this._b, allow3Char);
},
toHexString: function (allow3Char) {
toHexString: function toHexString(allow3Char) {
return "#" + this.toHex(allow3Char);
},
toHex8: function (allow4Char) {
toHex8: function toHex8(allow4Char) {
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
},
toHex8String: function (allow4Char) {
toHex8String: function toHex8String(allow4Char) {
return "#" + this.toHex8(allow4Char);
},
toRgb: function () {
toRgb: function toRgb() {
return {

@@ -147,25 +149,9 @@ r: Math.round(this._r),

b: Math.round(this._b),
a: this._a,
a: this._a
};
},
toRgbString: function () {
return this._a == 1
? "rgb(" +
Math.round(this._r) +
", " +
Math.round(this._g) +
", " +
Math.round(this._b) +
")"
: "rgba(" +
Math.round(this._r) +
", " +
Math.round(this._g) +
", " +
Math.round(this._b) +
", " +
this._roundA +
")";
toRgbString: function toRgbString() {
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
},
toPercentageRgb: function () {
toPercentageRgb: function toPercentageRgb() {
return {

@@ -175,40 +161,21 @@ r: Math.round(bound01(this._r, 255) * 100) + "%",

b: Math.round(bound01(this._b, 255) * 100) + "%",
a: this._a,
a: this._a
};
},
toPercentageRgbString: function () {
return this._a == 1
? "rgb(" +
Math.round(bound01(this._r, 255) * 100) +
"%, " +
Math.round(bound01(this._g, 255) * 100) +
"%, " +
Math.round(bound01(this._b, 255) * 100) +
"%)"
: "rgba(" +
Math.round(bound01(this._r, 255) * 100) +
"%, " +
Math.round(bound01(this._g, 255) * 100) +
"%, " +
Math.round(bound01(this._b, 255) * 100) +
"%, " +
this._roundA +
")";
toPercentageRgbString: function toPercentageRgbString() {
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
},
toName: function () {
toName: function toName() {
if (this._a === 0) {
return "transparent";
}
if (this._a < 1) {
return false;
}
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
},
toFilter: function (secondColor) {
toFilter: function toFilter(secondColor) {
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
var secondHex8String = hex8String;
var gradientType = this._gradientType ? "GradientType = 1, " : "";
if (secondColor) {

@@ -218,29 +185,10 @@ var s = tinycolor(secondColor);

}
return (
"progid:DXImageTransform.Microsoft.gradient(" +
gradientType +
"startColorstr=" +
hex8String +
",endColorstr=" +
secondHex8String +
")"
);
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
},
toString: function (format) {
toString: function toString(format) {
var formatSet = !!format;
format = format || this._format;
var formattedString = false;
var hasAlpha = this._a < 1 && this._a >= 0;
var needsAlphaFormat =
!formatSet &&
hasAlpha &&
(format === "hex" ||
format === "hex6" ||
format === "hex3" ||
format === "hex4" ||
format === "hex8" ||
format === "name");
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
if (needsAlphaFormat) {

@@ -281,10 +229,8 @@ // Special case for "transparent", all other non-alpha formats

}
return formattedString || this.toHexString();
},
clone: function () {
clone: function clone() {
return tinycolor(this.toString());
},
_applyModification: function (fn, args) {
_applyModification: function _applyModification(fn, args) {
var color = fn.apply(null, [this].concat([].slice.call(args)));

@@ -297,38 +243,37 @@ this._r = color._r;

},
lighten: function () {
return this._applyModification(lighten, arguments);
lighten: function lighten() {
return this._applyModification(_lighten, arguments);
},
brighten: function () {
return this._applyModification(brighten, arguments);
brighten: function brighten() {
return this._applyModification(_brighten, arguments);
},
darken: function () {
return this._applyModification(darken, arguments);
darken: function darken() {
return this._applyModification(_darken, arguments);
},
desaturate: function () {
return this._applyModification(desaturate, arguments);
desaturate: function desaturate() {
return this._applyModification(_desaturate, arguments);
},
saturate: function () {
return this._applyModification(saturate, arguments);
saturate: function saturate() {
return this._applyModification(_saturate, arguments);
},
greyscale: function () {
return this._applyModification(greyscale, arguments);
greyscale: function greyscale() {
return this._applyModification(_greyscale, arguments);
},
spin: function () {
return this._applyModification(spin, arguments);
spin: function spin() {
return this._applyModification(_spin, arguments);
},
_applyCombination: function (fn, args) {
_applyCombination: function _applyCombination(fn, args) {
return fn.apply(null, [this].concat([].slice.call(args)));
},
analogous: function () {
return this._applyCombination(analogous, arguments);
analogous: function analogous() {
return this._applyCombination(_analogous, arguments);
},
complement: function () {
return this._applyCombination(complement, arguments);
complement: function complement() {
return this._applyCombination(_complement, arguments);
},
monochromatic: function () {
return this._applyCombination(monochromatic, arguments);
monochromatic: function monochromatic() {
return this._applyCombination(_monochromatic, arguments);
},
splitcomplement: function () {
return this._applyCombination(splitcomplement, arguments);
splitcomplement: function splitcomplement() {
return this._applyCombination(_splitcomplement, arguments);
},

@@ -339,8 +284,8 @@ // Disabled until https://github.com/bgrins/TinyColor/issues/254

// },
triad: function () {
triad: function triad() {
return this._applyCombination(polyad, [3]);
},
tetrad: function () {
tetrad: function tetrad() {
return this._applyCombination(polyad, [4]);
},
}
};

@@ -351,3 +296,3 @@

tinycolor.fromRatio = function (color, opts) {
if (typeof color == "object") {
if (_typeof(color) == "object") {
var newColor = {};

@@ -365,3 +310,2 @@ for (var i in color) {

}
return tinycolor(color, opts);

@@ -386,3 +330,7 @@ };

function inputToRGB(color) {
var rgb = { r: 0, g: 0, b: 0 };
var rgb = {
r: 0,
g: 0,
b: 0
};
var a = 1;

@@ -394,21 +342,11 @@ var s = null;

var format = false;
if (typeof color == "string") {
color = stringInputToObject(color);
}
if (typeof color == "object") {
if (
isValidCSSUnit(color.r) &&
isValidCSSUnit(color.g) &&
isValidCSSUnit(color.b)
) {
if (_typeof(color) == "object") {
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
rgb = rgbToRgb(color.r, color.g, color.b);
ok = true;
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
} else if (
isValidCSSUnit(color.h) &&
isValidCSSUnit(color.s) &&
isValidCSSUnit(color.v)
) {
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
s = convertToPercentage(color.s);

@@ -419,7 +357,3 @@ v = convertToPercentage(color.v);

format = "hsv";
} else if (
isValidCSSUnit(color.h) &&
isValidCSSUnit(color.s) &&
isValidCSSUnit(color.l)
) {
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
s = convertToPercentage(color.s);

@@ -431,3 +365,2 @@ l = convertToPercentage(color.l);

}
if (color.hasOwnProperty("a")) {

@@ -437,5 +370,3 @@ a = color.a;

}
a = boundAlpha(a);
return {

@@ -447,3 +378,3 @@ ok: ok,

b: Math.min(255, Math.max(rgb.b, 0)),
a: a,
a: a
};

@@ -467,3 +398,3 @@ }

g: bound01(g, 255) * 255,
b: bound01(b, 255) * 255,
b: bound01(b, 255) * 255
};

@@ -480,3 +411,2 @@ }

b = bound01(b, 255);
var max = Math.max(r, g, b),

@@ -487,3 +417,2 @@ min = Math.min(r, g, b);

l = (max + min) / 2;
if (max == min) {

@@ -505,7 +434,9 @@ h = s = 0; // achromatic

}
h /= 6;
}
return { h: h, s: s, l: l };
return {
h: h,
s: s,
l: l
};
}

@@ -519,7 +450,5 @@

var r, g, b;
h = bound01(h, 360);
s = bound01(s, 100);
l = bound01(l, 100);
function hue2rgb(p, q, t) {

@@ -533,3 +462,2 @@ if (t < 0) t += 1;

}
if (s === 0) {

@@ -544,4 +472,7 @@ r = g = b = l; // achromatic

}
return { r: r * 255, g: g * 255, b: b * 255 };
return {
r: r * 255,
g: g * 255,
b: b * 255
};
}

@@ -557,3 +488,2 @@

b = bound01(b, 255);
var max = Math.max(r, g, b),

@@ -564,6 +494,4 @@ min = Math.min(r, g, b);

v = max;
var d = max - min;
s = max === 0 ? 0 : d / max;
if (max == min) {

@@ -585,3 +513,7 @@ h = 0; // achromatic

}
return { h: h, s: s, v: v };
return {
h: h,
s: s,
v: v
};
}

@@ -597,3 +529,2 @@

v = bound01(v, 100);
var i = Math.floor(h),

@@ -608,4 +539,7 @@ f = h - i,

b = [p, p, t, v, v, q][mod];
return { r: r * 255, g: g * 255, b: b * 255 };
return {
r: r * 255,
g: g * 255,
b: b * 255
};
}

@@ -618,18 +552,8 @@

function rgbToHex(r, g, b, allow3Char) {
var hex = [
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
];
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
// Return a 3 character hex if possible
if (
allow3Char &&
hex[0].charAt(0) == hex[0].charAt(1) &&
hex[1].charAt(0) == hex[1].charAt(1) &&
hex[2].charAt(0) == hex[2].charAt(1)
) {
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");

@@ -643,22 +567,8 @@ }

function rgbaToHex(r, g, b, a, allow4Char) {
var hex = [
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
pad2(convertDecimalToHex(a)),
];
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
// Return a 4 character hex if possible
if (
allow4Char &&
hex[0].charAt(0) == hex[0].charAt(1) &&
hex[1].charAt(0) == hex[1].charAt(1) &&
hex[2].charAt(0) == hex[2].charAt(1) &&
hex[3].charAt(0) == hex[3].charAt(1)
) {
return (
hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0)
);
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");

@@ -671,9 +581,3 @@ }

function rgbaToArgbHex(r, g, b, a) {
var hex = [
pad2(convertDecimalToHex(a)),
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
];
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
return hex.join("");

@@ -688,3 +592,2 @@ }

};
tinycolor.random = function () {

@@ -694,3 +597,3 @@ return tinycolor.fromRatio({

g: Math.random(),
b: Math.random(),
b: Math.random()
});

@@ -704,3 +607,3 @@ };

function desaturate(color, amount) {
function _desaturate(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -712,4 +615,3 @@ var hsl = tinycolor(color).toHsl();

}
function saturate(color, amount) {
function _saturate(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -721,8 +623,6 @@ var hsl = tinycolor(color).toHsl();

}
function greyscale(color) {
function _greyscale(color) {
return tinycolor(color).desaturate(100);
}
function lighten(color, amount) {
function _lighten(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -734,4 +634,3 @@ var hsl = tinycolor(color).toHsl();

}
function brighten(color, amount) {
function _brighten(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -744,4 +643,3 @@ var rgb = tinycolor(color).toRgb();

}
function darken(color, amount) {
function _darken(color, amount) {
amount = amount === 0 ? 0 : amount || 10;

@@ -756,3 +654,3 @@ var hsl = tinycolor(color).toHsl();

// Values outside of this range will be wrapped into this range.
function spin(color, amount) {
function _spin(color, amount) {
var hsl = tinycolor(color).toHsl();

@@ -769,3 +667,3 @@ var hue = (hsl.h + amount) % 360;

function complement(color) {
function _complement(color) {
var hsl = tinycolor(color).toHsl();

@@ -775,3 +673,2 @@ hsl.h = (hsl.h + 180) % 360;

}
function polyad(color, number) {

@@ -785,27 +682,30 @@ if (isNaN(number) || number <= 0) {

for (var i = 1; i < number; i++) {
result.push(tinycolor({ h: (hsl.h + i * step) % 360, s: hsl.s, l: hsl.l }));
result.push(tinycolor({
h: (hsl.h + i * step) % 360,
s: hsl.s,
l: hsl.l
}));
}
return result;
}
function splitcomplement(color) {
function _splitcomplement(color) {
var hsl = tinycolor(color).toHsl();
var h = hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),
];
return [tinycolor(color), tinycolor({
h: (h + 72) % 360,
s: hsl.s,
l: hsl.l
}), tinycolor({
h: (h + 216) % 360,
s: hsl.s,
l: hsl.l
})];
}
function analogous(color, results, slices) {
function _analogous(color, results, slices) {
results = results || 6;
slices = slices || 30;
var hsl = tinycolor(color).toHsl();
var part = 360 / slices;
var ret = [tinycolor(color)];
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results; ) {
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
hsl.h = (hsl.h + part) % 360;

@@ -816,4 +716,3 @@ ret.push(tinycolor(hsl));

}
function monochromatic(color, results) {
function _monochromatic(color, results) {
results = results || 6;

@@ -826,8 +725,10 @@ var hsv = tinycolor(color).toHsv();

var modification = 1 / results;
while (results--) {
ret.push(tinycolor({ h: h, s: s, v: v }));
ret.push(tinycolor({
h: h,
s: s,
v: v
}));
v = (v + modification) % 1;
}
return ret;

@@ -841,8 +742,5 @@ }

amount = amount === 0 ? 0 : amount || 50;
var rgb1 = tinycolor(color1).toRgb();
var rgb2 = tinycolor(color2).toRgb();
var p = amount / 100;
var rgba = {

@@ -852,5 +750,4 @@ r: (rgb2.r - rgb1.r) * p + rgb1.r,

b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a,
a: (rgb2.a - rgb1.a) * p + rgb1.a
};
return tinycolor(rgba);

@@ -868,6 +765,3 @@ };

var c2 = tinycolor(color2);
return (
(Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
(Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05)
);
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
};

@@ -888,5 +782,3 @@

var wcag2Parms, out;
out = false;
wcag2Parms = validateWCAG2Parms(wcag2);

@@ -926,3 +818,2 @@ switch (wcag2Parms.level + wcag2Parms.size) {

size = args.size;
for (var i = 0; i < colorList.length; i++) {

@@ -935,10 +826,6 @@ readability = tinycolor.readability(baseColor, colorList[i]);

}
if (
tinycolor.isReadable(baseColor, bestColor, {
level: level,
size: size,
}) ||
!includeFallbackColors
) {
if (tinycolor.isReadable(baseColor, bestColor, {
level: level,
size: size
}) || !includeFallbackColors) {
return bestColor;

@@ -954,3 +841,3 @@ } else {

// <https://www.w3.org/TR/css-color-4/#named-colors>
var names = (tinycolor.names = {
var names = tinycolor.names = {
aliceblue: "f0f8ff",

@@ -1104,7 +991,7 @@ antiquewhite: "faebd7",

yellow: "ff0",
yellowgreen: "9acd32",
});
yellowgreen: "9acd32"
};
// Make it easy to access colors via `hexNames[hex]`
var hexNames = (tinycolor.hexNames = flip(names));
var hexNames = tinycolor.hexNames = flip(names);

@@ -1128,7 +1015,5 @@ // Utilities

a = parseFloat(a);
if (isNaN(a) || a < 0 || a > 1) {
a = 1;
}
return a;

@@ -1140,3 +1025,2 @@ }

if (isOnePointZero(n)) n = "100%";
var processPercent = isPercentage(n);

@@ -1156,3 +1040,3 @@ n = Math.min(max, Math.max(0, parseFloat(n)));

// Convert into [0, 1] range if it isn't already
return (n % max) / parseFloat(max);
return n % max / parseFloat(max);
}

@@ -1191,3 +1075,2 @@

}
return n;

@@ -1204,4 +1087,3 @@ }

}
var matchers = (function () {
var matchers = function () {
// <http://www.w3.org/TR/css3-values/#integers>

@@ -1219,21 +1101,4 @@ var CSS_INTEGER = "[-\\+]?\\d+%?";

// Whitespace can take the place of commas or opening paren
var PERMISSIVE_MATCH3 =
"[\\s|\\(]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")\\s*\\)?";
var PERMISSIVE_MATCH4 =
"[\\s|\\(]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")\\s*\\)?";
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
return {

@@ -1250,5 +1115,5 @@ CSS_UNIT: new RegExp(CSS_UNIT),

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})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
})();
}();

@@ -1272,3 +1137,9 @@ // `isValidCSSUnit`

} else if (color == "transparent") {
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
return {
r: 0,
g: 0,
b: 0,
a: 0,
format: "name"
};
}

@@ -1281,21 +1152,48 @@

var match;
if ((match = matchers.rgb.exec(color))) {
return { r: match[1], g: match[2], b: match[3] };
if (match = matchers.rgb.exec(color)) {
return {
r: match[1],
g: match[2],
b: match[3]
};
}
if ((match = matchers.rgba.exec(color))) {
return { r: match[1], g: match[2], b: match[3], a: match[4] };
if (match = matchers.rgba.exec(color)) {
return {
r: match[1],
g: match[2],
b: match[3],
a: match[4]
};
}
if ((match = matchers.hsl.exec(color))) {
return { h: match[1], s: match[2], l: match[3] };
if (match = matchers.hsl.exec(color)) {
return {
h: match[1],
s: match[2],
l: match[3]
};
}
if ((match = matchers.hsla.exec(color))) {
return { h: match[1], s: match[2], l: match[3], a: match[4] };
if (match = matchers.hsla.exec(color)) {
return {
h: match[1],
s: match[2],
l: match[3],
a: match[4]
};
}
if ((match = matchers.hsv.exec(color))) {
return { h: match[1], s: match[2], v: match[3] };
if (match = matchers.hsv.exec(color)) {
return {
h: match[1],
s: match[2],
v: match[3]
};
}
if ((match = matchers.hsva.exec(color))) {
return { h: match[1], s: match[2], v: match[3], a: match[4] };
if (match = matchers.hsva.exec(color)) {
return {
h: match[1],
s: match[2],
v: match[3],
a: match[4]
};
}
if ((match = matchers.hex8.exec(color))) {
if (match = matchers.hex8.exec(color)) {
return {

@@ -1306,6 +1204,6 @@ r: parseIntFromHex(match[1]),

a: convertHexToDecimal(match[4]),
format: named ? "name" : "hex8",
format: named ? "name" : "hex8"
};
}
if ((match = matchers.hex6.exec(color))) {
if (match = matchers.hex6.exec(color)) {
return {

@@ -1315,6 +1213,6 @@ r: parseIntFromHex(match[1]),

b: parseIntFromHex(match[3]),
format: named ? "name" : "hex",
format: named ? "name" : "hex"
};
}
if ((match = matchers.hex4.exec(color))) {
if (match = matchers.hex4.exec(color)) {
return {

@@ -1325,6 +1223,6 @@ r: parseIntFromHex(match[1] + "" + match[1]),

a: convertHexToDecimal(match[4] + "" + match[4]),
format: named ? "name" : "hex8",
format: named ? "name" : "hex8"
};
}
if ((match = matchers.hex3.exec(color))) {
if (match = matchers.hex3.exec(color)) {
return {

@@ -1334,9 +1232,7 @@ r: parseIntFromHex(match[1] + "" + match[1]),

b: parseIntFromHex(match[3] + "" + match[3]),
format: named ? "name" : "hex",
format: named ? "name" : "hex"
};
}
return false;
}
function validateWCAG2Parms(parms) {

@@ -1346,3 +1242,6 @@ // return valid WCAG2 parms for isReadable.

var level, size;
parms = parms || { level: "AA", size: "small" };
parms = parms || {
level: "AA",
size: "small"
};
level = (parms.level || "AA").toUpperCase();

@@ -1356,3 +1255,6 @@ size = (parms.size || "small").toLowerCase();

}
return { level: level, size: size };
return {
level: level,
size: size
};
}

@@ -1359,0 +1261,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc