colortranslator
Advanced tools
Comparing version 1.9.1 to 1.9.2
# Changelog | ||
## [1.9.2] - 2021-12-22 | ||
- Removed comments from the bundle | ||
## [1.9.1] - 2021-12-09 | ||
@@ -4,0 +8,0 @@ |
@@ -1,15 +0,1 @@ | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
var t,e,r,n,i=function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)};function o(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}!function(t){t.HEX="HEX",t.RGB="RGB",t.RGBA="RGBA",t.HSL="HSL",t.HSLA="HSLA",t.CMYK="CMYK"}(t||(t={})),function(t){t.ANALOGOUS="ANALOGOUS",t.COMPLEMENTARY="COMPLEMENTARY",t.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",t.TRIADIC="TRIADIC",t.TETRADIC="TETRADIC",t.SQUARE="SQUARE"}(e||(e={})),function(t){t.ADDITIVE="ADDITIVE",t.SUBTRACTIVE="SUBTRACTIVE"}(r||(r={})),function(t){t.black="#000000",t.silver="#C0C0C0",t.gray="#808080",t.white="#FFFFFF",t.maroon="#800000",t.red="#FF0000",t.purple="#800080",t.fuchsia="#FF00FF",t.green="#008000",t.lime="#00FF00",t.olive="#808000",t.yellow="#FFFF00",t.navy="#000080",t.blue="#0000FF",t.teal="#008080",t.aqua="#00FFFF",t.orange="#FFA500",t.aliceblue="#F0F8FF",t.antiquewhite="#FAEBD7",t.aquamarine="#7FFFD4",t.azure="#F0FFFF",t.beige="#F5F5DC",t.bisque="#FFE4C4",t.blanchedalmond="#FFEBCD",t.blueviolet="#8A2BE2",t.brown="#A52A2A",t.burlywood="#DEB887",t.cadetblue="#5F9EA0",t.chartreuse="#7FFF00",t.chocolate="#D2691E",t.coral="#FF7F50",t.cornflowerblue="#6495ED",t.cornsilk="#FFF8DC",t.crimson="#DC143C",t.cyan="#00FFFF",t.darkblue="#00008B",t.darkcyan="#008B8B",t.darkgoldenrod="#B8860B",t.darkgray="#A9A9A9",t.darkgreen="#006400",t.darkgrey="#A9A9A9",t.darkkhaki="#BDB76B",t.darkmagenta="#8B008B",t.darkolivegreen="#556B2F",t.darkorange="#FF8C00",t.darkorchid="#9932CC",t.darkred="#8B0000",t.darksalmon="#E9967A",t.darkseagreen="#8FBC8F",t.darkslateblue="#483D8B",t.darkslategray="#2F4F4F",t.darkslategrey="#2F4F4F",t.darkturquoise="#00CED1",t.darkviolet="#9400D3",t.deeppink="#FF1493",t.deepskyblue="#00BFFF",t.dimgray="#696969",t.dimgrey="#696969",t.dodgerblue="#1E90FF",t.firebrick="#B22222",t.floralwhite="#FFFAF0",t.forestgreen="#228B22",t.gainsboro="#DCDCDC",t.ghostwhite="#F8F8FF",t.gold="#FFD700",t.goldenrod="#DAA520",t.greenyellow="#ADFF2F",t.grey="#808080",t.honeydew="#F0FFF0",t.hotpink="#FF69B4",t.indianred="#CD5C5C",t.indigo="#4B0082",t.ivory="#FFFFF0",t.khaki="#F0E68C",t.lavender="#E6E6FA",t.lavenderblush="#FFF0F5",t.lawngreen="#7CFC00",t.lemonchiffon="#FFFACD",t.lightblue="#ADD8E6",t.lightcoral="#F08080",t.lightcyan="#E0FFFF",t.lightgoldenrodyellow="#FAFAD2",t.lightgray="#D3D3D3",t.lightgreen="#90EE90",t.lightgrey="#D3D3D3",t.lightpink="#FFB6C1",t.lightsalmon="#FFA07A",t.lightseagreen="#20B2AA",t.lightskyblue="#87CEFA",t.lightslategray="#778899",t.lightslategrey="#778899",t.lightsteelblue="#B0C4DE",t.lightyellow="#FFFFE0",t.limegreen="#32CD32",t.linen="#FAF0E6",t.magenta="#FF00FF",t.mediumaquamarine="#66CDAA",t.mediumblue="#0000CD",t.mediumorchid="#BA55D3",t.mediumpurple="#9370DB",t.mediumseagreen="#3CB371",t.mediumslateblue="#7B68EE",t.mediumspringgreen="#00FA9A",t.mediumturquoise="#48D1CC",t.mediumvioletred="#C71585",t.midnightblue="#191970",t.mintcream="#F5FFFA",t.mistyrose="#FFE4E1",t.moccasin="#FFE4B5",t.navajowhite="#FFDEAD",t.oldlace="#FDF5E6",t.olivedrab="#6B8E23",t.orangered="#FF4500",t.orchid="#DA70D6",t.palegoldenrod="#EEE8AA",t.palegreen="#98FB98",t.paleturquoise="#AFEEEE",t.palevioletred="#DB7093",t.papayawhip="#FFEFD5",t.peachpuff="#FFDAB9",t.peru="#CD853F",t.pink="#FFC0CB",t.plum="#DDA0DD",t.powderblue="#B0E0E6",t.rosybrown="#BC8F8F",t.royalblue="#4169E1",t.saddlebrown="#8B4513",t.salmon="#FA8072",t.sandybrown="#F4A460",t.seagreen="#2E8B57",t.seashell="#FFF5EE",t.sienna="#A0522D",t.skyblue="#87CEEB",t.slateblue="#6A5ACD",t.slategray="#708090",t.slategrey="#708090",t.snow="#FFFAFA",t.springgreen="#00FF7F",t.steelblue="#4682B4",t.tan="#D2B48C",t.thistle="#D8BFD8",t.tomato="#FF6347",t.turquoise="#40E0D0",t.violet="#EE82EE",t.wheat="#F5DEB3",t.whitesmoke="#F5F5F5",t.yellowgreen="#9ACD32",t.rebeccapurple="#663399"}(n||(n={}));var u,a,s,c,d,f,h,l=Object.keys(n),p=((u={})[t.HEX]=/^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i,u[t.RGB]=/^rgb\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*\)$/,u[t.RGBA]=/^rgba\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*,\s*(\d\.?\d*)\s*\)$/,u[t.HSL]=/^hsl\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%s*\)$/,u[t.HSLA]=/^hsla\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*,\s*(\d\.?\d*)\s*\)$/,u[t.CMYK]=/^(?:device-cmyk|cmyk)\s*\(\s*(?:(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)|(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*))\s*\)$/,u),g=/^(\d+(?:\.\d+)?|\.\d+)%$/,b=/^0x([a-f\d]{1,2})$/i,F="The provided string color doesn't have a correct format",A="The provided color object doesn't have the proper keys or format",m=function(t,e,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?Math.round(255*((e-t)*r+t)):r<3?Math.round(255*e):r<4?Math.round(255*((e-t)*(4-r)+t)):Math.round(255*t)},y=function(t,e,r){e/=100;var n=(r/=100)<=.5?r*(e+1):r+e-r*e,i=2*r-n;return{r:m(i,n,(t/=60)+2),g:m(i,n,t),b:m(i,n,t-2)}},E=function(t,e,r,n){return n=1-n,{r:Math.round(255*(1-t)*n),g:Math.round(255*(1-e)*n),b:Math.round(255*(1-r)*n)}},H=function(t,e,r){t/=255,e/=255,r/=255;var n=1-Math.max(t,e,r),i=1-n,o=(i-t)/i,u=(i-e)/i,a=(i-r)/i;return{c:Math.round(100*o),m:Math.round(100*u),y:Math.round(100*a),k:Math.round(100*n)}},B=function(t,e,r,n){void 0===n&&(n=1),t/=255,e/=255,r/=255,n=Math.min(n,1);var i=Math.max(t,e,r),o=Math.min(t,e,r),u=i-o,a=0,s=0,c=(i+o)/2;if(0===u)a=0,s=0;else{switch(i){case t:a=(e-r)/u%6;break;case e:a=(r-t)/u+2;break;case r:a=(t-e)/u+4}(a=Math.round(60*a))<0&&(a+=360),s=u/(1-Math.abs(2*c-1))}return{h:a,s:Math.round(100*s),l:Math.round(100*c),a:n}},v=function(t,e){if(t<0&&(t+=360),t>360&&(t-=360),360===t||0===t)return t;var r=[[0,120],[120,180],[180,240],[240,360]],n=[[0,60],[60,120],[120,240],[240,360]],i=e?n:r,o=0,u=0,a=0,s=0;return(e?r:n).find((function(e,r){return t>=e[0]&&t<e[1]&&(o=e[0],u=e[1],a=i[r][0],s=i[r][1],!0)})),a+(s-a)/(u-o)*(t-o)},M=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},R=function(t){return g.test(""+t)?+(""+t).replace(g,"$1"):Math.min(+t,100)},S=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},C=function(t){var e=parseInt(""+t).toString(16).toUpperCase();return 1===e.length?"0x0"+e:"0x"+e},L=function(t){var e=parseInt(""+t).toString(16).toUpperCase();return 1===e.length&&(e="0"+e),e},D=function(t,e){return void 0===e&&(e=!1),!e&&g.test(t)?Math.min(255*+t.replace(g,"$1")/100,255):b.test(t)?3===t.length?e?parseInt(t+t.slice(-1))/255:parseInt(t+t.slice(-1)):e?parseInt(t)/255:parseInt(t):Math.min(+t,e?1:255)},G=function(t){return Math.min(g.test(t)?+t.replace(g,"$1")/100:+t,1)},k=function(t){return t.sort().join().toUpperCase()},O=function(t,e){void 0===e&&(e=0);var r=Math.pow(10,e);return Math.round(+t*r)/r},X=function(t,e,r){return Math.max(e,Math.min(t,r))},I=((a={})[t.HEX]=function(t){return"#"+L(t.r)+L(t.g)+L(t.b)+(M(t,"a")&&L(t.a)||"")},a[t.RGB]=function(t){return"rgb"+(M(t,"a")?"a":"")+"("+O(t.r)+","+O(t.g)+","+O(t.b)+(M(t,"a")&&","+O(t.a,2)||"")+")"},a[t.HSL]=function(t){return"hsl"+(M(t,"a")?"a":"")+"("+O(t.h)+","+O(t.s)+"%,"+O(t.l)+"%"+(M(t,"a")&&","+O(t.a,2)||"")+")"},a[t.CMYK]=function(t){return"cmyk("+O(t.c)+"%,"+O(t.m)+"%,"+O(t.y)+"%,"+O(t.k)+"%)"},a),j=function(t){return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},T=function(t){return isNaN(+t)||t>1?1:O(t,2)},Y=function(t,e,n){return e.reduce((function(e,u){return o(o([],e,!0),[i(i({},t),{h:n===r.ADDITIVE?j(t.h+u):j(v(v(t.h,!1)+u,!0))})],!1)}),[i({},t)])},P=function(t,e){return Y(t,[30,-30],e)},w=function(t,e){return Y(t,[180],e)},K=function(t,e){return Y(t,[150,-150],e)},x=function(t,e){return Y(t,[120,-120],e)},N=function(t,e){return Y(t,[60,-120,180],e)},V=function(t,e){return Y(t,[90,-90,180],e)},U=function(e){return"string"==typeof e?function(e){var r;if(Object.keys(t).some((function(t){if(p[t].test(e))return r=t,!0})),!r&&~l.indexOf(e)&&(r=t.HEX),!r)throw new Error(F);return r}(e):function(e){var r,n=!1,i=k(Object.keys(e));if(Object.keys(t).filter((function(e){return e!==t.HEX})).some((function(t){if(k(t.split(""))===i)return r=t,!0})),r&&r===t.RGB||r===t.RGBA){var o=Object.entries(e).map((function(t){return b.test(""+t[1])})),u=Object.entries(e).map((function(t){return g.test(""+t[1])||!b.test(""+t[1])&&!isNaN(+t[1])&&+t[1]<=255})),a=o.some((function(t,e){return e>0&&t!==o[e-1]})),s=u.some((function(t,e){return e>0&&t!==u[e-1]}));!(n=a||s||!o[0]&&!u[0])&&o[0]&&(r=t.HEX)}if(!r||n)throw new Error(A);return r}(e)},$=((s={})[t.HEX]=function(t){var e=(~l.indexOf(t)?n[t]:t).match(p.HEX),r={r:S(e[1]||e[5]),g:S(e[2]||e[6]),b:S(e[3]||e[7])},i=e[4]||e[8];return void 0!==i&&(r.a=S(i)/255),r},s[t.RGB]=function(t){var e=t.match(p.RGB),r=D(e[1]||e[4]),n=D(e[2]||e[5]),i=D(e[3]||e[6]);return{r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255)}},s[t.RGBA]=function(t){var e=t.match(p.RGBA),r=D(e[1]||e[4]),n=D(e[2]||e[5]),i=D(e[3]||e[6]),o=+e[7];return{r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255),a:T(o)}},s[t.HSL]=function(t){var e=t.match(p.HSL),r=j(+e[1]),n=R(e[2]),i=R(e[3]);return y(r,n,i)},s[t.HSLA]=function(t){var e=t.match(p.HSLA),r=j(+e[1]),n=R(e[2]),i=R(e[3]),o=+e[4],u=y(r,n,i);return u.a=T(o),u},s[t.CMYK]=function(t){var e=t.match(p.CMYK),r=G(e[1]||e[5]),n=G(e[2]||e[6]),i=G(e[3]||e[7]),o=G(e[4]||e[8]);return E(r,n,i,o)},s),q=((c={})[t.HEX]=function(t){var e={r:D(""+t.r),g:D(""+t.g),b:D(""+t.b)};return e.a=M(t,"a")?Math.min(D(""+t.a,!0),1):1,e},c[t.RGB]=function(t){var e=this.HEX(t);return delete e.a,e},c[t.RGBA]=function(t){return this.HEX(t)},c[t.HSL]=function(t){var e=R(""+t.s),r=R(""+t.l);return y(j(t.h),e,r)},c[t.HSLA]=function(t){var e=this.HSL(t);return e.a=T(t.a),e},c[t.CMYK]=function(t){var e=G(""+t.c),r=G(""+t.m),n=G(""+t.y),i=G(""+t.k);return E(e,r,n,i)},c),Q=function(t,e){return void 0===e&&(e=U(t)),"string"==typeof t?$[e](t):q[e](t)},_=((d={})[t.HEX]=function(t){return{r:C(t.r),g:C(t.g),b:C(t.b)}},d.HEXA=function(t){var e=_.HEX(t);return e.a=M(t,"a")?C(255*t.a):"0xFF",e},d[t.RGB]=function(t){return M(t,"a")&&delete t.a,t},d[t.RGBA]=function(t){return t.a=M(t,"a")?O(t.a,2):1,t},d[t.HSL]=function(t){var e=B(t.r,t.g,t.b);return delete e.a,e},d[t.HSLA]=function(t){var e=_.HSL(t);return e.a=M(t,"a")?O(t.a,2):1,e},d[t.CMYK]=function(t){return H(t.r,t.g,t.b)},d),z=function(e,r,n){var o=U(e),u="string"==typeof e,a=Q(e,o),s="string"==typeof e&&M(a,"a")||"string"!=typeof e&&M(e,"a"),c=B(a.r,a.g,a.b,a.a);s||delete c.a;var d=n?c.l/(r+1):(100-c.l)/(r+1),f=Array(r).fill(null).map((function(t,e){return i(i({},c),{l:c.l+d*(e+1)*(1-2*+n)})}));switch(o){case t.HEX:default:return f.map((function(t){var e=y(t.h,t.s,t.l);return s&&(e.a=t.a),u?s?I.HEX(i(i({},e),{a:O(255*e.a,2)})):I.HEX(e):s?_.HEXA(e):_.HEX(e)}));case t.RGB:case t.RGBA:return f.map((function(t){var e=y(t.h,t.s,t.l);return s&&(e.a=t.a),u?I.RGB(e):s?_.RGBA(e):_.RGB(e)}));case t.HSL:case t.HSLA:return f.map((function(t){return u?I.HSL(t):s?_.HSLA(i(i({},y(t.h,t.s,t.l)),{a:t.a})):_.HSL(y(t.h,t.s,t.l))}))}},J=((f={buildHarmony:function(e,r,n){var i=U(e),o=Q(e,i),u=B(o.r,o.g,o.b,o.a),a="string"==typeof e&&M(o,"a")||"string"!=typeof e&&M(e,"a"),s="string"==typeof e;switch(i){case t.HEX:default:return a?this.HEXA(u,r,n,s):this.HEX(u,r,n,s);case t.HSL:return this.HSL(u,r,n,s);case t.HSLA:return this.HSLA(u,r,n,s);case t.RGB:return this.RGB(u,r,n,s);case t.RGBA:return this.RGBA(u,r,n,s)}}})[t.HEX]=function(t,e,r,n){return e(t,r).map((function(t){return n?I.HEX(y(t.h,t.s,t.l)):_.HEX(y(t.h,t.s,t.l))}))},f.HEXA=function(t,e,r,n){return e(t,r).map((function(t){return n?I.HEX(i(i({},y(t.h,t.s,t.l)),{a:255*T(t.a)})):_.HEXA(i(i({},y(t.h,t.s,t.l)),{a:T(t.a)}))}))},f[t.RGB]=function(t,e,r,n){return e(t,r).map((function(t){return n?I.RGB(y(t.h,t.s,t.l)):_.RGB(y(t.h,t.s,t.l))}))},f[t.RGBA]=function(t,e,r,n){return e(t,r).map((function(t){return n?I.RGB(i(i({},y(t.h,t.s,t.l)),{a:T(t.a)})):_.RGBA(i(i({},y(t.h,t.s,t.l)),{a:T(t.a)}))}))},f[t.HSL]=function(t,e,r,n){return e(t,r).map((function(t){return n?I.HSL({h:t.h,s:t.s,l:t.l}):_.HSL(y(t.h,t.s,t.l))}))},f[t.HSLA]=function(t,e,r,n){return e(t,r).map((function(t){return n?I.HSL(i(i({},t),{a:T(t.a)})):_.HSLA(i(i({},y(t.h,t.s,t.l)),{a:T(t.a)}))}))},f),W=((h={mix:function(t,e){var n,o,u,a,s,c,d,f,h,l,p,g,b,F,A,m=t.map((function(t){var e=U(t);return Q(t,e)})),y=e===r.SUBTRACTIVE?m.map((function(t){var e,r,n,i,o,u,a,s,c,d,f,h,l,p,g=(e=t.r,r=t.g,n=t.b,i=Math.min(e,r,n),o=Math.min(255-e,255-r,255-n),u=e-i,a=r-i,s=n-i,c=Math.min(u,a),d=u-c,f=(a+c)/2,h=(s+a-c)/2,l=Math.max(d,f,h)/Math.max(u,a,s),p=isNaN(l)||l===1/0||l<=0?1:l,{r:d/p+o,y:f/p+o,b:h/p+o});return M(t,"a")&&(g.a=t.a),g})):null;function E(t){var n=e===r.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return t.reduce((function(t,n){var o=M(n,"a")?n.a:1,u={r:Math.min(t.r+n.r*o,255),b:Math.min(t.b+n.b*o,255),a:1-(1-o)*(1-t.a)},a="g"in t?t.g:t.y,s="g"in n?n.g:n.y;return i(i({},u),e===r.ADDITIVE?{g:Math.min(a+s*o,255)}:{y:Math.min(a+s*o,255)})}),n)}if(e===r.ADDITIVE)n=E(m);else{var H=E(y);o=H.r,u=H.y,a=H.b,s=Math.min(o,u,a),c=Math.min(255-o,255-u,255-a),d=o-s,f=u-s,h=a-s,l=Math.min(f,h),p=d+f-l,g=f+2*l,b=2*(h-l),F=Math.max(p,g,b)/Math.max(d,f,h),A=isNaN(F)||F===1/0||F<=0?1:F,(n={r:p/A+c,g:g/A+c,b:b/A+c}).a=H.a}return{r:O(n.r,2),g:O(n.g,2),b:O(n.b,2),a:X(n.a,0,1)}}})[t.HEX]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?I.HEX(n):_.HEX(n)},h.HEXA=function(t,e,r){var n=this.mix(t,e);return n.a=r?255*T(n.a):T(n.a),r?I.HEX(n):_.HEXA(n)},h[t.RGB]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?I.RGB(n):_.RGB(n)},h[t.RGBA]=function(t,e,r){var n=this.mix(t,e);return r?I.RGB(n):_.RGBA(n)},h[t.HSL]=function(t,e,r){var n=this.mix(t,e),i=B(n.r,n.g,n.b);return delete n.a,delete i.a,r?I.HSL(i):_.HSL(n)},h[t.HSLA]=function(t,e,r){var n=this.mix(t,e),i=B(n.r,n.g,n.b,n.a);return r?I.HSL(i):_.HSLA(n)},h),Z=function(t,e){return"string"==typeof t&&e||"object"==typeof t&&!e},tt=function(t,e,r,n,i){var o=n(Q(t,e));return r?i(o):o},et=function(t,e,r,n,i,o){r<1&&(r=5);var u=function(t,e,r){var n=r-1,i=(e.r-t.r)/n,o=(e.g-t.g)/n,u=(e.b-t.b)/n,a=T(t.a),s=(T(e.a)-a)/n;return Array(r).fill(null).map((function(r,c){return 0===c?t:c===n?e:{r:O(t.r+i*c),g:O(t.g+o*c),b:O(t.b+u*c),a:O(a+s*c,2)}}))}(Q(t),Q(e),r);return u.map((function(t){var e=i(t);return n?o(e):e}))},rt=function(){function n(t){this.rgb=Q(t),this.updateHSL(),this.updateCMYK()}return n.prototype.updateRGB=function(){this.rgb=i(i({},y(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},n.prototype.updateRGBFromCMYK=function(){this.rgb=i(i({},E(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},n.prototype.updateHSL=function(){this.hsl=B(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},n.prototype.updateCMYK=function(){this.cmyk=H(this.rgb.r,this.rgb.g,this.rgb.b)},n.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},n.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},n.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},n.prototype.setH=function(t){return this.hsl.h=j(t),this.updateRGBAndCMYK()},n.prototype.setS=function(t){return this.hsl.s=X(t,0,100),this.updateRGBAndCMYK()},n.prototype.setL=function(t){return this.hsl.l=X(t,0,100),this.updateRGBAndCMYK()},n.prototype.setR=function(t){return this.rgb.r=X(t,0,255),this.updateHSLAndCMYK()},n.prototype.setG=function(t){return this.rgb.g=X(t,0,255),this.updateHSLAndCMYK()},n.prototype.setB=function(t){return this.rgb.b=X(t,0,255),this.updateHSLAndCMYK()},n.prototype.setA=function(t){return this.hsl.a=this.rgb.a=X(t,0,1),this},n.prototype.setC=function(t){return this.cmyk.c=X(t,0,100),this.updateRGBAndHSL()},n.prototype.setM=function(t){return this.cmyk.m=X(t,0,100),this.updateRGBAndHSL()},n.prototype.setY=function(t){return this.cmyk.y=X(t,0,100),this.updateRGBAndHSL()},n.prototype.setK=function(t){return this.cmyk.k=X(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(n.prototype,"H",{get:function(){return O(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"S",{get:function(){return O(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"L",{get:function(){return O(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"R",{get:function(){return O(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"G",{get:function(){return O(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"B",{get:function(){return O(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"A",{get:function(){return O(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"C",{get:function(){return O(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"M",{get:function(){return O(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"Y",{get:function(){return O(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"K",{get:function(){return O(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HEXObject",{get:function(){return _.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HEXAObject",{get:function(){return _.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGBAObject",{get:function(){return i(i({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HSLAObject",{get:function(){return i(i({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HEX",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b};return I.HEX(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HEXA",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b,a:255*this.A};return I.HEX(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGB",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b};return I.RGB(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGBA",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b,a:this.A};return I.RGB(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HSL",{get:function(){var t=this.hsl,e={h:t.h,s:t.s,l:t.l};return I.HSL(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HSLA",{get:function(){return I.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"CMYK",{get:function(){return I.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),n.toHEX=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,_.HEX,I.HEX)},n.toHEXA=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,_.HEXA,I.HEX)},n.toRGB=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,_.RGB,I.RGB)},n.toRGBA=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,_.RGBA,I.RGB)},n.toHSL=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.HSL&&Z(e,r)?e:tt(e,n,r,_.HSL,I.HSL)},n.toHSLA=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.HSLA&&Z(e,r)?e:tt(e,n,r,_.HSLA,I.HSL)},n.toCMYK=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.CMYK&&Z(e,r)?e:tt(e,n,r,_.CMYK,I.CMYK)},n.getBlendHEX=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,_.HEX,I.HEX)},n.getBlendHEXA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,_.HEXA,I.HEX)},n.getBlendRGB=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,_.RGB,I.RGB)},n.getBlendRGBA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,_.RGBA,I.RGB)},n.getBlendHSL=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,_.HSL,I.HSL)},n.getBlendHSLA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,_.HSLA,I.HSL)},n.getMixHEX=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),W.HEX(t,e,n)},n.getMixHEXA=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),W.HEXA(t,e,n)},n.getMixRGB=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),W.RGB(t,e,n)},n.getMixRGBA=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),W.RGBA(t,e,n)},n.getMixHSL=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),W.HSL(t,e,n)},n.getMixHSLA=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),W.HSLA(t,e,n)},n.getShades=function(t,e){return z(t,e,!0)},n.getTints=function(t,e){return z(t,e,!1)},n.getHarmony=function(t,n,i){switch(void 0===n&&(n=e.COMPLEMENTARY),void 0===i&&(i=r.ADDITIVE),n){case e.ANALOGOUS:return J.buildHarmony(t,P,i);case e.SPLIT_COMPLEMENTARY:return J.buildHarmony(t,K,i);case e.TRIADIC:return J.buildHarmony(t,x,i);case e.TETRADIC:return J.buildHarmony(t,N,i);case e.SQUARE:return J.buildHarmony(t,V,i);default:return J.buildHarmony(t,w,i)}},n}();export{rt as ColorTranslator,e as Harmony,r as Mix}; |
@@ -1,16 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
var t,e,r,n,i=function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)};function o(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}!function(t){t.HEX="HEX",t.RGB="RGB",t.RGBA="RGBA",t.HSL="HSL",t.HSLA="HSLA",t.CMYK="CMYK"}(t||(t={})),exports.Harmony=void 0,(e=exports.Harmony||(exports.Harmony={})).ANALOGOUS="ANALOGOUS",e.COMPLEMENTARY="COMPLEMENTARY",e.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",e.TRIADIC="TRIADIC",e.TETRADIC="TETRADIC",e.SQUARE="SQUARE",exports.Mix=void 0,(r=exports.Mix||(exports.Mix={})).ADDITIVE="ADDITIVE",r.SUBTRACTIVE="SUBTRACTIVE",function(t){t.black="#000000",t.silver="#C0C0C0",t.gray="#808080",t.white="#FFFFFF",t.maroon="#800000",t.red="#FF0000",t.purple="#800080",t.fuchsia="#FF00FF",t.green="#008000",t.lime="#00FF00",t.olive="#808000",t.yellow="#FFFF00",t.navy="#000080",t.blue="#0000FF",t.teal="#008080",t.aqua="#00FFFF",t.orange="#FFA500",t.aliceblue="#F0F8FF",t.antiquewhite="#FAEBD7",t.aquamarine="#7FFFD4",t.azure="#F0FFFF",t.beige="#F5F5DC",t.bisque="#FFE4C4",t.blanchedalmond="#FFEBCD",t.blueviolet="#8A2BE2",t.brown="#A52A2A",t.burlywood="#DEB887",t.cadetblue="#5F9EA0",t.chartreuse="#7FFF00",t.chocolate="#D2691E",t.coral="#FF7F50",t.cornflowerblue="#6495ED",t.cornsilk="#FFF8DC",t.crimson="#DC143C",t.cyan="#00FFFF",t.darkblue="#00008B",t.darkcyan="#008B8B",t.darkgoldenrod="#B8860B",t.darkgray="#A9A9A9",t.darkgreen="#006400",t.darkgrey="#A9A9A9",t.darkkhaki="#BDB76B",t.darkmagenta="#8B008B",t.darkolivegreen="#556B2F",t.darkorange="#FF8C00",t.darkorchid="#9932CC",t.darkred="#8B0000",t.darksalmon="#E9967A",t.darkseagreen="#8FBC8F",t.darkslateblue="#483D8B",t.darkslategray="#2F4F4F",t.darkslategrey="#2F4F4F",t.darkturquoise="#00CED1",t.darkviolet="#9400D3",t.deeppink="#FF1493",t.deepskyblue="#00BFFF",t.dimgray="#696969",t.dimgrey="#696969",t.dodgerblue="#1E90FF",t.firebrick="#B22222",t.floralwhite="#FFFAF0",t.forestgreen="#228B22",t.gainsboro="#DCDCDC",t.ghostwhite="#F8F8FF",t.gold="#FFD700",t.goldenrod="#DAA520",t.greenyellow="#ADFF2F",t.grey="#808080",t.honeydew="#F0FFF0",t.hotpink="#FF69B4",t.indianred="#CD5C5C",t.indigo="#4B0082",t.ivory="#FFFFF0",t.khaki="#F0E68C",t.lavender="#E6E6FA",t.lavenderblush="#FFF0F5",t.lawngreen="#7CFC00",t.lemonchiffon="#FFFACD",t.lightblue="#ADD8E6",t.lightcoral="#F08080",t.lightcyan="#E0FFFF",t.lightgoldenrodyellow="#FAFAD2",t.lightgray="#D3D3D3",t.lightgreen="#90EE90",t.lightgrey="#D3D3D3",t.lightpink="#FFB6C1",t.lightsalmon="#FFA07A",t.lightseagreen="#20B2AA",t.lightskyblue="#87CEFA",t.lightslategray="#778899",t.lightslategrey="#778899",t.lightsteelblue="#B0C4DE",t.lightyellow="#FFFFE0",t.limegreen="#32CD32",t.linen="#FAF0E6",t.magenta="#FF00FF",t.mediumaquamarine="#66CDAA",t.mediumblue="#0000CD",t.mediumorchid="#BA55D3",t.mediumpurple="#9370DB",t.mediumseagreen="#3CB371",t.mediumslateblue="#7B68EE",t.mediumspringgreen="#00FA9A",t.mediumturquoise="#48D1CC",t.mediumvioletred="#C71585",t.midnightblue="#191970",t.mintcream="#F5FFFA",t.mistyrose="#FFE4E1",t.moccasin="#FFE4B5",t.navajowhite="#FFDEAD",t.oldlace="#FDF5E6",t.olivedrab="#6B8E23",t.orangered="#FF4500",t.orchid="#DA70D6",t.palegoldenrod="#EEE8AA",t.palegreen="#98FB98",t.paleturquoise="#AFEEEE",t.palevioletred="#DB7093",t.papayawhip="#FFEFD5",t.peachpuff="#FFDAB9",t.peru="#CD853F",t.pink="#FFC0CB",t.plum="#DDA0DD",t.powderblue="#B0E0E6",t.rosybrown="#BC8F8F",t.royalblue="#4169E1",t.saddlebrown="#8B4513",t.salmon="#FA8072",t.sandybrown="#F4A460",t.seagreen="#2E8B57",t.seashell="#FFF5EE",t.sienna="#A0522D",t.skyblue="#87CEEB",t.slateblue="#6A5ACD",t.slategray="#708090",t.slategrey="#708090",t.snow="#FFFAFA",t.springgreen="#00FF7F",t.steelblue="#4682B4",t.tan="#D2B48C",t.thistle="#D8BFD8",t.tomato="#FF6347",t.turquoise="#40E0D0",t.violet="#EE82EE",t.wheat="#F5DEB3",t.whitesmoke="#F5F5F5",t.yellowgreen="#9ACD32",t.rebeccapurple="#663399"}(n||(n={}));var a,u,s,c,d,l,f,h=Object.keys(n),p=((a={})[t.HEX]=/^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i,a[t.RGB]=/^rgb\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*\)$/,a[t.RGBA]=/^rgba\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*,\s*(\d\.?\d*)\s*\)$/,a[t.HSL]=/^hsl\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%s*\)$/,a[t.HSLA]=/^hsla\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*,\s*(\d\.?\d*)\s*\)$/,a[t.CMYK]=/^(?:device-cmyk|cmyk)\s*\(\s*(?:(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)|(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*))\s*\)$/,a),g=/^(\d+(?:\.\d+)?|\.\d+)%$/,b=/^0x([a-f\d]{1,2})$/i,F="The provided string color doesn't have a correct format",y="The provided color object doesn't have the proper keys or format",m=function(t,e,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?Math.round(255*((e-t)*r+t)):r<3?Math.round(255*e):r<4?Math.round(255*((e-t)*(4-r)+t)):Math.round(255*t)},A=function(t,e,r){e/=100;var n=(r/=100)<=.5?r*(e+1):r+e-r*e,i=2*r-n;return{r:m(i,n,(t/=60)+2),g:m(i,n,t),b:m(i,n,t-2)}},H=function(t,e,r,n){return n=1-n,{r:Math.round(255*(1-t)*n),g:Math.round(255*(1-e)*n),b:Math.round(255*(1-r)*n)}},E=function(t,e,r){t/=255,e/=255,r/=255;var n=1-Math.max(t,e,r),i=1-n,o=(i-t)/i,a=(i-e)/i,u=(i-r)/i;return{c:Math.round(100*o),m:Math.round(100*a),y:Math.round(100*u),k:Math.round(100*n)}},B=function(t,e,r,n){void 0===n&&(n=1),t/=255,e/=255,r/=255,n=Math.min(n,1);var i=Math.max(t,e,r),o=Math.min(t,e,r),a=i-o,u=0,s=0,c=(i+o)/2;if(0===a)u=0,s=0;else{switch(i){case t:u=(e-r)/a%6;break;case e:u=(r-t)/a+2;break;case r:u=(t-e)/a+4}(u=Math.round(60*u))<0&&(u+=360),s=a/(1-Math.abs(2*c-1))}return{h:u,s:Math.round(100*s),l:Math.round(100*c),a:n}},v=function(t,e){if(t<0&&(t+=360),t>360&&(t-=360),360===t||0===t)return t;var r=[[0,120],[120,180],[180,240],[240,360]],n=[[0,60],[60,120],[120,240],[240,360]],i=e?n:r,o=0,a=0,u=0,s=0;return(e?r:n).find((function(e,r){return t>=e[0]&&t<e[1]&&(o=e[0],a=e[1],u=i[r][0],s=i[r][1],!0)})),u+(s-u)/(a-o)*(t-o)},M=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},R=function(t){return g.test(""+t)?+(""+t).replace(g,"$1"):Math.min(+t,100)},S=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},C=function(t){var e=parseInt(""+t).toString(16).toUpperCase();return 1===e.length?"0x0"+e:"0x"+e},L=function(t){var e=parseInt(""+t).toString(16).toUpperCase();return 1===e.length&&(e="0"+e),e},D=function(t,e){return void 0===e&&(e=!1),!e&&g.test(t)?Math.min(255*+t.replace(g,"$1")/100,255):b.test(t)?3===t.length?e?parseInt(t+t.slice(-1))/255:parseInt(t+t.slice(-1)):e?parseInt(t)/255:parseInt(t):Math.min(+t,e?1:255)},G=function(t){return Math.min(g.test(t)?+t.replace(g,"$1")/100:+t,1)},x=function(t){return t.sort().join().toUpperCase()},k=function(t,e){void 0===e&&(e=0);var r=Math.pow(10,e);return Math.round(+t*r)/r},O=function(t,e,r){return Math.max(e,Math.min(t,r))},X=((u={})[t.HEX]=function(t){return"#"+L(t.r)+L(t.g)+L(t.b)+(M(t,"a")&&L(t.a)||"")},u[t.RGB]=function(t){return"rgb"+(M(t,"a")?"a":"")+"("+k(t.r)+","+k(t.g)+","+k(t.b)+(M(t,"a")&&","+k(t.a,2)||"")+")"},u[t.HSL]=function(t){return"hsl"+(M(t,"a")?"a":"")+"("+k(t.h)+","+k(t.s)+"%,"+k(t.l)+"%"+(M(t,"a")&&","+k(t.a,2)||"")+")"},u[t.CMYK]=function(t){return"cmyk("+k(t.c)+"%,"+k(t.m)+"%,"+k(t.y)+"%,"+k(t.k)+"%)"},u),j=function(t){return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},I=function(t){return isNaN(+t)||t>1?1:k(t,2)},T=function(t,e,r){return e.reduce((function(e,n){return o(o([],e,!0),[i(i({},t),{h:r===exports.Mix.ADDITIVE?j(t.h+n):j(v(v(t.h,!1)+n,!0))})],!1)}),[i({},t)])},Y=function(t,e){return T(t,[30,-30],e)},P=function(t,e){return T(t,[180],e)},w=function(t,e){return T(t,[150,-150],e)},K=function(t,e){return T(t,[120,-120],e)},N=function(t,e){return T(t,[60,-120,180],e)},V=function(t,e){return T(t,[90,-90,180],e)},U=function(e){return"string"==typeof e?function(e){var r;if(Object.keys(t).some((function(t){if(p[t].test(e))return r=t,!0})),!r&&~h.indexOf(e)&&(r=t.HEX),!r)throw new Error(F);return r}(e):function(e){var r,n=!1,i=x(Object.keys(e));if(Object.keys(t).filter((function(e){return e!==t.HEX})).some((function(t){if(x(t.split(""))===i)return r=t,!0})),r&&r===t.RGB||r===t.RGBA){var o=Object.entries(e).map((function(t){return b.test(""+t[1])})),a=Object.entries(e).map((function(t){return g.test(""+t[1])||!b.test(""+t[1])&&!isNaN(+t[1])&&+t[1]<=255})),u=o.some((function(t,e){return e>0&&t!==o[e-1]})),s=a.some((function(t,e){return e>0&&t!==a[e-1]}));!(n=u||s||!o[0]&&!a[0])&&o[0]&&(r=t.HEX)}if(!r||n)throw new Error(y);return r}(e)},$=((s={})[t.HEX]=function(t){var e=(~h.indexOf(t)?n[t]:t).match(p.HEX),r={r:S(e[1]||e[5]),g:S(e[2]||e[6]),b:S(e[3]||e[7])},i=e[4]||e[8];return void 0!==i&&(r.a=S(i)/255),r},s[t.RGB]=function(t){var e=t.match(p.RGB),r=D(e[1]||e[4]),n=D(e[2]||e[5]),i=D(e[3]||e[6]);return{r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255)}},s[t.RGBA]=function(t){var e=t.match(p.RGBA),r=D(e[1]||e[4]),n=D(e[2]||e[5]),i=D(e[3]||e[6]),o=+e[7];return{r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255),a:I(o)}},s[t.HSL]=function(t){var e=t.match(p.HSL),r=j(+e[1]),n=R(e[2]),i=R(e[3]);return A(r,n,i)},s[t.HSLA]=function(t){var e=t.match(p.HSLA),r=j(+e[1]),n=R(e[2]),i=R(e[3]),o=+e[4],a=A(r,n,i);return a.a=I(o),a},s[t.CMYK]=function(t){var e=t.match(p.CMYK),r=G(e[1]||e[5]),n=G(e[2]||e[6]),i=G(e[3]||e[7]),o=G(e[4]||e[8]);return H(r,n,i,o)},s),q=((c={})[t.HEX]=function(t){var e={r:D(""+t.r),g:D(""+t.g),b:D(""+t.b)};return e.a=M(t,"a")?Math.min(D(""+t.a,!0),1):1,e},c[t.RGB]=function(t){var e=this.HEX(t);return delete e.a,e},c[t.RGBA]=function(t){return this.HEX(t)},c[t.HSL]=function(t){var e=R(""+t.s),r=R(""+t.l);return A(j(t.h),e,r)},c[t.HSLA]=function(t){var e=this.HSL(t);return e.a=I(t.a),e},c[t.CMYK]=function(t){var e=G(""+t.c),r=G(""+t.m),n=G(""+t.y),i=G(""+t.k);return H(e,r,n,i)},c),_=function(t,e){return void 0===e&&(e=U(t)),"string"==typeof t?$[e](t):q[e](t)},Q=((d={})[t.HEX]=function(t){return{r:C(t.r),g:C(t.g),b:C(t.b)}},d.HEXA=function(t){var e=Q.HEX(t);return e.a=M(t,"a")?C(255*t.a):"0xFF",e},d[t.RGB]=function(t){return M(t,"a")&&delete t.a,t},d[t.RGBA]=function(t){return t.a=M(t,"a")?k(t.a,2):1,t},d[t.HSL]=function(t){var e=B(t.r,t.g,t.b);return delete e.a,e},d[t.HSLA]=function(t){var e=Q.HSL(t);return e.a=M(t,"a")?k(t.a,2):1,e},d[t.CMYK]=function(t){return E(t.r,t.g,t.b)},d),z=function(e,r,n){var o=U(e),a="string"==typeof e,u=_(e,o),s="string"==typeof e&&M(u,"a")||"string"!=typeof e&&M(e,"a"),c=B(u.r,u.g,u.b,u.a);s||delete c.a;var d=n?c.l/(r+1):(100-c.l)/(r+1),l=Array(r).fill(null).map((function(t,e){return i(i({},c),{l:c.l+d*(e+1)*(1-2*+n)})}));switch(o){case t.HEX:default:return l.map((function(t){var e=A(t.h,t.s,t.l);return s&&(e.a=t.a),a?s?X.HEX(i(i({},e),{a:k(255*e.a,2)})):X.HEX(e):s?Q.HEXA(e):Q.HEX(e)}));case t.RGB:case t.RGBA:return l.map((function(t){var e=A(t.h,t.s,t.l);return s&&(e.a=t.a),a?X.RGB(e):s?Q.RGBA(e):Q.RGB(e)}));case t.HSL:case t.HSLA:return l.map((function(t){return a?X.HSL(t):s?Q.HSLA(i(i({},A(t.h,t.s,t.l)),{a:t.a})):Q.HSL(A(t.h,t.s,t.l))}))}},J=((l={buildHarmony:function(e,r,n){var i=U(e),o=_(e,i),a=B(o.r,o.g,o.b,o.a),u="string"==typeof e&&M(o,"a")||"string"!=typeof e&&M(e,"a"),s="string"==typeof e;switch(i){case t.HEX:default:return u?this.HEXA(a,r,n,s):this.HEX(a,r,n,s);case t.HSL:return this.HSL(a,r,n,s);case t.HSLA:return this.HSLA(a,r,n,s);case t.RGB:return this.RGB(a,r,n,s);case t.RGBA:return this.RGBA(a,r,n,s)}}})[t.HEX]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.HEX(A(t.h,t.s,t.l)):Q.HEX(A(t.h,t.s,t.l))}))},l.HEXA=function(t,e,r,n){return e(t,r).map((function(t){return n?X.HEX(i(i({},A(t.h,t.s,t.l)),{a:255*I(t.a)})):Q.HEXA(i(i({},A(t.h,t.s,t.l)),{a:I(t.a)}))}))},l[t.RGB]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.RGB(A(t.h,t.s,t.l)):Q.RGB(A(t.h,t.s,t.l))}))},l[t.RGBA]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.RGB(i(i({},A(t.h,t.s,t.l)),{a:I(t.a)})):Q.RGBA(i(i({},A(t.h,t.s,t.l)),{a:I(t.a)}))}))},l[t.HSL]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.HSL({h:t.h,s:t.s,l:t.l}):Q.HSL(A(t.h,t.s,t.l))}))},l[t.HSLA]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.HSL(i(i({},t),{a:I(t.a)})):Q.HSLA(i(i({},A(t.h,t.s,t.l)),{a:I(t.a)}))}))},l),W=((f={mix:function(t,e){var r,n,o,a,u,s,c,d,l,f,h,p,g,b,F,y=t.map((function(t){var e=U(t);return _(t,e)})),m=e===exports.Mix.SUBTRACTIVE?y.map((function(t){var e,r,n,i,o,a,u,s,c,d,l,f,h,p,g=(e=t.r,r=t.g,n=t.b,i=Math.min(e,r,n),o=Math.min(255-e,255-r,255-n),a=e-i,u=r-i,s=n-i,c=Math.min(a,u),d=a-c,l=(u+c)/2,f=(s+u-c)/2,h=Math.max(d,l,f)/Math.max(a,u,s),p=isNaN(h)||h===1/0||h<=0?1:h,{r:d/p+o,y:l/p+o,b:f/p+o});return M(t,"a")&&(g.a=t.a),g})):null;function A(t){var r=e===exports.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return t.reduce((function(t,r){var n=M(r,"a")?r.a:1,o={r:Math.min(t.r+r.r*n,255),b:Math.min(t.b+r.b*n,255),a:1-(1-n)*(1-t.a)},a="g"in t?t.g:t.y,u="g"in r?r.g:r.y;return i(i({},o),e===exports.Mix.ADDITIVE?{g:Math.min(a+u*n,255)}:{y:Math.min(a+u*n,255)})}),r)}if(e===exports.Mix.ADDITIVE)r=A(y);else{var H=A(m);n=H.r,o=H.y,a=H.b,u=Math.min(n,o,a),s=Math.min(255-n,255-o,255-a),c=n-u,d=o-u,l=a-u,f=Math.min(d,l),h=c+d-f,p=d+2*f,g=2*(l-f),b=Math.max(h,p,g)/Math.max(c,d,l),F=isNaN(b)||b===1/0||b<=0?1:b,(r={r:h/F+s,g:p/F+s,b:g/F+s}).a=H.a}return{r:k(r.r,2),g:k(r.g,2),b:k(r.b,2),a:O(r.a,0,1)}}})[t.HEX]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?X.HEX(n):Q.HEX(n)},f.HEXA=function(t,e,r){var n=this.mix(t,e);return n.a=r?255*I(n.a):I(n.a),r?X.HEX(n):Q.HEXA(n)},f[t.RGB]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?X.RGB(n):Q.RGB(n)},f[t.RGBA]=function(t,e,r){var n=this.mix(t,e);return r?X.RGB(n):Q.RGBA(n)},f[t.HSL]=function(t,e,r){var n=this.mix(t,e),i=B(n.r,n.g,n.b);return delete n.a,delete i.a,r?X.HSL(i):Q.HSL(n)},f[t.HSLA]=function(t,e,r){var n=this.mix(t,e),i=B(n.r,n.g,n.b,n.a);return r?X.HSL(i):Q.HSLA(n)},f),Z=function(t,e){return"string"==typeof t&&e||"object"==typeof t&&!e},tt=function(t,e,r,n,i){var o=n(_(t,e));return r?i(o):o},et=function(t,e,r,n,i,o){r<1&&(r=5);var a=function(t,e,r){var n=r-1,i=(e.r-t.r)/n,o=(e.g-t.g)/n,a=(e.b-t.b)/n,u=I(t.a),s=(I(e.a)-u)/n;return Array(r).fill(null).map((function(r,c){return 0===c?t:c===n?e:{r:k(t.r+i*c),g:k(t.g+o*c),b:k(t.b+a*c),a:k(u+s*c,2)}}))}(_(t),_(e),r);return a.map((function(t){var e=i(t);return n?o(e):e}))},rt=function(){function e(t){this.rgb=_(t),this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=i(i({},A(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=i(i({},H(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=B(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=E(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setH=function(t){return this.hsl.h=j(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=O(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=O(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=O(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=O(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=O(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=O(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=O(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=O(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=O(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=O(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"H",{get:function(){return k(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return k(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return k(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return k(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return k(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return k(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return k(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return k(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return k(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return k(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return k(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return Q.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return Q.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return i(i({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return i(i({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b};return X.HEX(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b,a:255*this.A};return X.HEX(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b};return X.RGB(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b,a:this.A};return X.RGB(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){var t=this.hsl,e={h:t.h,s:t.s,l:t.l};return X.HSL(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return X.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return X.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),e.toHEX=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,Q.HEX,X.HEX)},e.toHEXA=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,Q.HEXA,X.HEX)},e.toRGB=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,Q.RGB,X.RGB)},e.toRGBA=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,Q.RGBA,X.RGB)},e.toHSL=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.HSL&&Z(e,r)?e:tt(e,n,r,Q.HSL,X.HSL)},e.toHSLA=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.HSLA&&Z(e,r)?e:tt(e,n,r,Q.HSLA,X.HSL)},e.toCMYK=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.CMYK&&Z(e,r)?e:tt(e,n,r,Q.CMYK,X.CMYK)},e.getBlendHEX=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.HEX,X.HEX)},e.getBlendHEXA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.HEXA,X.HEX)},e.getBlendRGB=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.RGB,X.RGB)},e.getBlendRGBA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.RGBA,X.RGB)},e.getBlendHSL=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.HSL,X.HSL)},e.getBlendHSLA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.HSLA,X.HSL)},e.getMixHEX=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.HEX(t,e,r)},e.getMixHEXA=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.HEXA(t,e,r)},e.getMixRGB=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.RGB(t,e,r)},e.getMixRGBA=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.RGBA(t,e,r)},e.getMixHSL=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.HSL(t,e,r)},e.getMixHSLA=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.HSLA(t,e,r)},e.getShades=function(t,e){return z(t,e,!0)},e.getTints=function(t,e){return z(t,e,!1)},e.getHarmony=function(t,e,r){switch(void 0===e&&(e=exports.Harmony.COMPLEMENTARY),void 0===r&&(r=exports.Mix.ADDITIVE),e){case exports.Harmony.ANALOGOUS:return J.buildHarmony(t,Y,r);case exports.Harmony.SPLIT_COMPLEMENTARY:return J.buildHarmony(t,w,r);case exports.Harmony.TRIADIC:return J.buildHarmony(t,K,r);case exports.Harmony.TETRADIC:return J.buildHarmony(t,N,r);case exports.Harmony.SQUARE:return J.buildHarmony(t,V,r);default:return J.buildHarmony(t,P,r)}},e}();exports.ColorTranslator=rt; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,r,n,i=function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)};function o(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}!function(t){t.HEX="HEX",t.RGB="RGB",t.RGBA="RGBA",t.HSL="HSL",t.HSLA="HSLA",t.CMYK="CMYK"}(t||(t={})),exports.Harmony=void 0,(e=exports.Harmony||(exports.Harmony={})).ANALOGOUS="ANALOGOUS",e.COMPLEMENTARY="COMPLEMENTARY",e.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",e.TRIADIC="TRIADIC",e.TETRADIC="TETRADIC",e.SQUARE="SQUARE",exports.Mix=void 0,(r=exports.Mix||(exports.Mix={})).ADDITIVE="ADDITIVE",r.SUBTRACTIVE="SUBTRACTIVE",function(t){t.black="#000000",t.silver="#C0C0C0",t.gray="#808080",t.white="#FFFFFF",t.maroon="#800000",t.red="#FF0000",t.purple="#800080",t.fuchsia="#FF00FF",t.green="#008000",t.lime="#00FF00",t.olive="#808000",t.yellow="#FFFF00",t.navy="#000080",t.blue="#0000FF",t.teal="#008080",t.aqua="#00FFFF",t.orange="#FFA500",t.aliceblue="#F0F8FF",t.antiquewhite="#FAEBD7",t.aquamarine="#7FFFD4",t.azure="#F0FFFF",t.beige="#F5F5DC",t.bisque="#FFE4C4",t.blanchedalmond="#FFEBCD",t.blueviolet="#8A2BE2",t.brown="#A52A2A",t.burlywood="#DEB887",t.cadetblue="#5F9EA0",t.chartreuse="#7FFF00",t.chocolate="#D2691E",t.coral="#FF7F50",t.cornflowerblue="#6495ED",t.cornsilk="#FFF8DC",t.crimson="#DC143C",t.cyan="#00FFFF",t.darkblue="#00008B",t.darkcyan="#008B8B",t.darkgoldenrod="#B8860B",t.darkgray="#A9A9A9",t.darkgreen="#006400",t.darkgrey="#A9A9A9",t.darkkhaki="#BDB76B",t.darkmagenta="#8B008B",t.darkolivegreen="#556B2F",t.darkorange="#FF8C00",t.darkorchid="#9932CC",t.darkred="#8B0000",t.darksalmon="#E9967A",t.darkseagreen="#8FBC8F",t.darkslateblue="#483D8B",t.darkslategray="#2F4F4F",t.darkslategrey="#2F4F4F",t.darkturquoise="#00CED1",t.darkviolet="#9400D3",t.deeppink="#FF1493",t.deepskyblue="#00BFFF",t.dimgray="#696969",t.dimgrey="#696969",t.dodgerblue="#1E90FF",t.firebrick="#B22222",t.floralwhite="#FFFAF0",t.forestgreen="#228B22",t.gainsboro="#DCDCDC",t.ghostwhite="#F8F8FF",t.gold="#FFD700",t.goldenrod="#DAA520",t.greenyellow="#ADFF2F",t.grey="#808080",t.honeydew="#F0FFF0",t.hotpink="#FF69B4",t.indianred="#CD5C5C",t.indigo="#4B0082",t.ivory="#FFFFF0",t.khaki="#F0E68C",t.lavender="#E6E6FA",t.lavenderblush="#FFF0F5",t.lawngreen="#7CFC00",t.lemonchiffon="#FFFACD",t.lightblue="#ADD8E6",t.lightcoral="#F08080",t.lightcyan="#E0FFFF",t.lightgoldenrodyellow="#FAFAD2",t.lightgray="#D3D3D3",t.lightgreen="#90EE90",t.lightgrey="#D3D3D3",t.lightpink="#FFB6C1",t.lightsalmon="#FFA07A",t.lightseagreen="#20B2AA",t.lightskyblue="#87CEFA",t.lightslategray="#778899",t.lightslategrey="#778899",t.lightsteelblue="#B0C4DE",t.lightyellow="#FFFFE0",t.limegreen="#32CD32",t.linen="#FAF0E6",t.magenta="#FF00FF",t.mediumaquamarine="#66CDAA",t.mediumblue="#0000CD",t.mediumorchid="#BA55D3",t.mediumpurple="#9370DB",t.mediumseagreen="#3CB371",t.mediumslateblue="#7B68EE",t.mediumspringgreen="#00FA9A",t.mediumturquoise="#48D1CC",t.mediumvioletred="#C71585",t.midnightblue="#191970",t.mintcream="#F5FFFA",t.mistyrose="#FFE4E1",t.moccasin="#FFE4B5",t.navajowhite="#FFDEAD",t.oldlace="#FDF5E6",t.olivedrab="#6B8E23",t.orangered="#FF4500",t.orchid="#DA70D6",t.palegoldenrod="#EEE8AA",t.palegreen="#98FB98",t.paleturquoise="#AFEEEE",t.palevioletred="#DB7093",t.papayawhip="#FFEFD5",t.peachpuff="#FFDAB9",t.peru="#CD853F",t.pink="#FFC0CB",t.plum="#DDA0DD",t.powderblue="#B0E0E6",t.rosybrown="#BC8F8F",t.royalblue="#4169E1",t.saddlebrown="#8B4513",t.salmon="#FA8072",t.sandybrown="#F4A460",t.seagreen="#2E8B57",t.seashell="#FFF5EE",t.sienna="#A0522D",t.skyblue="#87CEEB",t.slateblue="#6A5ACD",t.slategray="#708090",t.slategrey="#708090",t.snow="#FFFAFA",t.springgreen="#00FF7F",t.steelblue="#4682B4",t.tan="#D2B48C",t.thistle="#D8BFD8",t.tomato="#FF6347",t.turquoise="#40E0D0",t.violet="#EE82EE",t.wheat="#F5DEB3",t.whitesmoke="#F5F5F5",t.yellowgreen="#9ACD32",t.rebeccapurple="#663399"}(n||(n={}));var a,u,s,c,d,l,f,h=Object.keys(n),p=((a={})[t.HEX]=/^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i,a[t.RGB]=/^rgb\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*\)$/,a[t.RGBA]=/^rgba\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*,\s*(\d\.?\d*)\s*\)$/,a[t.HSL]=/^hsl\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%s*\)$/,a[t.HSLA]=/^hsla\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*,\s*(\d\.?\d*)\s*\)$/,a[t.CMYK]=/^(?:device-cmyk|cmyk)\s*\(\s*(?:(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)|(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*))\s*\)$/,a),g=/^(\d+(?:\.\d+)?|\.\d+)%$/,b=/^0x([a-f\d]{1,2})$/i,F="The provided string color doesn't have a correct format",y="The provided color object doesn't have the proper keys or format",m=function(t,e,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?Math.round(255*((e-t)*r+t)):r<3?Math.round(255*e):r<4?Math.round(255*((e-t)*(4-r)+t)):Math.round(255*t)},A=function(t,e,r){e/=100;var n=(r/=100)<=.5?r*(e+1):r+e-r*e,i=2*r-n;return{r:m(i,n,(t/=60)+2),g:m(i,n,t),b:m(i,n,t-2)}},H=function(t,e,r,n){return n=1-n,{r:Math.round(255*(1-t)*n),g:Math.round(255*(1-e)*n),b:Math.round(255*(1-r)*n)}},E=function(t,e,r){t/=255,e/=255,r/=255;var n=1-Math.max(t,e,r),i=1-n,o=(i-t)/i,a=(i-e)/i,u=(i-r)/i;return{c:Math.round(100*o),m:Math.round(100*a),y:Math.round(100*u),k:Math.round(100*n)}},B=function(t,e,r,n){void 0===n&&(n=1),t/=255,e/=255,r/=255,n=Math.min(n,1);var i=Math.max(t,e,r),o=Math.min(t,e,r),a=i-o,u=0,s=0,c=(i+o)/2;if(0===a)u=0,s=0;else{switch(i){case t:u=(e-r)/a%6;break;case e:u=(r-t)/a+2;break;case r:u=(t-e)/a+4}(u=Math.round(60*u))<0&&(u+=360),s=a/(1-Math.abs(2*c-1))}return{h:u,s:Math.round(100*s),l:Math.round(100*c),a:n}},v=function(t,e){if(t<0&&(t+=360),t>360&&(t-=360),360===t||0===t)return t;var r=[[0,120],[120,180],[180,240],[240,360]],n=[[0,60],[60,120],[120,240],[240,360]],i=e?n:r,o=0,a=0,u=0,s=0;return(e?r:n).find((function(e,r){return t>=e[0]&&t<e[1]&&(o=e[0],a=e[1],u=i[r][0],s=i[r][1],!0)})),u+(s-u)/(a-o)*(t-o)},M=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},R=function(t){return g.test(""+t)?+(""+t).replace(g,"$1"):Math.min(+t,100)},S=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},C=function(t){var e=parseInt(""+t).toString(16).toUpperCase();return 1===e.length?"0x0"+e:"0x"+e},L=function(t){var e=parseInt(""+t).toString(16).toUpperCase();return 1===e.length&&(e="0"+e),e},D=function(t,e){return void 0===e&&(e=!1),!e&&g.test(t)?Math.min(255*+t.replace(g,"$1")/100,255):b.test(t)?3===t.length?e?parseInt(t+t.slice(-1))/255:parseInt(t+t.slice(-1)):e?parseInt(t)/255:parseInt(t):Math.min(+t,e?1:255)},G=function(t){return Math.min(g.test(t)?+t.replace(g,"$1")/100:+t,1)},x=function(t){return t.sort().join().toUpperCase()},k=function(t,e){void 0===e&&(e=0);var r=Math.pow(10,e);return Math.round(+t*r)/r},O=function(t,e,r){return Math.max(e,Math.min(t,r))},X=((u={})[t.HEX]=function(t){return"#"+L(t.r)+L(t.g)+L(t.b)+(M(t,"a")&&L(t.a)||"")},u[t.RGB]=function(t){return"rgb"+(M(t,"a")?"a":"")+"("+k(t.r)+","+k(t.g)+","+k(t.b)+(M(t,"a")&&","+k(t.a,2)||"")+")"},u[t.HSL]=function(t){return"hsl"+(M(t,"a")?"a":"")+"("+k(t.h)+","+k(t.s)+"%,"+k(t.l)+"%"+(M(t,"a")&&","+k(t.a,2)||"")+")"},u[t.CMYK]=function(t){return"cmyk("+k(t.c)+"%,"+k(t.m)+"%,"+k(t.y)+"%,"+k(t.k)+"%)"},u),j=function(t){return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},I=function(t){return isNaN(+t)||t>1?1:k(t,2)},T=function(t,e,r){return e.reduce((function(e,n){return o(o([],e,!0),[i(i({},t),{h:r===exports.Mix.ADDITIVE?j(t.h+n):j(v(v(t.h,!1)+n,!0))})],!1)}),[i({},t)])},Y=function(t,e){return T(t,[30,-30],e)},P=function(t,e){return T(t,[180],e)},w=function(t,e){return T(t,[150,-150],e)},K=function(t,e){return T(t,[120,-120],e)},N=function(t,e){return T(t,[60,-120,180],e)},V=function(t,e){return T(t,[90,-90,180],e)},U=function(e){return"string"==typeof e?function(e){var r;if(Object.keys(t).some((function(t){if(p[t].test(e))return r=t,!0})),!r&&~h.indexOf(e)&&(r=t.HEX),!r)throw new Error(F);return r}(e):function(e){var r,n=!1,i=x(Object.keys(e));if(Object.keys(t).filter((function(e){return e!==t.HEX})).some((function(t){if(x(t.split(""))===i)return r=t,!0})),r&&r===t.RGB||r===t.RGBA){var o=Object.entries(e).map((function(t){return b.test(""+t[1])})),a=Object.entries(e).map((function(t){return g.test(""+t[1])||!b.test(""+t[1])&&!isNaN(+t[1])&&+t[1]<=255})),u=o.some((function(t,e){return e>0&&t!==o[e-1]})),s=a.some((function(t,e){return e>0&&t!==a[e-1]}));!(n=u||s||!o[0]&&!a[0])&&o[0]&&(r=t.HEX)}if(!r||n)throw new Error(y);return r}(e)},$=((s={})[t.HEX]=function(t){var e=(~h.indexOf(t)?n[t]:t).match(p.HEX),r={r:S(e[1]||e[5]),g:S(e[2]||e[6]),b:S(e[3]||e[7])},i=e[4]||e[8];return void 0!==i&&(r.a=S(i)/255),r},s[t.RGB]=function(t){var e=t.match(p.RGB),r=D(e[1]||e[4]),n=D(e[2]||e[5]),i=D(e[3]||e[6]);return{r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255)}},s[t.RGBA]=function(t){var e=t.match(p.RGBA),r=D(e[1]||e[4]),n=D(e[2]||e[5]),i=D(e[3]||e[6]),o=+e[7];return{r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255),a:I(o)}},s[t.HSL]=function(t){var e=t.match(p.HSL),r=j(+e[1]),n=R(e[2]),i=R(e[3]);return A(r,n,i)},s[t.HSLA]=function(t){var e=t.match(p.HSLA),r=j(+e[1]),n=R(e[2]),i=R(e[3]),o=+e[4],a=A(r,n,i);return a.a=I(o),a},s[t.CMYK]=function(t){var e=t.match(p.CMYK),r=G(e[1]||e[5]),n=G(e[2]||e[6]),i=G(e[3]||e[7]),o=G(e[4]||e[8]);return H(r,n,i,o)},s),q=((c={})[t.HEX]=function(t){var e={r:D(""+t.r),g:D(""+t.g),b:D(""+t.b)};return e.a=M(t,"a")?Math.min(D(""+t.a,!0),1):1,e},c[t.RGB]=function(t){var e=this.HEX(t);return delete e.a,e},c[t.RGBA]=function(t){return this.HEX(t)},c[t.HSL]=function(t){var e=R(""+t.s),r=R(""+t.l);return A(j(t.h),e,r)},c[t.HSLA]=function(t){var e=this.HSL(t);return e.a=I(t.a),e},c[t.CMYK]=function(t){var e=G(""+t.c),r=G(""+t.m),n=G(""+t.y),i=G(""+t.k);return H(e,r,n,i)},c),_=function(t,e){return void 0===e&&(e=U(t)),"string"==typeof t?$[e](t):q[e](t)},Q=((d={})[t.HEX]=function(t){return{r:C(t.r),g:C(t.g),b:C(t.b)}},d.HEXA=function(t){var e=Q.HEX(t);return e.a=M(t,"a")?C(255*t.a):"0xFF",e},d[t.RGB]=function(t){return M(t,"a")&&delete t.a,t},d[t.RGBA]=function(t){return t.a=M(t,"a")?k(t.a,2):1,t},d[t.HSL]=function(t){var e=B(t.r,t.g,t.b);return delete e.a,e},d[t.HSLA]=function(t){var e=Q.HSL(t);return e.a=M(t,"a")?k(t.a,2):1,e},d[t.CMYK]=function(t){return E(t.r,t.g,t.b)},d),z=function(e,r,n){var o=U(e),a="string"==typeof e,u=_(e,o),s="string"==typeof e&&M(u,"a")||"string"!=typeof e&&M(e,"a"),c=B(u.r,u.g,u.b,u.a);s||delete c.a;var d=n?c.l/(r+1):(100-c.l)/(r+1),l=Array(r).fill(null).map((function(t,e){return i(i({},c),{l:c.l+d*(e+1)*(1-2*+n)})}));switch(o){case t.HEX:default:return l.map((function(t){var e=A(t.h,t.s,t.l);return s&&(e.a=t.a),a?s?X.HEX(i(i({},e),{a:k(255*e.a,2)})):X.HEX(e):s?Q.HEXA(e):Q.HEX(e)}));case t.RGB:case t.RGBA:return l.map((function(t){var e=A(t.h,t.s,t.l);return s&&(e.a=t.a),a?X.RGB(e):s?Q.RGBA(e):Q.RGB(e)}));case t.HSL:case t.HSLA:return l.map((function(t){return a?X.HSL(t):s?Q.HSLA(i(i({},A(t.h,t.s,t.l)),{a:t.a})):Q.HSL(A(t.h,t.s,t.l))}))}},J=((l={buildHarmony:function(e,r,n){var i=U(e),o=_(e,i),a=B(o.r,o.g,o.b,o.a),u="string"==typeof e&&M(o,"a")||"string"!=typeof e&&M(e,"a"),s="string"==typeof e;switch(i){case t.HEX:default:return u?this.HEXA(a,r,n,s):this.HEX(a,r,n,s);case t.HSL:return this.HSL(a,r,n,s);case t.HSLA:return this.HSLA(a,r,n,s);case t.RGB:return this.RGB(a,r,n,s);case t.RGBA:return this.RGBA(a,r,n,s)}}})[t.HEX]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.HEX(A(t.h,t.s,t.l)):Q.HEX(A(t.h,t.s,t.l))}))},l.HEXA=function(t,e,r,n){return e(t,r).map((function(t){return n?X.HEX(i(i({},A(t.h,t.s,t.l)),{a:255*I(t.a)})):Q.HEXA(i(i({},A(t.h,t.s,t.l)),{a:I(t.a)}))}))},l[t.RGB]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.RGB(A(t.h,t.s,t.l)):Q.RGB(A(t.h,t.s,t.l))}))},l[t.RGBA]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.RGB(i(i({},A(t.h,t.s,t.l)),{a:I(t.a)})):Q.RGBA(i(i({},A(t.h,t.s,t.l)),{a:I(t.a)}))}))},l[t.HSL]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.HSL({h:t.h,s:t.s,l:t.l}):Q.HSL(A(t.h,t.s,t.l))}))},l[t.HSLA]=function(t,e,r,n){return e(t,r).map((function(t){return n?X.HSL(i(i({},t),{a:I(t.a)})):Q.HSLA(i(i({},A(t.h,t.s,t.l)),{a:I(t.a)}))}))},l),W=((f={mix:function(t,e){var r,n,o,a,u,s,c,d,l,f,h,p,g,b,F,y=t.map((function(t){var e=U(t);return _(t,e)})),m=e===exports.Mix.SUBTRACTIVE?y.map((function(t){var e,r,n,i,o,a,u,s,c,d,l,f,h,p,g=(e=t.r,r=t.g,n=t.b,i=Math.min(e,r,n),o=Math.min(255-e,255-r,255-n),a=e-i,u=r-i,s=n-i,c=Math.min(a,u),d=a-c,l=(u+c)/2,f=(s+u-c)/2,h=Math.max(d,l,f)/Math.max(a,u,s),p=isNaN(h)||h===1/0||h<=0?1:h,{r:d/p+o,y:l/p+o,b:f/p+o});return M(t,"a")&&(g.a=t.a),g})):null;function A(t){var r=e===exports.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return t.reduce((function(t,r){var n=M(r,"a")?r.a:1,o={r:Math.min(t.r+r.r*n,255),b:Math.min(t.b+r.b*n,255),a:1-(1-n)*(1-t.a)},a="g"in t?t.g:t.y,u="g"in r?r.g:r.y;return i(i({},o),e===exports.Mix.ADDITIVE?{g:Math.min(a+u*n,255)}:{y:Math.min(a+u*n,255)})}),r)}if(e===exports.Mix.ADDITIVE)r=A(y);else{var H=A(m);n=H.r,o=H.y,a=H.b,u=Math.min(n,o,a),s=Math.min(255-n,255-o,255-a),c=n-u,d=o-u,l=a-u,f=Math.min(d,l),h=c+d-f,p=d+2*f,g=2*(l-f),b=Math.max(h,p,g)/Math.max(c,d,l),F=isNaN(b)||b===1/0||b<=0?1:b,(r={r:h/F+s,g:p/F+s,b:g/F+s}).a=H.a}return{r:k(r.r,2),g:k(r.g,2),b:k(r.b,2),a:O(r.a,0,1)}}})[t.HEX]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?X.HEX(n):Q.HEX(n)},f.HEXA=function(t,e,r){var n=this.mix(t,e);return n.a=r?255*I(n.a):I(n.a),r?X.HEX(n):Q.HEXA(n)},f[t.RGB]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?X.RGB(n):Q.RGB(n)},f[t.RGBA]=function(t,e,r){var n=this.mix(t,e);return r?X.RGB(n):Q.RGBA(n)},f[t.HSL]=function(t,e,r){var n=this.mix(t,e),i=B(n.r,n.g,n.b);return delete n.a,delete i.a,r?X.HSL(i):Q.HSL(n)},f[t.HSLA]=function(t,e,r){var n=this.mix(t,e),i=B(n.r,n.g,n.b,n.a);return r?X.HSL(i):Q.HSLA(n)},f),Z=function(t,e){return"string"==typeof t&&e||"object"==typeof t&&!e},tt=function(t,e,r,n,i){var o=n(_(t,e));return r?i(o):o},et=function(t,e,r,n,i,o){r<1&&(r=5);var a=function(t,e,r){var n=r-1,i=(e.r-t.r)/n,o=(e.g-t.g)/n,a=(e.b-t.b)/n,u=I(t.a),s=(I(e.a)-u)/n;return Array(r).fill(null).map((function(r,c){return 0===c?t:c===n?e:{r:k(t.r+i*c),g:k(t.g+o*c),b:k(t.b+a*c),a:k(u+s*c,2)}}))}(_(t),_(e),r);return a.map((function(t){var e=i(t);return n?o(e):e}))},rt=function(){function e(t){this.rgb=_(t),this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=i(i({},A(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=i(i({},H(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=B(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=E(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setH=function(t){return this.hsl.h=j(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=O(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=O(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=O(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=O(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=O(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=O(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=O(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=O(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=O(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=O(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"H",{get:function(){return k(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return k(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return k(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return k(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return k(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return k(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return k(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return k(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return k(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return k(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return k(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return Q.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return Q.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return i(i({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return i(i({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b};return X.HEX(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b,a:255*this.A};return X.HEX(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b};return X.RGB(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b,a:this.A};return X.RGB(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){var t=this.hsl,e={h:t.h,s:t.s,l:t.l};return X.HSL(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return X.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return X.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),e.toHEX=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,Q.HEX,X.HEX)},e.toHEXA=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,Q.HEXA,X.HEX)},e.toRGB=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,Q.RGB,X.RGB)},e.toRGBA=function(t,e){void 0===e&&(e=!0);var r=U(t);return tt(t,r,e,Q.RGBA,X.RGB)},e.toHSL=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.HSL&&Z(e,r)?e:tt(e,n,r,Q.HSL,X.HSL)},e.toHSLA=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.HSLA&&Z(e,r)?e:tt(e,n,r,Q.HSLA,X.HSL)},e.toCMYK=function(e,r){void 0===r&&(r=!0);var n=U(e);return n===t.CMYK&&Z(e,r)?e:tt(e,n,r,Q.CMYK,X.CMYK)},e.getBlendHEX=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.HEX,X.HEX)},e.getBlendHEXA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.HEXA,X.HEX)},e.getBlendRGB=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.RGB,X.RGB)},e.getBlendRGBA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.RGBA,X.RGB)},e.getBlendHSL=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.HSL,X.HSL)},e.getBlendHSLA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),et(t,e,r,n,Q.HSLA,X.HSL)},e.getMixHEX=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.HEX(t,e,r)},e.getMixHEXA=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.HEXA(t,e,r)},e.getMixRGB=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.RGB(t,e,r)},e.getMixRGBA=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.RGBA(t,e,r)},e.getMixHSL=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.HSL(t,e,r)},e.getMixHSLA=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),W.HSLA(t,e,r)},e.getShades=function(t,e){return z(t,e,!0)},e.getTints=function(t,e){return z(t,e,!1)},e.getHarmony=function(t,e,r){switch(void 0===e&&(e=exports.Harmony.COMPLEMENTARY),void 0===r&&(r=exports.Mix.ADDITIVE),e){case exports.Harmony.ANALOGOUS:return J.buildHarmony(t,Y,r);case exports.Harmony.SPLIT_COMPLEMENTARY:return J.buildHarmony(t,w,r);case exports.Harmony.TRIADIC:return J.buildHarmony(t,K,r);case exports.Harmony.TETRADIC:return J.buildHarmony(t,N,r);case exports.Harmony.SQUARE:return J.buildHarmony(t,V,r);default:return J.buildHarmony(t,P,r)}},e}();exports.ColorTranslator=rt; |
@@ -1,15 +0,1 @@ | ||
var colortranslator=function(t){"use strict"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var r,e,n,i,o=function(){return o=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t},o.apply(this,arguments)};function a(t,r,e){if(e||2===arguments.length)for(var n,i=0,o=r.length;i<o;i++)!n&&i in r||(n||(n=Array.prototype.slice.call(r,0,i)),n[i]=r[i]);return t.concat(n||Array.prototype.slice.call(r))}!function(t){t.HEX="HEX",t.RGB="RGB",t.RGBA="RGBA",t.HSL="HSL",t.HSLA="HSLA",t.CMYK="CMYK"}(r||(r={})),t.Harmony=void 0,(e=t.Harmony||(t.Harmony={})).ANALOGOUS="ANALOGOUS",e.COMPLEMENTARY="COMPLEMENTARY",e.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",e.TRIADIC="TRIADIC",e.TETRADIC="TETRADIC",e.SQUARE="SQUARE",t.Mix=void 0,(n=t.Mix||(t.Mix={})).ADDITIVE="ADDITIVE",n.SUBTRACTIVE="SUBTRACTIVE",function(t){t.black="#000000",t.silver="#C0C0C0",t.gray="#808080",t.white="#FFFFFF",t.maroon="#800000",t.red="#FF0000",t.purple="#800080",t.fuchsia="#FF00FF",t.green="#008000",t.lime="#00FF00",t.olive="#808000",t.yellow="#FFFF00",t.navy="#000080",t.blue="#0000FF",t.teal="#008080",t.aqua="#00FFFF",t.orange="#FFA500",t.aliceblue="#F0F8FF",t.antiquewhite="#FAEBD7",t.aquamarine="#7FFFD4",t.azure="#F0FFFF",t.beige="#F5F5DC",t.bisque="#FFE4C4",t.blanchedalmond="#FFEBCD",t.blueviolet="#8A2BE2",t.brown="#A52A2A",t.burlywood="#DEB887",t.cadetblue="#5F9EA0",t.chartreuse="#7FFF00",t.chocolate="#D2691E",t.coral="#FF7F50",t.cornflowerblue="#6495ED",t.cornsilk="#FFF8DC",t.crimson="#DC143C",t.cyan="#00FFFF",t.darkblue="#00008B",t.darkcyan="#008B8B",t.darkgoldenrod="#B8860B",t.darkgray="#A9A9A9",t.darkgreen="#006400",t.darkgrey="#A9A9A9",t.darkkhaki="#BDB76B",t.darkmagenta="#8B008B",t.darkolivegreen="#556B2F",t.darkorange="#FF8C00",t.darkorchid="#9932CC",t.darkred="#8B0000",t.darksalmon="#E9967A",t.darkseagreen="#8FBC8F",t.darkslateblue="#483D8B",t.darkslategray="#2F4F4F",t.darkslategrey="#2F4F4F",t.darkturquoise="#00CED1",t.darkviolet="#9400D3",t.deeppink="#FF1493",t.deepskyblue="#00BFFF",t.dimgray="#696969",t.dimgrey="#696969",t.dodgerblue="#1E90FF",t.firebrick="#B22222",t.floralwhite="#FFFAF0",t.forestgreen="#228B22",t.gainsboro="#DCDCDC",t.ghostwhite="#F8F8FF",t.gold="#FFD700",t.goldenrod="#DAA520",t.greenyellow="#ADFF2F",t.grey="#808080",t.honeydew="#F0FFF0",t.hotpink="#FF69B4",t.indianred="#CD5C5C",t.indigo="#4B0082",t.ivory="#FFFFF0",t.khaki="#F0E68C",t.lavender="#E6E6FA",t.lavenderblush="#FFF0F5",t.lawngreen="#7CFC00",t.lemonchiffon="#FFFACD",t.lightblue="#ADD8E6",t.lightcoral="#F08080",t.lightcyan="#E0FFFF",t.lightgoldenrodyellow="#FAFAD2",t.lightgray="#D3D3D3",t.lightgreen="#90EE90",t.lightgrey="#D3D3D3",t.lightpink="#FFB6C1",t.lightsalmon="#FFA07A",t.lightseagreen="#20B2AA",t.lightskyblue="#87CEFA",t.lightslategray="#778899",t.lightslategrey="#778899",t.lightsteelblue="#B0C4DE",t.lightyellow="#FFFFE0",t.limegreen="#32CD32",t.linen="#FAF0E6",t.magenta="#FF00FF",t.mediumaquamarine="#66CDAA",t.mediumblue="#0000CD",t.mediumorchid="#BA55D3",t.mediumpurple="#9370DB",t.mediumseagreen="#3CB371",t.mediumslateblue="#7B68EE",t.mediumspringgreen="#00FA9A",t.mediumturquoise="#48D1CC",t.mediumvioletred="#C71585",t.midnightblue="#191970",t.mintcream="#F5FFFA",t.mistyrose="#FFE4E1",t.moccasin="#FFE4B5",t.navajowhite="#FFDEAD",t.oldlace="#FDF5E6",t.olivedrab="#6B8E23",t.orangered="#FF4500",t.orchid="#DA70D6",t.palegoldenrod="#EEE8AA",t.palegreen="#98FB98",t.paleturquoise="#AFEEEE",t.palevioletred="#DB7093",t.papayawhip="#FFEFD5",t.peachpuff="#FFDAB9",t.peru="#CD853F",t.pink="#FFC0CB",t.plum="#DDA0DD",t.powderblue="#B0E0E6",t.rosybrown="#BC8F8F",t.royalblue="#4169E1",t.saddlebrown="#8B4513",t.salmon="#FA8072",t.sandybrown="#F4A460",t.seagreen="#2E8B57",t.seashell="#FFF5EE",t.sienna="#A0522D",t.skyblue="#87CEEB",t.slateblue="#6A5ACD",t.slategray="#708090",t.slategrey="#708090",t.snow="#FFFAFA",t.springgreen="#00FF7F",t.steelblue="#4682B4",t.tan="#D2B48C",t.thistle="#D8BFD8",t.tomato="#FF6347",t.turquoise="#40E0D0",t.violet="#EE82EE",t.wheat="#F5DEB3",t.whitesmoke="#F5F5F5",t.yellowgreen="#9ACD32",t.rebeccapurple="#663399"}(i||(i={}));var u,s,c,d,l,f,h,p=Object.keys(i),g=((u={})[r.HEX]=/^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i,u[r.RGB]=/^rgb\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*\)$/,u[r.RGBA]=/^rgba\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*,\s*(\d\.?\d*)\s*\)$/,u[r.HSL]=/^hsl\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%s*\)$/,u[r.HSLA]=/^hsla\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*,\s*(\d\.?\d*)\s*\)$/,u[r.CMYK]=/^(?:device-cmyk|cmyk)\s*\(\s*(?:(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)|(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*))\s*\)$/,u),b=/^(\d+(?:\.\d+)?|\.\d+)%$/,F=/^0x([a-f\d]{1,2})$/i,y="The provided string color doesn't have a correct format",m="The provided color object doesn't have the proper keys or format",A=function(t,r,e){return e<0&&(e+=6),e>=6&&(e-=6),e<1?Math.round(255*((r-t)*e+t)):e<3?Math.round(255*r):e<4?Math.round(255*((r-t)*(4-e)+t)):Math.round(255*t)},H=function(t,r,e){r/=100;var n=(e/=100)<=.5?e*(r+1):e+r-e*r,i=2*e-n;return{r:A(i,n,(t/=60)+2),g:A(i,n,t),b:A(i,n,t-2)}},E=function(t,r,e,n){return n=1-n,{r:Math.round(255*(1-t)*n),g:Math.round(255*(1-r)*n),b:Math.round(255*(1-e)*n)}},B=function(t,r,e){t/=255,r/=255,e/=255;var n=1-Math.max(t,r,e),i=1-n,o=(i-t)/i,a=(i-r)/i,u=(i-e)/i;return{c:Math.round(100*o),m:Math.round(100*a),y:Math.round(100*u),k:Math.round(100*n)}},v=function(t,r,e,n){void 0===n&&(n=1),t/=255,r/=255,e/=255,n=Math.min(n,1);var i=Math.max(t,r,e),o=Math.min(t,r,e),a=i-o,u=0,s=0,c=(i+o)/2;if(0===a)u=0,s=0;else{switch(i){case t:u=(r-e)/a%6;break;case r:u=(e-t)/a+2;break;case e:u=(t-r)/a+4}(u=Math.round(60*u))<0&&(u+=360),s=a/(1-Math.abs(2*c-1))}return{h:u,s:Math.round(100*s),l:Math.round(100*c),a:n}},M=function(t,r){if(t<0&&(t+=360),t>360&&(t-=360),360===t||0===t)return t;var e=[[0,120],[120,180],[180,240],[240,360]],n=[[0,60],[60,120],[120,240],[240,360]],i=r?n:e,o=0,a=0,u=0,s=0;return(r?e:n).find((function(r,e){return t>=r[0]&&t<r[1]&&(o=r[0],a=r[1],u=i[e][0],s=i[e][1],!0)})),u+(s-u)/(a-o)*(t-o)},R=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},S=function(t){return b.test(""+t)?+(""+t).replace(b,"$1"):Math.min(+t,100)},C=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},L=function(t){var r=parseInt(""+t).toString(16).toUpperCase();return 1===r.length?"0x0"+r:"0x"+r},D=function(t){var r=parseInt(""+t).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),r},G=function(t,r){return void 0===r&&(r=!1),!r&&b.test(t)?Math.min(255*+t.replace(b,"$1")/100,255):F.test(t)?3===t.length?r?parseInt(t+t.slice(-1))/255:parseInt(t+t.slice(-1)):r?parseInt(t)/255:parseInt(t):Math.min(+t,r?1:255)},k=function(t){return Math.min(b.test(t)?+t.replace(b,"$1")/100:+t,1)},O=function(t){return t.sort().join().toUpperCase()},X=function(t,r){void 0===r&&(r=0);var e=Math.pow(10,r);return Math.round(+t*e)/e},j=function(t,r,e){return Math.max(r,Math.min(t,e))},I=((s={})[r.HEX]=function(t){return"#"+D(t.r)+D(t.g)+D(t.b)+(R(t,"a")&&D(t.a)||"")},s[r.RGB]=function(t){return"rgb"+(R(t,"a")?"a":"")+"("+X(t.r)+","+X(t.g)+","+X(t.b)+(R(t,"a")&&","+X(t.a,2)||"")+")"},s[r.HSL]=function(t){return"hsl"+(R(t,"a")?"a":"")+"("+X(t.h)+","+X(t.s)+"%,"+X(t.l)+"%"+(R(t,"a")&&","+X(t.a,2)||"")+")"},s[r.CMYK]=function(t){return"cmyk("+X(t.c)+"%,"+X(t.m)+"%,"+X(t.y)+"%,"+X(t.k)+"%)"},s),x=function(t){return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},T=function(t){return isNaN(+t)||t>1?1:X(t,2)},Y=function(r,e,n){return e.reduce((function(e,i){return a(a([],e,!0),[o(o({},r),{h:n===t.Mix.ADDITIVE?x(r.h+i):x(M(M(r.h,!1)+i,!0))})],!1)}),[o({},r)])},P=function(t,r){return Y(t,[30,-30],r)},w=function(t,r){return Y(t,[180],r)},K=function(t,r){return Y(t,[150,-150],r)},N=function(t,r){return Y(t,[120,-120],r)},V=function(t,r){return Y(t,[60,-120,180],r)},U=function(t,r){return Y(t,[90,-90,180],r)},$=function(t){return"string"==typeof t?function(t){var e;if(Object.keys(r).some((function(r){if(g[r].test(t))return e=r,!0})),!e&&~p.indexOf(t)&&(e=r.HEX),!e)throw new Error(y);return e}(t):function(t){var e,n=!1,i=O(Object.keys(t));if(Object.keys(r).filter((function(t){return t!==r.HEX})).some((function(t){if(O(t.split(""))===i)return e=t,!0})),e&&e===r.RGB||e===r.RGBA){var o=Object.entries(t).map((function(t){return F.test(""+t[1])})),a=Object.entries(t).map((function(t){return b.test(""+t[1])||!F.test(""+t[1])&&!isNaN(+t[1])&&+t[1]<=255})),u=o.some((function(t,r){return r>0&&t!==o[r-1]})),s=a.some((function(t,r){return r>0&&t!==a[r-1]}));!(n=u||s||!o[0]&&!a[0])&&o[0]&&(e=r.HEX)}if(!e||n)throw new Error(m);return e}(t)},q=((c={})[r.HEX]=function(t){var r=(~p.indexOf(t)?i[t]:t).match(g.HEX),e={r:C(r[1]||r[5]),g:C(r[2]||r[6]),b:C(r[3]||r[7])},n=r[4]||r[8];return void 0!==n&&(e.a=C(n)/255),e},c[r.RGB]=function(t){var r=t.match(g.RGB),e=G(r[1]||r[4]),n=G(r[2]||r[5]),i=G(r[3]||r[6]);return{r:Math.min(e,255),g:Math.min(n,255),b:Math.min(i,255)}},c[r.RGBA]=function(t){var r=t.match(g.RGBA),e=G(r[1]||r[4]),n=G(r[2]||r[5]),i=G(r[3]||r[6]),o=+r[7];return{r:Math.min(e,255),g:Math.min(n,255),b:Math.min(i,255),a:T(o)}},c[r.HSL]=function(t){var r=t.match(g.HSL),e=x(+r[1]),n=S(r[2]),i=S(r[3]);return H(e,n,i)},c[r.HSLA]=function(t){var r=t.match(g.HSLA),e=x(+r[1]),n=S(r[2]),i=S(r[3]),o=+r[4],a=H(e,n,i);return a.a=T(o),a},c[r.CMYK]=function(t){var r=t.match(g.CMYK),e=k(r[1]||r[5]),n=k(r[2]||r[6]),i=k(r[3]||r[7]),o=k(r[4]||r[8]);return E(e,n,i,o)},c),_=((d={})[r.HEX]=function(t){var r={r:G(""+t.r),g:G(""+t.g),b:G(""+t.b)};return r.a=R(t,"a")?Math.min(G(""+t.a,!0),1):1,r},d[r.RGB]=function(t){var r=this.HEX(t);return delete r.a,r},d[r.RGBA]=function(t){return this.HEX(t)},d[r.HSL]=function(t){var r=S(""+t.s),e=S(""+t.l);return H(x(t.h),r,e)},d[r.HSLA]=function(t){var r=this.HSL(t);return r.a=T(t.a),r},d[r.CMYK]=function(t){var r=k(""+t.c),e=k(""+t.m),n=k(""+t.y),i=k(""+t.k);return E(r,e,n,i)},d),Q=function(t,r){return void 0===r&&(r=$(t)),"string"==typeof t?q[r](t):_[r](t)},z=((l={})[r.HEX]=function(t){return{r:L(t.r),g:L(t.g),b:L(t.b)}},l.HEXA=function(t){var r=z.HEX(t);return r.a=R(t,"a")?L(255*t.a):"0xFF",r},l[r.RGB]=function(t){return R(t,"a")&&delete t.a,t},l[r.RGBA]=function(t){return t.a=R(t,"a")?X(t.a,2):1,t},l[r.HSL]=function(t){var r=v(t.r,t.g,t.b);return delete r.a,r},l[r.HSLA]=function(t){var r=z.HSL(t);return r.a=R(t,"a")?X(t.a,2):1,r},l[r.CMYK]=function(t){return B(t.r,t.g,t.b)},l),J=function(t,e,n){var i=$(t),a="string"==typeof t,u=Q(t,i),s="string"==typeof t&&R(u,"a")||"string"!=typeof t&&R(t,"a"),c=v(u.r,u.g,u.b,u.a);s||delete c.a;var d=n?c.l/(e+1):(100-c.l)/(e+1),l=Array(e).fill(null).map((function(t,r){return o(o({},c),{l:c.l+d*(r+1)*(1-2*+n)})}));switch(i){case r.HEX:default:return l.map((function(t){var r=H(t.h,t.s,t.l);return s&&(r.a=t.a),a?s?I.HEX(o(o({},r),{a:X(255*r.a,2)})):I.HEX(r):s?z.HEXA(r):z.HEX(r)}));case r.RGB:case r.RGBA:return l.map((function(t){var r=H(t.h,t.s,t.l);return s&&(r.a=t.a),a?I.RGB(r):s?z.RGBA(r):z.RGB(r)}));case r.HSL:case r.HSLA:return l.map((function(t){return a?I.HSL(t):s?z.HSLA(o(o({},H(t.h,t.s,t.l)),{a:t.a})):z.HSL(H(t.h,t.s,t.l))}))}},W=((f={buildHarmony:function(t,e,n){var i=$(t),o=Q(t,i),a=v(o.r,o.g,o.b,o.a),u="string"==typeof t&&R(o,"a")||"string"!=typeof t&&R(t,"a"),s="string"==typeof t;switch(i){case r.HEX:default:return u?this.HEXA(a,e,n,s):this.HEX(a,e,n,s);case r.HSL:return this.HSL(a,e,n,s);case r.HSLA:return this.HSLA(a,e,n,s);case r.RGB:return this.RGB(a,e,n,s);case r.RGBA:return this.RGBA(a,e,n,s)}}})[r.HEX]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.HEX(H(t.h,t.s,t.l)):z.HEX(H(t.h,t.s,t.l))}))},f.HEXA=function(t,r,e,n){return r(t,e).map((function(t){return n?I.HEX(o(o({},H(t.h,t.s,t.l)),{a:255*T(t.a)})):z.HEXA(o(o({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},f[r.RGB]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.RGB(H(t.h,t.s,t.l)):z.RGB(H(t.h,t.s,t.l))}))},f[r.RGBA]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.RGB(o(o({},H(t.h,t.s,t.l)),{a:T(t.a)})):z.RGBA(o(o({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},f[r.HSL]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.HSL({h:t.h,s:t.s,l:t.l}):z.HSL(H(t.h,t.s,t.l))}))},f[r.HSLA]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.HSL(o(o({},t),{a:T(t.a)})):z.HSLA(o(o({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},f),Z=((h={mix:function(r,e){var n,i,a,u,s,c,d,l,f,h,p,g,b,F,y,m=r.map((function(t){var r=$(t);return Q(t,r)})),A=e===t.Mix.SUBTRACTIVE?m.map((function(t){var r,e,n,i,o,a,u,s,c,d,l,f,h,p,g=(r=t.r,e=t.g,n=t.b,i=Math.min(r,e,n),o=Math.min(255-r,255-e,255-n),a=r-i,u=e-i,s=n-i,c=Math.min(a,u),d=a-c,l=(u+c)/2,f=(s+u-c)/2,h=Math.max(d,l,f)/Math.max(a,u,s),p=isNaN(h)||h===1/0||h<=0?1:h,{r:d/p+o,y:l/p+o,b:f/p+o});return R(t,"a")&&(g.a=t.a),g})):null;function H(r){var n=e===t.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return r.reduce((function(r,n){var i=R(n,"a")?n.a:1,a={r:Math.min(r.r+n.r*i,255),b:Math.min(r.b+n.b*i,255),a:1-(1-i)*(1-r.a)},u="g"in r?r.g:r.y,s="g"in n?n.g:n.y;return o(o({},a),e===t.Mix.ADDITIVE?{g:Math.min(u+s*i,255)}:{y:Math.min(u+s*i,255)})}),n)}if(e===t.Mix.ADDITIVE)n=H(m);else{var E=H(A);i=E.r,a=E.y,u=E.b,s=Math.min(i,a,u),c=Math.min(255-i,255-a,255-u),d=i-s,l=a-s,f=u-s,h=Math.min(l,f),p=d+l-h,g=l+2*h,b=2*(f-h),F=Math.max(p,g,b)/Math.max(d,l,f),y=isNaN(F)||F===1/0||F<=0?1:F,(n={r:p/y+c,g:g/y+c,b:b/y+c}).a=E.a}return{r:X(n.r,2),g:X(n.g,2),b:X(n.b,2),a:j(n.a,0,1)}}})[r.HEX]=function(t,r,e){var n=this.mix(t,r);return delete n.a,e?I.HEX(n):z.HEX(n)},h.HEXA=function(t,r,e){var n=this.mix(t,r);return n.a=e?255*T(n.a):T(n.a),e?I.HEX(n):z.HEXA(n)},h[r.RGB]=function(t,r,e){var n=this.mix(t,r);return delete n.a,e?I.RGB(n):z.RGB(n)},h[r.RGBA]=function(t,r,e){var n=this.mix(t,r);return e?I.RGB(n):z.RGBA(n)},h[r.HSL]=function(t,r,e){var n=this.mix(t,r),i=v(n.r,n.g,n.b);return delete n.a,delete i.a,e?I.HSL(i):z.HSL(n)},h[r.HSLA]=function(t,r,e){var n=this.mix(t,r),i=v(n.r,n.g,n.b,n.a);return e?I.HSL(i):z.HSLA(n)},h),tt=function(t,r){return"string"==typeof t&&r||"object"==typeof t&&!r},rt=function(t,r,e,n,i){var o=n(Q(t,r));return e?i(o):o},et=function(t,r,e,n,i,o){e<1&&(e=5);var a=function(t,r,e){var n=e-1,i=(r.r-t.r)/n,o=(r.g-t.g)/n,a=(r.b-t.b)/n,u=T(t.a),s=(T(r.a)-u)/n;return Array(e).fill(null).map((function(e,c){return 0===c?t:c===n?r:{r:X(t.r+i*c),g:X(t.g+o*c),b:X(t.b+a*c),a:X(u+s*c,2)}}))}(Q(t),Q(r),e);return a.map((function(t){var r=i(t);return n?o(r):r}))},nt=function(){function e(t){this.rgb=Q(t),this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=o(o({},H(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=o(o({},E(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=v(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=B(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setH=function(t){return this.hsl.h=x(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=j(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=j(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=j(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=j(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"H",{get:function(){return X(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return X(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return X(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return X(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return X(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return X(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return X(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return X(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return X(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return X(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return X(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return z.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return z.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return o(o({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return o(o({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return I.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:255*this.A};return I.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return I.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:this.A};return I.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){var t=this.hsl,r={h:t.h,s:t.s,l:t.l};return I.HSL(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return I.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return I.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),e.toHEX=function(t,r){void 0===r&&(r=!0);var e=$(t);return rt(t,e,r,z.HEX,I.HEX)},e.toHEXA=function(t,r){void 0===r&&(r=!0);var e=$(t);return rt(t,e,r,z.HEXA,I.HEX)},e.toRGB=function(t,r){void 0===r&&(r=!0);var e=$(t);return rt(t,e,r,z.RGB,I.RGB)},e.toRGBA=function(t,r){void 0===r&&(r=!0);var e=$(t);return rt(t,e,r,z.RGBA,I.RGB)},e.toHSL=function(t,e){void 0===e&&(e=!0);var n=$(t);return n===r.HSL&&tt(t,e)?t:rt(t,n,e,z.HSL,I.HSL)},e.toHSLA=function(t,e){void 0===e&&(e=!0);var n=$(t);return n===r.HSLA&&tt(t,e)?t:rt(t,n,e,z.HSLA,I.HSL)},e.toCMYK=function(t,e){void 0===e&&(e=!0);var n=$(t);return n===r.CMYK&&tt(t,e)?t:rt(t,n,e,z.CMYK,I.CMYK)},e.getBlendHEX=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.HEX,I.HEX)},e.getBlendHEXA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.HEXA,I.HEX)},e.getBlendRGB=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.RGB,I.RGB)},e.getBlendRGBA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.RGBA,I.RGB)},e.getBlendHSL=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.HSL,I.HSL)},e.getBlendHSLA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.HSLA,I.HSL)},e.getMixHEX=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.HEX(r,e,n)},e.getMixHEXA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.HEXA(r,e,n)},e.getMixRGB=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.RGB(r,e,n)},e.getMixRGBA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.RGBA(r,e,n)},e.getMixHSL=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.HSL(r,e,n)},e.getMixHSLA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.HSLA(r,e,n)},e.getShades=function(t,r){return J(t,r,!0)},e.getTints=function(t,r){return J(t,r,!1)},e.getHarmony=function(r,e,n){switch(void 0===e&&(e=t.Harmony.COMPLEMENTARY),void 0===n&&(n=t.Mix.ADDITIVE),e){case t.Harmony.ANALOGOUS:return W.buildHarmony(r,P,n);case t.Harmony.SPLIT_COMPLEMENTARY:return W.buildHarmony(r,K,n);case t.Harmony.TRIADIC:return W.buildHarmony(r,N,n);case t.Harmony.TETRADIC:return W.buildHarmony(r,V,n);case t.Harmony.SQUARE:return W.buildHarmony(r,U,n);default:return W.buildHarmony(r,w,n)}},e}();return t.ColorTranslator=nt,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
var colortranslator=function(t){"use strict";var r,e,n,i,o=function(){return o=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t},o.apply(this,arguments)};function a(t,r,e){if(e||2===arguments.length)for(var n,i=0,o=r.length;i<o;i++)!n&&i in r||(n||(n=Array.prototype.slice.call(r,0,i)),n[i]=r[i]);return t.concat(n||Array.prototype.slice.call(r))}!function(t){t.HEX="HEX",t.RGB="RGB",t.RGBA="RGBA",t.HSL="HSL",t.HSLA="HSLA",t.CMYK="CMYK"}(r||(r={})),t.Harmony=void 0,(e=t.Harmony||(t.Harmony={})).ANALOGOUS="ANALOGOUS",e.COMPLEMENTARY="COMPLEMENTARY",e.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",e.TRIADIC="TRIADIC",e.TETRADIC="TETRADIC",e.SQUARE="SQUARE",t.Mix=void 0,(n=t.Mix||(t.Mix={})).ADDITIVE="ADDITIVE",n.SUBTRACTIVE="SUBTRACTIVE",function(t){t.black="#000000",t.silver="#C0C0C0",t.gray="#808080",t.white="#FFFFFF",t.maroon="#800000",t.red="#FF0000",t.purple="#800080",t.fuchsia="#FF00FF",t.green="#008000",t.lime="#00FF00",t.olive="#808000",t.yellow="#FFFF00",t.navy="#000080",t.blue="#0000FF",t.teal="#008080",t.aqua="#00FFFF",t.orange="#FFA500",t.aliceblue="#F0F8FF",t.antiquewhite="#FAEBD7",t.aquamarine="#7FFFD4",t.azure="#F0FFFF",t.beige="#F5F5DC",t.bisque="#FFE4C4",t.blanchedalmond="#FFEBCD",t.blueviolet="#8A2BE2",t.brown="#A52A2A",t.burlywood="#DEB887",t.cadetblue="#5F9EA0",t.chartreuse="#7FFF00",t.chocolate="#D2691E",t.coral="#FF7F50",t.cornflowerblue="#6495ED",t.cornsilk="#FFF8DC",t.crimson="#DC143C",t.cyan="#00FFFF",t.darkblue="#00008B",t.darkcyan="#008B8B",t.darkgoldenrod="#B8860B",t.darkgray="#A9A9A9",t.darkgreen="#006400",t.darkgrey="#A9A9A9",t.darkkhaki="#BDB76B",t.darkmagenta="#8B008B",t.darkolivegreen="#556B2F",t.darkorange="#FF8C00",t.darkorchid="#9932CC",t.darkred="#8B0000",t.darksalmon="#E9967A",t.darkseagreen="#8FBC8F",t.darkslateblue="#483D8B",t.darkslategray="#2F4F4F",t.darkslategrey="#2F4F4F",t.darkturquoise="#00CED1",t.darkviolet="#9400D3",t.deeppink="#FF1493",t.deepskyblue="#00BFFF",t.dimgray="#696969",t.dimgrey="#696969",t.dodgerblue="#1E90FF",t.firebrick="#B22222",t.floralwhite="#FFFAF0",t.forestgreen="#228B22",t.gainsboro="#DCDCDC",t.ghostwhite="#F8F8FF",t.gold="#FFD700",t.goldenrod="#DAA520",t.greenyellow="#ADFF2F",t.grey="#808080",t.honeydew="#F0FFF0",t.hotpink="#FF69B4",t.indianred="#CD5C5C",t.indigo="#4B0082",t.ivory="#FFFFF0",t.khaki="#F0E68C",t.lavender="#E6E6FA",t.lavenderblush="#FFF0F5",t.lawngreen="#7CFC00",t.lemonchiffon="#FFFACD",t.lightblue="#ADD8E6",t.lightcoral="#F08080",t.lightcyan="#E0FFFF",t.lightgoldenrodyellow="#FAFAD2",t.lightgray="#D3D3D3",t.lightgreen="#90EE90",t.lightgrey="#D3D3D3",t.lightpink="#FFB6C1",t.lightsalmon="#FFA07A",t.lightseagreen="#20B2AA",t.lightskyblue="#87CEFA",t.lightslategray="#778899",t.lightslategrey="#778899",t.lightsteelblue="#B0C4DE",t.lightyellow="#FFFFE0",t.limegreen="#32CD32",t.linen="#FAF0E6",t.magenta="#FF00FF",t.mediumaquamarine="#66CDAA",t.mediumblue="#0000CD",t.mediumorchid="#BA55D3",t.mediumpurple="#9370DB",t.mediumseagreen="#3CB371",t.mediumslateblue="#7B68EE",t.mediumspringgreen="#00FA9A",t.mediumturquoise="#48D1CC",t.mediumvioletred="#C71585",t.midnightblue="#191970",t.mintcream="#F5FFFA",t.mistyrose="#FFE4E1",t.moccasin="#FFE4B5",t.navajowhite="#FFDEAD",t.oldlace="#FDF5E6",t.olivedrab="#6B8E23",t.orangered="#FF4500",t.orchid="#DA70D6",t.palegoldenrod="#EEE8AA",t.palegreen="#98FB98",t.paleturquoise="#AFEEEE",t.palevioletred="#DB7093",t.papayawhip="#FFEFD5",t.peachpuff="#FFDAB9",t.peru="#CD853F",t.pink="#FFC0CB",t.plum="#DDA0DD",t.powderblue="#B0E0E6",t.rosybrown="#BC8F8F",t.royalblue="#4169E1",t.saddlebrown="#8B4513",t.salmon="#FA8072",t.sandybrown="#F4A460",t.seagreen="#2E8B57",t.seashell="#FFF5EE",t.sienna="#A0522D",t.skyblue="#87CEEB",t.slateblue="#6A5ACD",t.slategray="#708090",t.slategrey="#708090",t.snow="#FFFAFA",t.springgreen="#00FF7F",t.steelblue="#4682B4",t.tan="#D2B48C",t.thistle="#D8BFD8",t.tomato="#FF6347",t.turquoise="#40E0D0",t.violet="#EE82EE",t.wheat="#F5DEB3",t.whitesmoke="#F5F5F5",t.yellowgreen="#9ACD32",t.rebeccapurple="#663399"}(i||(i={}));var u,s,c,d,l,f,h,p=Object.keys(i),g=((u={})[r.HEX]=/^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i,u[r.RGB]=/^rgb\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*\)$/,u[r.RGBA]=/^rgba\s*\(\s*(?:(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)|(\d+)\s*,\s*(\d+)\s*,\s*(\d+))\s*,\s*(\d\.?\d*)\s*\)$/,u[r.HSL]=/^hsl\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%s*\)$/,u[r.HSLA]=/^hsla\s*\(\s*(-?\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*,\s*(\d\.?\d*)\s*\)$/,u[r.CMYK]=/^(?:device-cmyk|cmyk)\s*\(\s*(?:(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)\s*,\s*(\d+\.?\d*%)|(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*)\s*,\s*(\d\.?\d*))\s*\)$/,u),b=/^(\d+(?:\.\d+)?|\.\d+)%$/,F=/^0x([a-f\d]{1,2})$/i,y="The provided string color doesn't have a correct format",m="The provided color object doesn't have the proper keys or format",A=function(t,r,e){return e<0&&(e+=6),e>=6&&(e-=6),e<1?Math.round(255*((r-t)*e+t)):e<3?Math.round(255*r):e<4?Math.round(255*((r-t)*(4-e)+t)):Math.round(255*t)},H=function(t,r,e){r/=100;var n=(e/=100)<=.5?e*(r+1):e+r-e*r,i=2*e-n;return{r:A(i,n,(t/=60)+2),g:A(i,n,t),b:A(i,n,t-2)}},E=function(t,r,e,n){return n=1-n,{r:Math.round(255*(1-t)*n),g:Math.round(255*(1-r)*n),b:Math.round(255*(1-e)*n)}},B=function(t,r,e){t/=255,r/=255,e/=255;var n=1-Math.max(t,r,e),i=1-n,o=(i-t)/i,a=(i-r)/i,u=(i-e)/i;return{c:Math.round(100*o),m:Math.round(100*a),y:Math.round(100*u),k:Math.round(100*n)}},v=function(t,r,e,n){void 0===n&&(n=1),t/=255,r/=255,e/=255,n=Math.min(n,1);var i=Math.max(t,r,e),o=Math.min(t,r,e),a=i-o,u=0,s=0,c=(i+o)/2;if(0===a)u=0,s=0;else{switch(i){case t:u=(r-e)/a%6;break;case r:u=(e-t)/a+2;break;case e:u=(t-r)/a+4}(u=Math.round(60*u))<0&&(u+=360),s=a/(1-Math.abs(2*c-1))}return{h:u,s:Math.round(100*s),l:Math.round(100*c),a:n}},M=function(t,r){if(t<0&&(t+=360),t>360&&(t-=360),360===t||0===t)return t;var e=[[0,120],[120,180],[180,240],[240,360]],n=[[0,60],[60,120],[120,240],[240,360]],i=r?n:e,o=0,a=0,u=0,s=0;return(r?e:n).find((function(r,e){return t>=r[0]&&t<r[1]&&(o=r[0],a=r[1],u=i[e][0],s=i[e][1],!0)})),u+(s-u)/(a-o)*(t-o)},R=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},S=function(t){return b.test(""+t)?+(""+t).replace(b,"$1"):Math.min(+t,100)},C=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},L=function(t){var r=parseInt(""+t).toString(16).toUpperCase();return 1===r.length?"0x0"+r:"0x"+r},D=function(t){var r=parseInt(""+t).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),r},G=function(t,r){return void 0===r&&(r=!1),!r&&b.test(t)?Math.min(255*+t.replace(b,"$1")/100,255):F.test(t)?3===t.length?r?parseInt(t+t.slice(-1))/255:parseInt(t+t.slice(-1)):r?parseInt(t)/255:parseInt(t):Math.min(+t,r?1:255)},k=function(t){return Math.min(b.test(t)?+t.replace(b,"$1")/100:+t,1)},O=function(t){return t.sort().join().toUpperCase()},X=function(t,r){void 0===r&&(r=0);var e=Math.pow(10,r);return Math.round(+t*e)/e},j=function(t,r,e){return Math.max(r,Math.min(t,e))},I=((s={})[r.HEX]=function(t){return"#"+D(t.r)+D(t.g)+D(t.b)+(R(t,"a")&&D(t.a)||"")},s[r.RGB]=function(t){return"rgb"+(R(t,"a")?"a":"")+"("+X(t.r)+","+X(t.g)+","+X(t.b)+(R(t,"a")&&","+X(t.a,2)||"")+")"},s[r.HSL]=function(t){return"hsl"+(R(t,"a")?"a":"")+"("+X(t.h)+","+X(t.s)+"%,"+X(t.l)+"%"+(R(t,"a")&&","+X(t.a,2)||"")+")"},s[r.CMYK]=function(t){return"cmyk("+X(t.c)+"%,"+X(t.m)+"%,"+X(t.y)+"%,"+X(t.k)+"%)"},s),x=function(t){return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},T=function(t){return isNaN(+t)||t>1?1:X(t,2)},Y=function(r,e,n){return e.reduce((function(e,i){return a(a([],e,!0),[o(o({},r),{h:n===t.Mix.ADDITIVE?x(r.h+i):x(M(M(r.h,!1)+i,!0))})],!1)}),[o({},r)])},P=function(t,r){return Y(t,[30,-30],r)},w=function(t,r){return Y(t,[180],r)},K=function(t,r){return Y(t,[150,-150],r)},N=function(t,r){return Y(t,[120,-120],r)},V=function(t,r){return Y(t,[60,-120,180],r)},U=function(t,r){return Y(t,[90,-90,180],r)},$=function(t){return"string"==typeof t?function(t){var e;if(Object.keys(r).some((function(r){if(g[r].test(t))return e=r,!0})),!e&&~p.indexOf(t)&&(e=r.HEX),!e)throw new Error(y);return e}(t):function(t){var e,n=!1,i=O(Object.keys(t));if(Object.keys(r).filter((function(t){return t!==r.HEX})).some((function(t){if(O(t.split(""))===i)return e=t,!0})),e&&e===r.RGB||e===r.RGBA){var o=Object.entries(t).map((function(t){return F.test(""+t[1])})),a=Object.entries(t).map((function(t){return b.test(""+t[1])||!F.test(""+t[1])&&!isNaN(+t[1])&&+t[1]<=255})),u=o.some((function(t,r){return r>0&&t!==o[r-1]})),s=a.some((function(t,r){return r>0&&t!==a[r-1]}));!(n=u||s||!o[0]&&!a[0])&&o[0]&&(e=r.HEX)}if(!e||n)throw new Error(m);return e}(t)},q=((c={})[r.HEX]=function(t){var r=(~p.indexOf(t)?i[t]:t).match(g.HEX),e={r:C(r[1]||r[5]),g:C(r[2]||r[6]),b:C(r[3]||r[7])},n=r[4]||r[8];return void 0!==n&&(e.a=C(n)/255),e},c[r.RGB]=function(t){var r=t.match(g.RGB),e=G(r[1]||r[4]),n=G(r[2]||r[5]),i=G(r[3]||r[6]);return{r:Math.min(e,255),g:Math.min(n,255),b:Math.min(i,255)}},c[r.RGBA]=function(t){var r=t.match(g.RGBA),e=G(r[1]||r[4]),n=G(r[2]||r[5]),i=G(r[3]||r[6]),o=+r[7];return{r:Math.min(e,255),g:Math.min(n,255),b:Math.min(i,255),a:T(o)}},c[r.HSL]=function(t){var r=t.match(g.HSL),e=x(+r[1]),n=S(r[2]),i=S(r[3]);return H(e,n,i)},c[r.HSLA]=function(t){var r=t.match(g.HSLA),e=x(+r[1]),n=S(r[2]),i=S(r[3]),o=+r[4],a=H(e,n,i);return a.a=T(o),a},c[r.CMYK]=function(t){var r=t.match(g.CMYK),e=k(r[1]||r[5]),n=k(r[2]||r[6]),i=k(r[3]||r[7]),o=k(r[4]||r[8]);return E(e,n,i,o)},c),_=((d={})[r.HEX]=function(t){var r={r:G(""+t.r),g:G(""+t.g),b:G(""+t.b)};return r.a=R(t,"a")?Math.min(G(""+t.a,!0),1):1,r},d[r.RGB]=function(t){var r=this.HEX(t);return delete r.a,r},d[r.RGBA]=function(t){return this.HEX(t)},d[r.HSL]=function(t){var r=S(""+t.s),e=S(""+t.l);return H(x(t.h),r,e)},d[r.HSLA]=function(t){var r=this.HSL(t);return r.a=T(t.a),r},d[r.CMYK]=function(t){var r=k(""+t.c),e=k(""+t.m),n=k(""+t.y),i=k(""+t.k);return E(r,e,n,i)},d),Q=function(t,r){return void 0===r&&(r=$(t)),"string"==typeof t?q[r](t):_[r](t)},z=((l={})[r.HEX]=function(t){return{r:L(t.r),g:L(t.g),b:L(t.b)}},l.HEXA=function(t){var r=z.HEX(t);return r.a=R(t,"a")?L(255*t.a):"0xFF",r},l[r.RGB]=function(t){return R(t,"a")&&delete t.a,t},l[r.RGBA]=function(t){return t.a=R(t,"a")?X(t.a,2):1,t},l[r.HSL]=function(t){var r=v(t.r,t.g,t.b);return delete r.a,r},l[r.HSLA]=function(t){var r=z.HSL(t);return r.a=R(t,"a")?X(t.a,2):1,r},l[r.CMYK]=function(t){return B(t.r,t.g,t.b)},l),J=function(t,e,n){var i=$(t),a="string"==typeof t,u=Q(t,i),s="string"==typeof t&&R(u,"a")||"string"!=typeof t&&R(t,"a"),c=v(u.r,u.g,u.b,u.a);s||delete c.a;var d=n?c.l/(e+1):(100-c.l)/(e+1),l=Array(e).fill(null).map((function(t,r){return o(o({},c),{l:c.l+d*(r+1)*(1-2*+n)})}));switch(i){case r.HEX:default:return l.map((function(t){var r=H(t.h,t.s,t.l);return s&&(r.a=t.a),a?s?I.HEX(o(o({},r),{a:X(255*r.a,2)})):I.HEX(r):s?z.HEXA(r):z.HEX(r)}));case r.RGB:case r.RGBA:return l.map((function(t){var r=H(t.h,t.s,t.l);return s&&(r.a=t.a),a?I.RGB(r):s?z.RGBA(r):z.RGB(r)}));case r.HSL:case r.HSLA:return l.map((function(t){return a?I.HSL(t):s?z.HSLA(o(o({},H(t.h,t.s,t.l)),{a:t.a})):z.HSL(H(t.h,t.s,t.l))}))}},W=((f={buildHarmony:function(t,e,n){var i=$(t),o=Q(t,i),a=v(o.r,o.g,o.b,o.a),u="string"==typeof t&&R(o,"a")||"string"!=typeof t&&R(t,"a"),s="string"==typeof t;switch(i){case r.HEX:default:return u?this.HEXA(a,e,n,s):this.HEX(a,e,n,s);case r.HSL:return this.HSL(a,e,n,s);case r.HSLA:return this.HSLA(a,e,n,s);case r.RGB:return this.RGB(a,e,n,s);case r.RGBA:return this.RGBA(a,e,n,s)}}})[r.HEX]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.HEX(H(t.h,t.s,t.l)):z.HEX(H(t.h,t.s,t.l))}))},f.HEXA=function(t,r,e,n){return r(t,e).map((function(t){return n?I.HEX(o(o({},H(t.h,t.s,t.l)),{a:255*T(t.a)})):z.HEXA(o(o({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},f[r.RGB]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.RGB(H(t.h,t.s,t.l)):z.RGB(H(t.h,t.s,t.l))}))},f[r.RGBA]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.RGB(o(o({},H(t.h,t.s,t.l)),{a:T(t.a)})):z.RGBA(o(o({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},f[r.HSL]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.HSL({h:t.h,s:t.s,l:t.l}):z.HSL(H(t.h,t.s,t.l))}))},f[r.HSLA]=function(t,r,e,n){return r(t,e).map((function(t){return n?I.HSL(o(o({},t),{a:T(t.a)})):z.HSLA(o(o({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},f),Z=((h={mix:function(r,e){var n,i,a,u,s,c,d,l,f,h,p,g,b,F,y,m=r.map((function(t){var r=$(t);return Q(t,r)})),A=e===t.Mix.SUBTRACTIVE?m.map((function(t){var r,e,n,i,o,a,u,s,c,d,l,f,h,p,g=(r=t.r,e=t.g,n=t.b,i=Math.min(r,e,n),o=Math.min(255-r,255-e,255-n),a=r-i,u=e-i,s=n-i,c=Math.min(a,u),d=a-c,l=(u+c)/2,f=(s+u-c)/2,h=Math.max(d,l,f)/Math.max(a,u,s),p=isNaN(h)||h===1/0||h<=0?1:h,{r:d/p+o,y:l/p+o,b:f/p+o});return R(t,"a")&&(g.a=t.a),g})):null;function H(r){var n=e===t.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return r.reduce((function(r,n){var i=R(n,"a")?n.a:1,a={r:Math.min(r.r+n.r*i,255),b:Math.min(r.b+n.b*i,255),a:1-(1-i)*(1-r.a)},u="g"in r?r.g:r.y,s="g"in n?n.g:n.y;return o(o({},a),e===t.Mix.ADDITIVE?{g:Math.min(u+s*i,255)}:{y:Math.min(u+s*i,255)})}),n)}if(e===t.Mix.ADDITIVE)n=H(m);else{var E=H(A);i=E.r,a=E.y,u=E.b,s=Math.min(i,a,u),c=Math.min(255-i,255-a,255-u),d=i-s,l=a-s,f=u-s,h=Math.min(l,f),p=d+l-h,g=l+2*h,b=2*(f-h),F=Math.max(p,g,b)/Math.max(d,l,f),y=isNaN(F)||F===1/0||F<=0?1:F,(n={r:p/y+c,g:g/y+c,b:b/y+c}).a=E.a}return{r:X(n.r,2),g:X(n.g,2),b:X(n.b,2),a:j(n.a,0,1)}}})[r.HEX]=function(t,r,e){var n=this.mix(t,r);return delete n.a,e?I.HEX(n):z.HEX(n)},h.HEXA=function(t,r,e){var n=this.mix(t,r);return n.a=e?255*T(n.a):T(n.a),e?I.HEX(n):z.HEXA(n)},h[r.RGB]=function(t,r,e){var n=this.mix(t,r);return delete n.a,e?I.RGB(n):z.RGB(n)},h[r.RGBA]=function(t,r,e){var n=this.mix(t,r);return e?I.RGB(n):z.RGBA(n)},h[r.HSL]=function(t,r,e){var n=this.mix(t,r),i=v(n.r,n.g,n.b);return delete n.a,delete i.a,e?I.HSL(i):z.HSL(n)},h[r.HSLA]=function(t,r,e){var n=this.mix(t,r),i=v(n.r,n.g,n.b,n.a);return e?I.HSL(i):z.HSLA(n)},h),tt=function(t,r){return"string"==typeof t&&r||"object"==typeof t&&!r},rt=function(t,r,e,n,i){var o=n(Q(t,r));return e?i(o):o},et=function(t,r,e,n,i,o){e<1&&(e=5);var a=function(t,r,e){var n=e-1,i=(r.r-t.r)/n,o=(r.g-t.g)/n,a=(r.b-t.b)/n,u=T(t.a),s=(T(r.a)-u)/n;return Array(e).fill(null).map((function(e,c){return 0===c?t:c===n?r:{r:X(t.r+i*c),g:X(t.g+o*c),b:X(t.b+a*c),a:X(u+s*c,2)}}))}(Q(t),Q(r),e);return a.map((function(t){var r=i(t);return n?o(r):r}))},nt=function(){function e(t){this.rgb=Q(t),this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=o(o({},H(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=o(o({},E(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=v(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=B(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setH=function(t){return this.hsl.h=x(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=j(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=j(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=j(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=j(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"H",{get:function(){return X(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return X(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return X(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return X(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return X(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return X(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return X(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return X(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return X(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return X(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return X(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return z.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return z.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return o(o({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return o(o({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return I.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:255*this.A};return I.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return I.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:this.A};return I.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){var t=this.hsl,r={h:t.h,s:t.s,l:t.l};return I.HSL(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return I.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return I.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),e.toHEX=function(t,r){void 0===r&&(r=!0);var e=$(t);return rt(t,e,r,z.HEX,I.HEX)},e.toHEXA=function(t,r){void 0===r&&(r=!0);var e=$(t);return rt(t,e,r,z.HEXA,I.HEX)},e.toRGB=function(t,r){void 0===r&&(r=!0);var e=$(t);return rt(t,e,r,z.RGB,I.RGB)},e.toRGBA=function(t,r){void 0===r&&(r=!0);var e=$(t);return rt(t,e,r,z.RGBA,I.RGB)},e.toHSL=function(t,e){void 0===e&&(e=!0);var n=$(t);return n===r.HSL&&tt(t,e)?t:rt(t,n,e,z.HSL,I.HSL)},e.toHSLA=function(t,e){void 0===e&&(e=!0);var n=$(t);return n===r.HSLA&&tt(t,e)?t:rt(t,n,e,z.HSLA,I.HSL)},e.toCMYK=function(t,e){void 0===e&&(e=!0);var n=$(t);return n===r.CMYK&&tt(t,e)?t:rt(t,n,e,z.CMYK,I.CMYK)},e.getBlendHEX=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.HEX,I.HEX)},e.getBlendHEXA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.HEXA,I.HEX)},e.getBlendRGB=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.RGB,I.RGB)},e.getBlendRGBA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.RGBA,I.RGB)},e.getBlendHSL=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.HSL,I.HSL)},e.getBlendHSLA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,z.HSLA,I.HSL)},e.getMixHEX=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.HEX(r,e,n)},e.getMixHEXA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.HEXA(r,e,n)},e.getMixRGB=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.RGB(r,e,n)},e.getMixRGBA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.RGBA(r,e,n)},e.getMixHSL=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.HSL(r,e,n)},e.getMixHSLA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),Z.HSLA(r,e,n)},e.getShades=function(t,r){return J(t,r,!0)},e.getTints=function(t,r){return J(t,r,!1)},e.getHarmony=function(r,e,n){switch(void 0===e&&(e=t.Harmony.COMPLEMENTARY),void 0===n&&(n=t.Mix.ADDITIVE),e){case t.Harmony.ANALOGOUS:return W.buildHarmony(r,P,n);case t.Harmony.SPLIT_COMPLEMENTARY:return W.buildHarmony(r,K,n);case t.Harmony.TRIADIC:return W.buildHarmony(r,N,n);case t.Harmony.TETRADIC:return W.buildHarmony(r,V,n);case t.Harmony.SQUARE:return W.buildHarmony(r,U,n);default:return W.buildHarmony(r,w,n)}},e}();return t.ColorTranslator=nt,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); |
{ | ||
"name": "colortranslator", | ||
"version": "1.9.1", | ||
"version": "1.9.2", | ||
"description": "A JavaScript library, written in TypeScript, to convert among different color models", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125030
715