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

colortranslator

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colortranslator - npm Package Compare versions

Comparing version 1.9.4 to 1.10.0

2

esm/index.js

@@ -1,1 +0,1 @@

var t,n,e,r,o=function(){return o=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},o.apply(this,arguments)};function a(t,n,e){if(e||2===arguments.length)for(var r,o=0,a=n.length;o<a;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}!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"}(n||(n={})),function(t){t.ADDITIVE="ADDITIVE",t.SUBTRACTIVE="SUBTRACTIVE"}(e||(e={})),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"}(r||(r={}));var c,i,u,s,d,l,f,h,p=Object.keys(r),g="".concat("[a-f\\d]","{2}"),b="".concat("\\s*",",").concat("\\s*"),F=function(t,n){void 0===n&&(n=!1);var e=t.replace(/\s*/gm,"");return n?new RegExp(e,"i"):new RegExp(e)},A=((c={})[t.HEX]="\n ^#(?:\n (".concat("[a-f\\d]",")\n (").concat("[a-f\\d]",")\n (").concat("[a-f\\d]",")\n (").concat("[a-f\\d]",")?\n |\n (").concat(g,")\n (").concat(g,")\n (").concat(g,")\n (").concat(g,")?\n )$\n "),c[t.RGB]="\n ^rgb".concat("\\s*","\\(\n ").concat("\\s*","\n (?:\n (").concat("\\d+%",")\n ").concat(b,"\n (").concat("\\d+%",")\n ").concat(b,"\n (").concat("\\d+%",")\n |\n (").concat("\\d+",")\n ").concat(b,"\n (").concat("\\d+",")\n ").concat(b,"\n (").concat("\\d+",")\n )\n ").concat("\\s*","\n \\)$\n "),c[t.RGBA]="\n ^rgba".concat("\\s*","\\(\n ").concat("\\s*","\n (?:\n (").concat("\\d+%",")\n ").concat(b,"\n (").concat("\\d+%",")\n ").concat(b,"\n (").concat("\\d+%",")\n |\n (").concat("\\d+",")\n ").concat(b,"\n (").concat("\\d+",")\n ").concat(b,"\n (").concat("\\d+",")\n )\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat("\\s*","\n \\)$\n "),c[t.HSL]="\n ^hsl".concat("\\s*","\\(\n ").concat("\\s*","\n (-?").concat("\\d+\\.?\\d*",")\n ").concat(b,"\n (").concat("\\d+\\.?\\d*",")%\n ").concat(b,"\n (").concat("\\d+\\.?\\d*",")%\n ").concat("\\s*","\n \\)$\n "),c[t.HSLA]="\n ^hsla".concat("\\s*","\\(\n ").concat("\\s*","\n (-?").concat("\\d+\\.?\\d*",")\n ").concat(b,"\n (").concat("\\d+\\.?\\d*",")%\n ").concat(b,"\n (").concat("\\d+\\.?\\d*",")%\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat("\\s*","\n \\)$\n "),c[t.CMYK]="\n ^(?:device-cmyk|cmyk)\n ".concat("\\s*","\n \\(").concat("\\s*","\n (?:\n (").concat("\\d+\\.?\\d*","%)\n ").concat(b,"\n (").concat("\\d+\\.?\\d*","%)\n ").concat(b,"\n (").concat("\\d+\\.?\\d*","%)\n ").concat(b,"\n (").concat("\\d+\\.?\\d*","%)\n |\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n )\n ").concat("\\s*","\n \\)$\n "),c),m=((i={})[t.HEX]=F(A.HEX,!0),i[t.RGB]=F(A.RGB),i[t.RGBA]=F(A.RGBA),i[t.HSL]=F(A.HSL),i[t.HSLA]=F(A.HSLA),i[t.CMYK]=F(A.CMYK),i),y=/^(\d+(?:\.\d+)?|\.\d+)%$/,H=/^0x([a-f\d]{1,2})$/i,E="The provided string color doesn't have a correct format",B="The provided color object doesn't have the proper keys or format",v=function(t,n,e){return e<0&&(e+=6),e>=6&&(e-=6),e<1?Math.round(255*((n-t)*e+t)):e<3?Math.round(255*n):e<4?Math.round(255*((n-t)*(4-e)+t)):Math.round(255*t)},M=function(t,n,e){n/=100;var r=(e/=100)<=.5?e*(n+1):e+n-e*n,o=2*e-r;return{r:v(o,r,(t/=60)+2),g:v(o,r,t),b:v(o,r,t-2)}},R=function(t,n,e,r){return r=1-r,{r:Math.round(255*(1-t)*r),g:Math.round(255*(1-n)*r),b:Math.round(255*(1-e)*r)}},S=function(t,n,e){t/=255,n/=255,e/=255;var r=1-Math.max(t,n,e),o=1-r,a=(o-t)/o,c=(o-n)/o,i=(o-e)/o;return{c:Math.round(100*a),m:Math.round(100*c),y:Math.round(100*i),k:Math.round(100*r)}},L=function(t,n,e,r){void 0===r&&(r=1),t/=255,n/=255,e/=255,r=Math.min(r,1);var o=Math.max(t,n,e),a=Math.min(t,n,e),c=o-a,i=0,u=0,s=(o+a)/2;if(0===c)i=0,u=0;else{switch(o){case t:i=(n-e)/c%6;break;case n:i=(e-t)/c+2;break;case e:i=(t-n)/c+4}(i=Math.round(60*i))<0&&(i+=360),u=c/(1-Math.abs(2*s-1))}return{h:i,s:Math.round(100*u),l:Math.round(100*s),a:r}},C=function(t,n){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]],r=[[0,60],[60,120],[120,240],[240,360]],o=n?r:e,a=0,c=0,i=0,u=0;return(n?e:r).find((function(n,e){return t>=n[0]&&t<n[1]&&(a=n[0],c=n[1],i=o[e][0],u=o[e][1],!0)})),i+(u-i)/(c-a)*(t-a)},D=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},G=function(t){return y.test("".concat(t))?+"".concat(t).replace(y,"$1"):Math.min(+t,100)},k=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},X=function(t){var n=parseInt("".concat(t)).toString(16).toUpperCase();return 1===n.length?"0x0".concat(n):"0x".concat(n)},O=function(t){var n=parseInt("".concat(t)).toString(16).toUpperCase();return 1===n.length&&(n="0".concat(n)),n},I=function(t,n){return void 0===n&&(n=!1),!n&&y.test(t)?Math.min(255*+t.replace(y,"$1")/100,255):H.test(t)?3===t.length?n?parseInt(t+t.slice(-1))/255:parseInt(t+t.slice(-1)):n?parseInt(t)/255:parseInt(t):Math.min(+t,n?1:255)},j=function(t){return Math.min(y.test(t)?+t.replace(y,"$1")/100:+t,1)},T=function(t){return t.sort().join().toUpperCase()},Y=function(t,n){void 0===n&&(n=0);var e=Math.pow(10,n);return Math.round(+t*e)/e},w=function(t,n,e){return Math.max(n,Math.min(t,e))},P=((u={})[t.HEX]=function(t){return"#".concat(O(t.r)).concat(O(t.g)).concat(O(t.b)).concat(D(t,"a")&&O(t.a)||"")},u[t.RGB]=function(t){return"rgb".concat(D(t,"a")?"a":"","(").concat(Y(t.r),",").concat(Y(t.g),",").concat(Y(t.b)).concat(D(t,"a")&&",".concat(Y(t.a,2))||"",")")},u[t.HSL]=function(t){return"hsl".concat(D(t,"a")?"a":"","(").concat(Y(t.h),",").concat(Y(t.s),"%,").concat(Y(t.l),"%").concat(D(t,"a")&&",".concat(Y(t.a,2))||"",")")},u[t.CMYK]=function(t){return"cmyk(".concat(Y(t.c),"%,").concat(Y(t.m),"%,").concat(Y(t.y),"%,").concat(Y(t.k),"%)")},u),K=function(t){return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},x=function(t){return isNaN(+t)||t>1?1:Y(t,2)},N=function(t,n,r){return n.reduce((function(n,c){return a(a([],n,!0),[o(o({},t),{h:r===e.ADDITIVE?K(t.h+c):K(C(C(t.h,!1)+c,!0))})],!1)}),[o({},t)])},V=function(t,n){return N(t,[30,-30],n)},U=function(t,n){return N(t,[180],n)},$=function(t,n){return N(t,[150,-150],n)},q=function(t,n){return N(t,[120,-120],n)},Q=function(t,n){return N(t,[60,-120,180],n)},_=function(t,n){return N(t,[90,-90,180],n)},z=function(n){return"string"==typeof n?function(n){var e;if(Object.keys(t).some((function(t){if(m[t].test(n))return e=t,!0})),!e&&~p.indexOf(n)&&(e=t.HEX),!e)throw new Error(E);return e}(n):function(n){var e,r=!1,o=T(Object.keys(n));if(Object.keys(t).filter((function(n){return n!==t.HEX})).some((function(t){if(T(t.split(""))===o)return e=t,!0})),e&&e===t.RGB||e===t.RGBA){var a=Object.entries(n).map((function(t){return H.test("".concat(t[1]))})),c=Object.entries(n).map((function(t){return y.test("".concat(t[1]))||!H.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255})),i=a.some((function(t,n){return n>0&&t!==a[n-1]})),u=c.some((function(t,n){return n>0&&t!==c[n-1]}));!(r=i||u||!a[0]&&!c[0])&&a[0]&&(e=t.HEX)}if(!e||r)throw new Error(B);return e}(n)},J=((s={})[t.HEX]=function(t){var n=(~p.indexOf(t)?r[t]:t).match(m.HEX),e={r:k(n[1]||n[5]),g:k(n[2]||n[6]),b:k(n[3]||n[7])},o=n[4]||n[8];return void 0!==o&&(e.a=k(o)/255),e},s[t.RGB]=function(t){var n=t.match(m.RGB),e=I(n[1]||n[4]),r=I(n[2]||n[5]),o=I(n[3]||n[6]);return{r:Math.min(e,255),g:Math.min(r,255),b:Math.min(o,255)}},s[t.RGBA]=function(t){var n=t.match(m.RGBA),e=I(n[1]||n[4]),r=I(n[2]||n[5]),o=I(n[3]||n[6]),a=+n[7];return{r:Math.min(e,255),g:Math.min(r,255),b:Math.min(o,255),a:x(a)}},s[t.HSL]=function(t){var n=t.match(m.HSL),e=K(+n[1]),r=G(n[2]),o=G(n[3]);return M(e,r,o)},s[t.HSLA]=function(t){var n=t.match(m.HSLA),e=K(+n[1]),r=G(n[2]),o=G(n[3]),a=+n[4],c=M(e,r,o);return c.a=x(a),c},s[t.CMYK]=function(t){var n=t.match(m.CMYK),e=j(n[1]||n[5]),r=j(n[2]||n[6]),o=j(n[3]||n[7]),a=j(n[4]||n[8]);return R(e,r,o,a)},s),W=((d={})[t.HEX]=function(t){var n={r:I("".concat(t.r)),g:I("".concat(t.g)),b:I("".concat(t.b))};return n.a=D(t,"a")?Math.min(I("".concat(t.a),!0),1):1,n},d[t.RGB]=function(t){var n=this.HEX(t);return delete n.a,n},d[t.RGBA]=function(t){return this.HEX(t)},d[t.HSL]=function(t){var n=G("".concat(t.s)),e=G("".concat(t.l));return M(K(t.h),n,e)},d[t.HSLA]=function(t){var n=this.HSL(t);return n.a=x(t.a),n},d[t.CMYK]=function(t){var n=j("".concat(t.c)),e=j("".concat(t.m)),r=j("".concat(t.y)),o=j("".concat(t.k));return R(n,e,r,o)},d),Z=function(t,n){return void 0===n&&(n=z(t)),"string"==typeof t?J[n](t):W[n](t)},tt=((l={})[t.HEX]=function(t){return{r:X(t.r),g:X(t.g),b:X(t.b)}},l.HEXA=function(t){var n=tt.HEX(t);return n.a=D(t,"a")?X(255*t.a):"0xFF",n},l[t.RGB]=function(t){return D(t,"a")&&delete t.a,t},l[t.RGBA]=function(t){return t.a=D(t,"a")?Y(t.a,2):1,t},l[t.HSL]=function(t){var n=L(t.r,t.g,t.b);return delete n.a,n},l[t.HSLA]=function(t){var n=tt.HSL(t);return n.a=D(t,"a")?Y(t.a,2):1,n},l[t.CMYK]=function(t){return S(t.r,t.g,t.b)},l),nt=function(n,e,r){var a=z(n),c="string"==typeof n,i=Z(n,a),u="string"==typeof n&&D(i,"a")||"string"!=typeof n&&D(n,"a"),s=L(i.r,i.g,i.b,i.a);u||delete s.a;var d=r?s.l/(e+1):(100-s.l)/(e+1),l=Array(e).fill(null).map((function(t,n){return o(o({},s),{l:s.l+d*(n+1)*(1-2*+r)})}));switch(a){case t.HEX:default:return l.map((function(t){var n=M(t.h,t.s,t.l);return u&&(n.a=t.a),c?u?P.HEX(o(o({},n),{a:Y(255*n.a,2)})):P.HEX(n):u?tt.HEXA(n):tt.HEX(n)}));case t.RGB:case t.RGBA:return l.map((function(t){var n=M(t.h,t.s,t.l);return u&&(n.a=t.a),c?P.RGB(n):u?tt.RGBA(n):tt.RGB(n)}));case t.HSL:case t.HSLA:return l.map((function(t){return c?P.HSL(t):u?tt.HSLA(o(o({},M(t.h,t.s,t.l)),{a:t.a})):tt.HSL(M(t.h,t.s,t.l))}))}},et=((f={buildHarmony:function(n,e,r){var o=z(n),a=Z(n,o),c=L(a.r,a.g,a.b,a.a),i="string"==typeof n&&D(a,"a")||"string"!=typeof n&&D(n,"a"),u="string"==typeof n;switch(o){case t.HEX:default:return i?this.HEXA(c,e,r,u):this.HEX(c,e,r,u);case t.HSL:return this.HSL(c,e,r,u);case t.HSLA:return this.HSLA(c,e,r,u);case t.RGB:return this.RGB(c,e,r,u);case t.RGBA:return this.RGBA(c,e,r,u)}}})[t.HEX]=function(t,n,e,r){return n(t,e).map((function(t){return r?P.HEX(M(t.h,t.s,t.l)):tt.HEX(M(t.h,t.s,t.l))}))},f.HEXA=function(t,n,e,r){return n(t,e).map((function(t){return r?P.HEX(o(o({},M(t.h,t.s,t.l)),{a:255*x(t.a)})):tt.HEXA(o(o({},M(t.h,t.s,t.l)),{a:x(t.a)}))}))},f[t.RGB]=function(t,n,e,r){return n(t,e).map((function(t){return r?P.RGB(M(t.h,t.s,t.l)):tt.RGB(M(t.h,t.s,t.l))}))},f[t.RGBA]=function(t,n,e,r){return n(t,e).map((function(t){return r?P.RGB(o(o({},M(t.h,t.s,t.l)),{a:x(t.a)})):tt.RGBA(o(o({},M(t.h,t.s,t.l)),{a:x(t.a)}))}))},f[t.HSL]=function(t,n,e,r){return n(t,e).map((function(t){return r?P.HSL({h:t.h,s:t.s,l:t.l}):tt.HSL(M(t.h,t.s,t.l))}))},f[t.HSLA]=function(t,n,e,r){return n(t,e).map((function(t){return r?P.HSL(o(o({},t),{a:x(t.a)})):tt.HSLA(o(o({},M(t.h,t.s,t.l)),{a:x(t.a)}))}))},f),rt=((h={mix:function(t,n){var r,a,c,i,u,s,d,l,f,h,p,g,b,F,A,m=t.map((function(t){var n=z(t);return Z(t,n)})),y=n===e.SUBTRACTIVE?m.map((function(t){var n,e,r,o,a,c,i,u,s,d,l,f,h,p,g=(n=t.r,e=t.g,r=t.b,o=Math.min(n,e,r),a=Math.min(255-n,255-e,255-r),c=n-o,i=e-o,u=r-o,s=Math.min(c,i),d=c-s,l=(i+s)/2,f=(u+i-s)/2,h=Math.max(d,l,f)/Math.max(c,i,u),p=isNaN(h)||h===1/0||h<=0?1:h,{r:d/p+a,y:l/p+a,b:f/p+a});return D(t,"a")&&(g.a=t.a),g})):null;function H(t){var r=n===e.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return t.reduce((function(t,r){var a=D(r,"a")?r.a:1,c={r:Math.min(t.r+r.r*a,255),b:Math.min(t.b+r.b*a,255),a:1-(1-a)*(1-t.a)},i="g"in t?t.g:t.y,u="g"in r?r.g:r.y;return o(o({},c),n===e.ADDITIVE?{g:Math.min(i+u*a,255)}:{y:Math.min(i+u*a,255)})}),r)}if(n===e.ADDITIVE)r=H(m);else{var E=H(y);a=E.r,c=E.y,i=E.b,u=Math.min(a,c,i),s=Math.min(255-a,255-c,255-i),d=a-u,l=c-u,f=i-u,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),A=isNaN(F)||F===1/0||F<=0?1:F,(r={r:p/A+s,g:g/A+s,b:b/A+s}).a=E.a}return{r:Y(r.r,2),g:Y(r.g,2),b:Y(r.b,2),a:w(r.a,0,1)}}})[t.HEX]=function(t,n,e){var r=this.mix(t,n);return delete r.a,e?P.HEX(r):tt.HEX(r)},h.HEXA=function(t,n,e){var r=this.mix(t,n);return r.a=e?255*x(r.a):x(r.a),e?P.HEX(r):tt.HEXA(r)},h[t.RGB]=function(t,n,e){var r=this.mix(t,n);return delete r.a,e?P.RGB(r):tt.RGB(r)},h[t.RGBA]=function(t,n,e){var r=this.mix(t,n);return e?P.RGB(r):tt.RGBA(r)},h[t.HSL]=function(t,n,e){var r=this.mix(t,n),o=L(r.r,r.g,r.b);return delete r.a,delete o.a,e?P.HSL(o):tt.HSL(r)},h[t.HSLA]=function(t,n,e){var r=this.mix(t,n),o=L(r.r,r.g,r.b,r.a);return e?P.HSL(o):tt.HSLA(r)},h),ot=function(t,n){return"string"==typeof t&&n||"object"==typeof t&&!n},at=function(t,n,e,r,o){var a=r(Z(t,n));return e?o(a):a},ct=function(t,n,e,r,o,a){e<1&&(e=5);var c=function(t,n,e){var r=e-1,o=(n.r-t.r)/r,a=(n.g-t.g)/r,c=(n.b-t.b)/r,i=x(t.a),u=(x(n.a)-i)/r;return Array(e).fill(null).map((function(e,s){return 0===s?t:s===r?n:{r:Y(t.r+o*s),g:Y(t.g+a*s),b:Y(t.b+c*s),a:Y(i+u*s,2)}}))}(Z(t),Z(n),e);return c.map((function(t){var n=o(t);return r?a(n):n}))},it=function(){function r(t){this.rgb=Z(t),this.updateHSL(),this.updateCMYK()}return r.prototype.updateRGB=function(){this.rgb=o(o({},M(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},r.prototype.updateRGBFromCMYK=function(){this.rgb=o(o({},R(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},r.prototype.updateHSL=function(){this.hsl=L(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},r.prototype.updateCMYK=function(){this.cmyk=S(this.rgb.r,this.rgb.g,this.rgb.b)},r.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},r.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},r.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},r.prototype.setH=function(t){return this.hsl.h=K(t),this.updateRGBAndCMYK()},r.prototype.setS=function(t){return this.hsl.s=w(t,0,100),this.updateRGBAndCMYK()},r.prototype.setL=function(t){return this.hsl.l=w(t,0,100),this.updateRGBAndCMYK()},r.prototype.setR=function(t){return this.rgb.r=w(t,0,255),this.updateHSLAndCMYK()},r.prototype.setG=function(t){return this.rgb.g=w(t,0,255),this.updateHSLAndCMYK()},r.prototype.setB=function(t){return this.rgb.b=w(t,0,255),this.updateHSLAndCMYK()},r.prototype.setA=function(t){return this.hsl.a=this.rgb.a=w(t,0,1),this},r.prototype.setC=function(t){return this.cmyk.c=w(t,0,100),this.updateRGBAndHSL()},r.prototype.setM=function(t){return this.cmyk.m=w(t,0,100),this.updateRGBAndHSL()},r.prototype.setY=function(t){return this.cmyk.y=w(t,0,100),this.updateRGBAndHSL()},r.prototype.setK=function(t){return this.cmyk.k=w(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(r.prototype,"H",{get:function(){return Y(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"S",{get:function(){return Y(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"L",{get:function(){return Y(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"R",{get:function(){return Y(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"G",{get:function(){return Y(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"B",{get:function(){return Y(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"A",{get:function(){return Y(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"C",{get:function(){return Y(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"M",{get:function(){return Y(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Y",{get:function(){return Y(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"K",{get:function(){return Y(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXObject",{get:function(){return tt.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXAObject",{get:function(){return tt.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBAObject",{get:function(){return o(o({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLAObject",{get:function(){return o(o({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEX",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b};return P.HEX(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXA",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b,a:255*this.A};return P.HEX(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGB",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b};return P.RGB(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBA",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b,a:this.A};return P.RGB(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSL",{get:function(){var t=this.hsl,n={h:t.h,s:t.s,l:t.l};return P.HSL(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLA",{get:function(){return P.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYK",{get:function(){return P.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),r.toHEX=function(t,n){void 0===n&&(n=!0);var e=z(t);return at(t,e,n,tt.HEX,P.HEX)},r.toHEXA=function(t,n){void 0===n&&(n=!0);var e=z(t);return at(t,e,n,tt.HEXA,P.HEX)},r.toRGB=function(t,n){void 0===n&&(n=!0);var e=z(t);return at(t,e,n,tt.RGB,P.RGB)},r.toRGBA=function(t,n){void 0===n&&(n=!0);var e=z(t);return at(t,e,n,tt.RGBA,P.RGB)},r.toHSL=function(n,e){void 0===e&&(e=!0);var r=z(n);return r===t.HSL&&ot(n,e)?n:at(n,r,e,tt.HSL,P.HSL)},r.toHSLA=function(n,e){void 0===e&&(e=!0);var r=z(n);return r===t.HSLA&&ot(n,e)?n:at(n,r,e,tt.HSLA,P.HSL)},r.toCMYK=function(n,e){void 0===e&&(e=!0);var r=z(n);return r===t.CMYK&&ot(n,e)?n:at(n,r,e,tt.CMYK,P.CMYK)},r.getBlendHEX=function(t,n,e,r){return void 0===e&&(e=5),void 0===r&&(r=!0),ct(t,n,e,r,tt.HEX,P.HEX)},r.getBlendHEXA=function(t,n,e,r){return void 0===e&&(e=5),void 0===r&&(r=!0),ct(t,n,e,r,tt.HEXA,P.HEX)},r.getBlendRGB=function(t,n,e,r){return void 0===e&&(e=5),void 0===r&&(r=!0),ct(t,n,e,r,tt.RGB,P.RGB)},r.getBlendRGBA=function(t,n,e,r){return void 0===e&&(e=5),void 0===r&&(r=!0),ct(t,n,e,r,tt.RGBA,P.RGB)},r.getBlendHSL=function(t,n,e,r){return void 0===e&&(e=5),void 0===r&&(r=!0),ct(t,n,e,r,tt.HSL,P.HSL)},r.getBlendHSLA=function(t,n,e,r){return void 0===e&&(e=5),void 0===r&&(r=!0),ct(t,n,e,r,tt.HSLA,P.HSL)},r.getMixHEX=function(t,n,r){return void 0===n&&(n=e.ADDITIVE),void 0===r&&(r=!0),rt.HEX(t,n,r)},r.getMixHEXA=function(t,n,r){return void 0===n&&(n=e.ADDITIVE),void 0===r&&(r=!0),rt.HEXA(t,n,r)},r.getMixRGB=function(t,n,r){return void 0===n&&(n=e.ADDITIVE),void 0===r&&(r=!0),rt.RGB(t,n,r)},r.getMixRGBA=function(t,n,r){return void 0===n&&(n=e.ADDITIVE),void 0===r&&(r=!0),rt.RGBA(t,n,r)},r.getMixHSL=function(t,n,r){return void 0===n&&(n=e.ADDITIVE),void 0===r&&(r=!0),rt.HSL(t,n,r)},r.getMixHSLA=function(t,n,r){return void 0===n&&(n=e.ADDITIVE),void 0===r&&(r=!0),rt.HSLA(t,n,r)},r.getShades=function(t,n){return nt(t,n,!0)},r.getTints=function(t,n){return nt(t,n,!1)},r.getHarmony=function(t,r,o){switch(void 0===r&&(r=n.COMPLEMENTARY),void 0===o&&(o=e.ADDITIVE),r){case n.ANALOGOUS:return et.buildHarmony(t,V,o);case n.SPLIT_COMPLEMENTARY:return et.buildHarmony(t,$,o);case n.TRIADIC:return et.buildHarmony(t,q,o);case n.TETRADIC:return et.buildHarmony(t,Q,o);case n.SQUARE:return et.buildHarmony(t,_,o);default:return et.buildHarmony(t,U,o)}},r}();export{it as ColorTranslator,n as Harmony,e as Mix};
var t,e,r,n,o=function(){return o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},o.apply(this,arguments)};function a(t,e,r){if(r||2===arguments.length)for(var n,o=0,a=e.length;o<a;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",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 i,u,c,s,d,h,f,l=Object.keys(n),g=((i={})[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,i[t.RGB]=/^rgba?\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,i[t.HSL]=/^hsla?\s*\(\s*(?:(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*,\s*((?:\d*\.)?\d+)%\s*,\s*((?:\d*\.)?\d+)%(?:\s*,\s*((?:\d*\.)?\d+))?|(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*((?:\d*\.)?\d+)%\s*((?:\d*\.)?\d+)%(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,i[t.CMYK]=/^(?:device-cmyk|cmyk)\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,i),p=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,b=/^(\d+(?:\.\d+)?|\.\d+)%$/,F=/^0x([a-f\d]{1,2})$/i,y="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)},E=function(t,e,r){e/=100;var n=(r/=100)<=.5?r*(e+1):r+e-r*e,o=2*r-n;return{r:m(o,n,(t/=60)+2),g:m(o,n,t),b:m(o,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)}},v=function(t,e,r){t/=255,e/=255,r/=255;var n=1-Math.max(t,e,r),o=1-n,a=(o-t)/o,i=(o-e)/o,u=(o-r)/o;return{c:Math.round(100*a),m:Math.round(100*i),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 o=Math.max(t,e,r),a=Math.min(t,e,r),i=o-a,u=0,c=0,s=(o+a)/2;if(0===i)u=0,c=0;else{switch(o){case t:u=(e-r)/i%6;break;case e:u=(r-t)/i+2;break;case r:u=(t-e)/i+4}(u=Math.round(60*u))<0&&(u+=360),c=i/(1-Math.abs(2*s-1))}return{h:u,s:Math.round(100*c),l:Math.round(100*s),a:n}},M=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]],o=e?n:r,a=0,i=0,u=0,c=0;return(e?r:n).find((function(e,r){return t>=e[0]&&t<e[1]&&(a=e[0],i=e[1],u=o[r][0],c=o[r][1],!0)})),u+(c-u)/(i-a)*(t-a)},C=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},D=function(t){return b.test("".concat(t))?+"".concat(t).replace(b,"$1"):Math.min(+t,100)},R=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},S=function(t){var e=parseInt("".concat(t)).toString(16).toUpperCase();return 1===e.length?"0x0".concat(e):"0x".concat(e)},L=function(t){var e=parseInt("".concat(t)).toString(16).toUpperCase();return 1===e.length&&(e="0".concat(e)),e},G=function(t,e){return void 0===e&&(e=!1),!e&&b.test(t)?Math.min(255*+t.replace(b,"$1")/100,255):F.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)},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,e){void 0===e&&(e=0);var r=Math.pow(10,e);return Math.round(+t*r)/r},j=function(t,e,r){return Math.max(e,Math.min(t,r))},I=((u={})[t.HEX]=function(t){return"#".concat(L(t.r)).concat(L(t.g)).concat(L(t.b)).concat(C(t,"a")&&L(t.a)||"")},u[t.RGB]=function(t){return"rgb".concat(C(t,"a")?"a":"","(").concat(X(t.r),",").concat(X(t.g),",").concat(X(t.b)).concat(C(t,"a")&&",".concat(X(t.a,2))||"",")")},u[t.HSL]=function(t){return"hsl".concat(C(t,"a")?"a":"","(").concat(X(t.h),",").concat(X(t.s),"%,").concat(X(t.l),"%").concat(C(t,"a")&&",".concat(X(t.a,2))||"",")")},u[t.CMYK]=function(t){return"cmyk(".concat(X(t.c),"%,").concat(X(t.m),"%,").concat(X(t.y),"%,").concat(X(t.k),"%").concat(C(t,"a")&&",".concat(X(t.a,2))||"",")")},u),Y=function(t){if("string"==typeof t){var e=t.match(p),r=+e[1];switch(e[2]){case"rad":t=Math.round(180*r/Math.PI);break;case"turn":t=Math.round(360*r);break;default:t=r}}return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},T=function(t){return"string"==typeof t&&(t=b.test(t)?+t.replace(b,"$1")/100:+t),isNaN(+t)||t>1?1:X(t,2)},K=function(t,e,n){return e.reduce((function(e,i){return a(a([],e,!0),[o(o({},t),{h:n===r.ADDITIVE?Y(t.h+i):Y(M(M(t.h,!1)+i,!0))})],!1)}),[o({},t)])},P=function(t,e){return K(t,[30,-30],e)},w=function(t,e){return K(t,[180],e)},x=function(t,e){return K(t,[150,-150],e)},N=function(t,e){return K(t,[120,-120],e)},V=function(t,e){return K(t,[60,-120,180],e)},U=function(t,e){return K(t,[90,-90,180],e)},$=Object.entries(t).reduce((function(e,r){var n=r[0],o=r[1];if(n!==t.HEX){var a=O(n.split(""));e[a]=o,e["A"+a]=o}return e}),{}),q=function(e){return"string"==typeof e?function(e){var r;if(Object.keys(t).some((function(t){if(g[t].test(e))return r=t,!0})),!r&&~l.indexOf(e)&&(r=t.HEX),!r)throw new Error(y);return r}(e):function(e){var r,n=!1,o=O(Object.keys(e));if($[o]&&(r=$[o]),r&&r===t.RGB){var a=Object.entries(e).some((function(t){return!F.test("".concat(t[1]))})),i=Object.entries(e).some((function(t){return!(b.test("".concat(t[1]))||!F.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255)}));a&&i&&(n=!0),a||(r=t.HEX)}if(!r||n)throw new Error(A);return r}(e)},Q=((c={})[t.HEX]=function(t){var e=(~l.indexOf(t)?n[t]:t).match(g.HEX),r={r:R(e[1]||e[5]),g:R(e[2]||e[6]),b:R(e[3]||e[7])},o=e[4]||e[8];return void 0!==o&&(r.a=R(o)/255),r},c[t.RGB]=function(t){var e=t.match(g.RGB),r=G(e[1]||e[5]),n=G(e[2]||e[6]),o=G(e[3]||e[7]),a=e[4]||e[8],i={r:Math.min(r,255),g:Math.min(n,255),b:Math.min(o,255)};return void 0!==a&&(i.a=T(a)),i},c[t.HSL]=function(t){var e=t.match(g.HSL),r=Y(e[1]||e[5]),n=D(e[2]||e[6]),o=D(e[3]||e[7]),a=e[4]||e[8],i=E(r,n,o);return void 0!==a&&(i.a=T(a)),i},c[t.CMYK]=function(t){var e=t.match(g.CMYK),r=k(e[1]||e[6]),n=k(e[2]||e[7]),o=k(e[3]||e[8]),a=k(e[4]||e[9]),i=e[5]||e[10],u=H(r,n,o,a);return void 0!==i&&(u.a=T(i)),u},c),_=((s={})[t.HEX]=function(t){var e={r:G("".concat(t.r)),g:G("".concat(t.g)),b:G("".concat(t.b))};return C(t,"a")&&(e.a=Math.min(G("".concat(t.a),!0),1)),e},s[t.RGB]=function(t){return this.HEX(t)},s[t.HSL]=function(t){var e=D("".concat(t.s)),r=D("".concat(t.l)),n=E(Y(t.h),e,r);return C(t,"a")&&(n.a=T(t.a)),n},s[t.CMYK]=function(t){var e=k("".concat(t.c)),r=k("".concat(t.m)),n=k("".concat(t.y)),o=k("".concat(t.k)),a=H(e,r,n,o);return C(t,"a")&&(a.a=T(t.a)),a},s),z=function(t,e){return void 0===e&&(e=q(t)),"string"==typeof t?Q[e](t):_[e](t)},J=((d={})[t.HEX]=function(t){return{r:S(t.r),g:S(t.g),b:S(t.b)}},d.HEXA=function(t){var e=J.HEX(t);return e.a=C(t,"a")?S(255*t.a):"0xFF",e},d[t.RGB]=function(t){return C(t,"a")&&delete t.a,t},d.RGBA=function(t){return t.a=C(t,"a")?X(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.HSLA=function(t){var e=J.HSL(t);return e.a=C(t,"a")?X(t.a,2):1,e},d[t.CMYK]=function(t){return v(t.r,t.g,t.b)},d.CMYKA=function(t){var e=v(t.r,t.g,t.b);return e.a=C(t,"a")?X(t.a,2):1,e},d),W=function(e,r,n){var a=q(e),i="string"==typeof e,u=z(e,a),c="string"==typeof e&&C(u,"a")||"string"!=typeof e&&C(e,"a"),s=B(u.r,u.g,u.b,u.a);c||delete s.a;var d=n?s.l/(r+1):(100-s.l)/(r+1),h=Array(r).fill(null).map((function(t,e){return o(o({},s),{l:s.l+d*(e+1)*(1-2*+n)})}));switch(a){case t.HEX:default:return h.map((function(t){var e=E(t.h,t.s,t.l);return c&&(e.a=t.a),i?c?I.HEX(o(o({},e),{a:X(255*e.a,2)})):I.HEX(e):c?J.HEXA(e):J.HEX(e)}));case t.RGB:return h.map((function(t){var e=E(t.h,t.s,t.l);return c&&(e.a=t.a),i?I.RGB(e):c?J.RGBA(e):J.RGB(e)}));case t.HSL:return h.map((function(t){return i?I.HSL(t):c?J.HSLA(o(o({},E(t.h,t.s,t.l)),{a:t.a})):J.HSL(E(t.h,t.s,t.l))}))}},Z=((h={buildHarmony:function(e,r,n){var o=q(e),a=z(e,o),i=B(a.r,a.g,a.b,a.a),u="string"==typeof e&&C(a,"a")||"string"!=typeof e&&C(e,"a"),c="string"==typeof e;switch(o){case t.HEX:default:return u?this.HEXA(i,r,n,c):this.HEX(i,r,n,c);case t.HSL:return u?this.HSLA(i,r,n,c):this.HSL(i,r,n,c);case t.RGB:return u?this.RGBA(i,r,n,c):this.RGB(i,r,n,c)}}})[t.HEX]=function(t,e,r,n){return e(t,r).map((function(t){return n?I.HEX(E(t.h,t.s,t.l)):J.HEX(E(t.h,t.s,t.l))}))},h.HEXA=function(t,e,r,n){return e(t,r).map((function(t){return n?I.HEX(o(o({},E(t.h,t.s,t.l)),{a:255*T(t.a)})):J.HEXA(o(o({},E(t.h,t.s,t.l)),{a:T(t.a)}))}))},h[t.RGB]=function(t,e,r,n){return e(t,r).map((function(t){return n?I.RGB(E(t.h,t.s,t.l)):J.RGB(E(t.h,t.s,t.l))}))},h.RGBA=function(t,e,r,n){return e(t,r).map((function(t){return n?I.RGB(o(o({},E(t.h,t.s,t.l)),{a:T(t.a)})):J.RGBA(o(o({},E(t.h,t.s,t.l)),{a:T(t.a)}))}))},h[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}):J.HSL(E(t.h,t.s,t.l))}))},h.HSLA=function(t,e,r,n){return e(t,r).map((function(t){return n?I.HSL(o(o({},t),{a:T(t.a)})):J.HSLA(o(o({},E(t.h,t.s,t.l)),{a:T(t.a)}))}))},h),tt=((f={mix:function(t,e){var n,a,i,u,c,s,d,h,f,l,g,p,b,F,y,A=t.map((function(t){var e=q(t);return z(t,e)})),m=e===r.SUBTRACTIVE?A.map((function(t){var e,r,n,o,a,i,u,c,s,d,h,f,l,g,p=(e=t.r,r=t.g,n=t.b,o=Math.min(e,r,n),a=Math.min(255-e,255-r,255-n),i=e-o,u=r-o,c=n-o,s=Math.min(i,u),d=i-s,h=(u+s)/2,f=(c+u-s)/2,l=Math.max(d,h,f)/Math.max(i,u,c),g=isNaN(l)||l===1/0||l<=0?1:l,{r:d/g+a,y:h/g+a,b:f/g+a});return C(t,"a")&&(p.a=t.a),p})):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 a=C(n,"a")?n.a:1,i={r:Math.min(t.r+n.r*a,255),b:Math.min(t.b+n.b*a,255),a:1-(1-a)*(1-t.a)},u="g"in t?t.g:t.y,c="g"in n?n.g:n.y;return o(o({},i),e===r.ADDITIVE?{g:Math.min(u+c*a,255)}:{y:Math.min(u+c*a,255)})}),n)}if(e===r.ADDITIVE)n=E(A);else{var H=E(m);a=H.r,i=H.y,u=H.b,c=Math.min(a,i,u),s=Math.min(255-a,255-i,255-u),d=a-c,h=i-c,f=u-c,l=Math.min(h,f),g=d+h-l,p=h+2*l,b=2*(f-l),F=Math.max(g,p,b)/Math.max(d,h,f),y=isNaN(F)||F===1/0||F<=0?1:F,(n={r:g/y+s,g:p/y+s,b:b/y+s}).a=H.a}return{r:X(n.r,2),g:X(n.g,2),b:X(n.b,2),a:j(n.a,0,1)}}})[t.HEX]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?I.HEX(n):J.HEX(n)},f.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):J.HEXA(n)},f[t.RGB]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?I.RGB(n):J.RGB(n)},f.RGBA=function(t,e,r){var n=this.mix(t,e);return r?I.RGB(n):J.RGBA(n)},f[t.HSL]=function(t,e,r){var n=this.mix(t,e),o=B(n.r,n.g,n.b);return delete n.a,delete o.a,r?I.HSL(o):J.HSL(n)},f.HSLA=function(t,e,r){var n=this.mix(t,e),o=B(n.r,n.g,n.b,n.a);return r?I.HSL(o):J.HSLA(n)},f),et=function(t,e,r,n,o){var a=n(z(t,e));return r?o(a):a},rt=function(t,e,r,n,o,a){r<1&&(r=5);var i=function(t,e,r){var n=r-1,o=(e.r-t.r)/n,a=(e.g-t.g)/n,i=(e.b-t.b)/n,u=T(t.a),c=(T(e.a)-u)/n;return Array(r).fill(null).map((function(r,s){return 0===s?t:s===n?e:{r:X(t.r+o*s),g:X(t.g+a*s),b:X(t.b+i*s),a:X(u+c*s,2)}}))}(z(t),z(e),r);return i.map((function(t){var e=o(t);return n?a(e):e}))},nt=function(){function t(t){this.rgb=z(t),this.updateHSL(),this.updateCMYK()}return t.prototype.updateRGB=function(){this.rgb=o(o({},E(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},t.prototype.updateRGBFromCMYK=function(){this.rgb=o(o({},H(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},t.prototype.updateHSL=function(){this.hsl=B(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},t.prototype.updateCMYK=function(){this.cmyk=v(this.rgb.r,this.rgb.g,this.rgb.b)},t.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},t.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},t.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},t.prototype.setH=function(t){return this.hsl.h=Y(t),this.updateRGBAndCMYK()},t.prototype.setS=function(t){return this.hsl.s=j(t,0,100),this.updateRGBAndCMYK()},t.prototype.setL=function(t){return this.hsl.l=j(t,0,100),this.updateRGBAndCMYK()},t.prototype.setR=function(t){return this.rgb.r=j(t,0,255),this.updateHSLAndCMYK()},t.prototype.setG=function(t){return this.rgb.g=j(t,0,255),this.updateHSLAndCMYK()},t.prototype.setB=function(t){return this.rgb.b=j(t,0,255),this.updateHSLAndCMYK()},t.prototype.setA=function(t){return this.hsl.a=this.rgb.a=j(t,0,1),this},t.prototype.setC=function(t){return this.cmyk.c=j(t,0,100),this.updateRGBAndHSL()},t.prototype.setM=function(t){return this.cmyk.m=j(t,0,100),this.updateRGBAndHSL()},t.prototype.setY=function(t){return this.cmyk.y=j(t,0,100),this.updateRGBAndHSL()},t.prototype.setK=function(t){return this.cmyk.k=j(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(t.prototype,"H",{get:function(){return X(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"S",{get:function(){return X(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"L",{get:function(){return X(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"R",{get:function(){return X(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"G",{get:function(){return X(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"B",{get:function(){return X(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"A",{get:function(){return X(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"C",{get:function(){return X(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"M",{get:function(){return X(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Y",{get:function(){return X(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"K",{get:function(){return X(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HEXObject",{get:function(){return J.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HEXAObject",{get:function(){return J.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RGBAObject",{get:function(){return o(o({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HSLAObject",{get:function(){return o(o({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMYKAObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A}},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.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(t.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(t.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(t.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(t.prototype,"HSLA",{get:function(){return I.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMYK",{get:function(){return I.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMYKA",{get:function(){return I.CMYK(o(o({},this.cmyk),{a:this.A}))},enumerable:!1,configurable:!0}),t.toHEX=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.HEX,I.HEX)},t.toHEXA=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.HEXA,I.HEX)},t.toRGB=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.RGB,I.RGB)},t.toRGBA=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.RGBA,I.RGB)},t.toHSL=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.HSL,I.HSL)},t.toHSLA=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.HSLA,I.HSL)},t.toCMYK=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.CMYK,I.CMYK)},t.toCMYKA=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.CMYKA,I.CMYK)},t.getBlendHEX=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),rt(t,e,r,n,J.HEX,I.HEX)},t.getBlendHEXA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),rt(t,e,r,n,J.HEXA,I.HEX)},t.getBlendRGB=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),rt(t,e,r,n,J.RGB,I.RGB)},t.getBlendRGBA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),rt(t,e,r,n,J.RGBA,I.RGB)},t.getBlendHSL=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),rt(t,e,r,n,J.HSL,I.HSL)},t.getBlendHSLA=function(t,e,r,n){return void 0===r&&(r=5),void 0===n&&(n=!0),rt(t,e,r,n,J.HSLA,I.HSL)},t.getMixHEX=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),tt.HEX(t,e,n)},t.getMixHEXA=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),tt.HEXA(t,e,n)},t.getMixRGB=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),tt.RGB(t,e,n)},t.getMixRGBA=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),tt.RGBA(t,e,n)},t.getMixHSL=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),tt.HSL(t,e,n)},t.getMixHSLA=function(t,e,n){return void 0===e&&(e=r.ADDITIVE),void 0===n&&(n=!0),tt.HSLA(t,e,n)},t.getShades=function(t,e){return W(t,e,!0)},t.getTints=function(t,e){return W(t,e,!1)},t.getHarmony=function(t,n,o){switch(void 0===n&&(n=e.COMPLEMENTARY),void 0===o&&(o=r.ADDITIVE),n){case e.ANALOGOUS:return Z.buildHarmony(t,P,o);case e.SPLIT_COMPLEMENTARY:return Z.buildHarmony(t,x,o);case e.TRIADIC:return Z.buildHarmony(t,N,o);case e.TETRADIC:return Z.buildHarmony(t,V,o);case e.SQUARE:return Z.buildHarmony(t,U,o);default:return Z.buildHarmony(t,w,o)}},t}();export{nt as ColorTranslator,e as Harmony,r as Mix};

@@ -37,2 +37,3 @@ type NumberOrString = number | string;

k: number;
a?: number;
}

@@ -44,2 +45,3 @@ interface CMYKObjectGeneric {

k: NumberOrString;
a?: number;
}

@@ -101,2 +103,3 @@ type Color = RGBObjectGeneric | HSLObjectGeneric | CMYKObjectGeneric;

get CMYKObject(): CMYKObject;
get CMYKAObject(): CMYKObject;
get HEX(): string;

@@ -109,2 +112,3 @@ get HEXA(): string;

get CMYK(): string;
get CMYKA(): string;
static toHEX(color: ColorInput): string;

@@ -131,2 +135,5 @@ static toHEX(color: ColorInput, css: true): string;

static toCMYK(color: ColorInput, css: false): CMYKObject;
static toCMYKA(color: ColorInput): string;
static toCMYKA(color: ColorInput, css: true): string;
static toCMYKA(color: ColorInput, css: false): CMYKObject;
static getBlendHEX(from: ColorInput, to: ColorInput, steps?: number): string[];

@@ -133,0 +140,0 @@ static getBlendHEX(from: ColorInput, to: ColorInput, steps: number, css: true): string[];

@@ -1,1 +0,1 @@

"use strict";var t,n,r,e,o=function(){return o=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},o.apply(this,arguments)};function a(t,n,r){if(r||2===arguments.length)for(var e,o=0,a=n.length;o<a;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}!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,(n=exports.Harmony||(exports.Harmony={})).ANALOGOUS="ANALOGOUS",n.COMPLEMENTARY="COMPLEMENTARY",n.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",n.TRIADIC="TRIADIC",n.TETRADIC="TETRADIC",n.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"}(e||(e={}));var c,i,u,s,d,l,h,f,p=Object.keys(e),g="".concat("[a-f\\d]","{2}"),b="".concat("\\s*",",").concat("\\s*"),F=function(t,n){void 0===n&&(n=!1);var r=t.replace(/\s*/gm,"");return n?new RegExp(r,"i"):new RegExp(r)},A=((c={})[t.HEX]="\n ^#(?:\n (".concat("[a-f\\d]",")\n (").concat("[a-f\\d]",")\n (").concat("[a-f\\d]",")\n (").concat("[a-f\\d]",")?\n |\n (").concat(g,")\n (").concat(g,")\n (").concat(g,")\n (").concat(g,")?\n )$\n "),c[t.RGB]="\n ^rgb".concat("\\s*","\\(\n ").concat("\\s*","\n (?:\n (").concat("\\d+%",")\n ").concat(b,"\n (").concat("\\d+%",")\n ").concat(b,"\n (").concat("\\d+%",")\n |\n (").concat("\\d+",")\n ").concat(b,"\n (").concat("\\d+",")\n ").concat(b,"\n (").concat("\\d+",")\n )\n ").concat("\\s*","\n \\)$\n "),c[t.RGBA]="\n ^rgba".concat("\\s*","\\(\n ").concat("\\s*","\n (?:\n (").concat("\\d+%",")\n ").concat(b,"\n (").concat("\\d+%",")\n ").concat(b,"\n (").concat("\\d+%",")\n |\n (").concat("\\d+",")\n ").concat(b,"\n (").concat("\\d+",")\n ").concat(b,"\n (").concat("\\d+",")\n )\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat("\\s*","\n \\)$\n "),c[t.HSL]="\n ^hsl".concat("\\s*","\\(\n ").concat("\\s*","\n (-?").concat("\\d+\\.?\\d*",")\n ").concat(b,"\n (").concat("\\d+\\.?\\d*",")%\n ").concat(b,"\n (").concat("\\d+\\.?\\d*",")%\n ").concat("\\s*","\n \\)$\n "),c[t.HSLA]="\n ^hsla".concat("\\s*","\\(\n ").concat("\\s*","\n (-?").concat("\\d+\\.?\\d*",")\n ").concat(b,"\n (").concat("\\d+\\.?\\d*",")%\n ").concat(b,"\n (").concat("\\d+\\.?\\d*",")%\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat("\\s*","\n \\)$\n "),c[t.CMYK]="\n ^(?:device-cmyk|cmyk)\n ".concat("\\s*","\n \\(").concat("\\s*","\n (?:\n (").concat("\\d+\\.?\\d*","%)\n ").concat(b,"\n (").concat("\\d+\\.?\\d*","%)\n ").concat(b,"\n (").concat("\\d+\\.?\\d*","%)\n ").concat(b,"\n (").concat("\\d+\\.?\\d*","%)\n |\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n ").concat(b,"\n (").concat("(?:\\d?\\.)?\\d*",")\n )\n ").concat("\\s*","\n \\)$\n "),c),m=((i={})[t.HEX]=F(A.HEX,!0),i[t.RGB]=F(A.RGB),i[t.RGBA]=F(A.RGBA),i[t.HSL]=F(A.HSL),i[t.HSLA]=F(A.HSLA),i[t.CMYK]=F(A.CMYK),i),y=/^(\d+(?:\.\d+)?|\.\d+)%$/,H=/^0x([a-f\d]{1,2})$/i,E="The provided string color doesn't have a correct format",B="The provided color object doesn't have the proper keys or format",v=function(t,n,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?Math.round(255*((n-t)*r+t)):r<3?Math.round(255*n):r<4?Math.round(255*((n-t)*(4-r)+t)):Math.round(255*t)},M=function(t,n,r){n/=100;var e=(r/=100)<=.5?r*(n+1):r+n-r*n,o=2*r-e;return{r:v(o,e,(t/=60)+2),g:v(o,e,t),b:v(o,e,t-2)}},R=function(t,n,r,e){return e=1-e,{r:Math.round(255*(1-t)*e),g:Math.round(255*(1-n)*e),b:Math.round(255*(1-r)*e)}},S=function(t,n,r){t/=255,n/=255,r/=255;var e=1-Math.max(t,n,r),o=1-e,a=(o-t)/o,c=(o-n)/o,i=(o-r)/o;return{c:Math.round(100*a),m:Math.round(100*c),y:Math.round(100*i),k:Math.round(100*e)}},C=function(t,n,r,e){void 0===e&&(e=1),t/=255,n/=255,r/=255,e=Math.min(e,1);var o=Math.max(t,n,r),a=Math.min(t,n,r),c=o-a,i=0,u=0,s=(o+a)/2;if(0===c)i=0,u=0;else{switch(o){case t:i=(n-r)/c%6;break;case n:i=(r-t)/c+2;break;case r:i=(t-n)/c+4}(i=Math.round(60*i))<0&&(i+=360),u=c/(1-Math.abs(2*s-1))}return{h:i,s:Math.round(100*u),l:Math.round(100*s),a:e}},L=function(t,n){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]],e=[[0,60],[60,120],[120,240],[240,360]],o=n?e:r,a=0,c=0,i=0,u=0;return(n?r:e).find((function(n,r){return t>=n[0]&&t<n[1]&&(a=n[0],c=n[1],i=o[r][0],u=o[r][1],!0)})),i+(u-i)/(c-a)*(t-a)},D=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},G=function(t){return y.test("".concat(t))?+"".concat(t).replace(y,"$1"):Math.min(+t,100)},x=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},k=function(t){var n=parseInt("".concat(t)).toString(16).toUpperCase();return 1===n.length?"0x0".concat(n):"0x".concat(n)},X=function(t){var n=parseInt("".concat(t)).toString(16).toUpperCase();return 1===n.length&&(n="0".concat(n)),n},O=function(t,n){return void 0===n&&(n=!1),!n&&y.test(t)?Math.min(255*+t.replace(y,"$1")/100,255):H.test(t)?3===t.length?n?parseInt(t+t.slice(-1))/255:parseInt(t+t.slice(-1)):n?parseInt(t)/255:parseInt(t):Math.min(+t,n?1:255)},I=function(t){return Math.min(y.test(t)?+t.replace(y,"$1")/100:+t,1)},j=function(t){return t.sort().join().toUpperCase()},T=function(t,n){void 0===n&&(n=0);var r=Math.pow(10,n);return Math.round(+t*r)/r},Y=function(t,n,r){return Math.max(n,Math.min(t,r))},w=((u={})[t.HEX]=function(t){return"#".concat(X(t.r)).concat(X(t.g)).concat(X(t.b)).concat(D(t,"a")&&X(t.a)||"")},u[t.RGB]=function(t){return"rgb".concat(D(t,"a")?"a":"","(").concat(T(t.r),",").concat(T(t.g),",").concat(T(t.b)).concat(D(t,"a")&&",".concat(T(t.a,2))||"",")")},u[t.HSL]=function(t){return"hsl".concat(D(t,"a")?"a":"","(").concat(T(t.h),",").concat(T(t.s),"%,").concat(T(t.l),"%").concat(D(t,"a")&&",".concat(T(t.a,2))||"",")")},u[t.CMYK]=function(t){return"cmyk(".concat(T(t.c),"%,").concat(T(t.m),"%,").concat(T(t.y),"%,").concat(T(t.k),"%)")},u),P=function(t){return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},K=function(t){return isNaN(+t)||t>1?1:T(t,2)},N=function(t,n,r){return n.reduce((function(n,e){return a(a([],n,!0),[o(o({},t),{h:r===exports.Mix.ADDITIVE?P(t.h+e):P(L(L(t.h,!1)+e,!0))})],!1)}),[o({},t)])},V=function(t,n){return N(t,[30,-30],n)},U=function(t,n){return N(t,[180],n)},$=function(t,n){return N(t,[150,-150],n)},q=function(t,n){return N(t,[120,-120],n)},Q=function(t,n){return N(t,[60,-120,180],n)},_=function(t,n){return N(t,[90,-90,180],n)},z=function(n){return"string"==typeof n?function(n){var r;if(Object.keys(t).some((function(t){if(m[t].test(n))return r=t,!0})),!r&&~p.indexOf(n)&&(r=t.HEX),!r)throw new Error(E);return r}(n):function(n){var r,e=!1,o=j(Object.keys(n));if(Object.keys(t).filter((function(n){return n!==t.HEX})).some((function(t){if(j(t.split(""))===o)return r=t,!0})),r&&r===t.RGB||r===t.RGBA){var a=Object.entries(n).map((function(t){return H.test("".concat(t[1]))})),c=Object.entries(n).map((function(t){return y.test("".concat(t[1]))||!H.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255})),i=a.some((function(t,n){return n>0&&t!==a[n-1]})),u=c.some((function(t,n){return n>0&&t!==c[n-1]}));!(e=i||u||!a[0]&&!c[0])&&a[0]&&(r=t.HEX)}if(!r||e)throw new Error(B);return r}(n)},J=((s={})[t.HEX]=function(t){var n=(~p.indexOf(t)?e[t]:t).match(m.HEX),r={r:x(n[1]||n[5]),g:x(n[2]||n[6]),b:x(n[3]||n[7])},o=n[4]||n[8];return void 0!==o&&(r.a=x(o)/255),r},s[t.RGB]=function(t){var n=t.match(m.RGB),r=O(n[1]||n[4]),e=O(n[2]||n[5]),o=O(n[3]||n[6]);return{r:Math.min(r,255),g:Math.min(e,255),b:Math.min(o,255)}},s[t.RGBA]=function(t){var n=t.match(m.RGBA),r=O(n[1]||n[4]),e=O(n[2]||n[5]),o=O(n[3]||n[6]),a=+n[7];return{r:Math.min(r,255),g:Math.min(e,255),b:Math.min(o,255),a:K(a)}},s[t.HSL]=function(t){var n=t.match(m.HSL),r=P(+n[1]),e=G(n[2]),o=G(n[3]);return M(r,e,o)},s[t.HSLA]=function(t){var n=t.match(m.HSLA),r=P(+n[1]),e=G(n[2]),o=G(n[3]),a=+n[4],c=M(r,e,o);return c.a=K(a),c},s[t.CMYK]=function(t){var n=t.match(m.CMYK),r=I(n[1]||n[5]),e=I(n[2]||n[6]),o=I(n[3]||n[7]),a=I(n[4]||n[8]);return R(r,e,o,a)},s),W=((d={})[t.HEX]=function(t){var n={r:O("".concat(t.r)),g:O("".concat(t.g)),b:O("".concat(t.b))};return n.a=D(t,"a")?Math.min(O("".concat(t.a),!0),1):1,n},d[t.RGB]=function(t){var n=this.HEX(t);return delete n.a,n},d[t.RGBA]=function(t){return this.HEX(t)},d[t.HSL]=function(t){var n=G("".concat(t.s)),r=G("".concat(t.l));return M(P(t.h),n,r)},d[t.HSLA]=function(t){var n=this.HSL(t);return n.a=K(t.a),n},d[t.CMYK]=function(t){var n=I("".concat(t.c)),r=I("".concat(t.m)),e=I("".concat(t.y)),o=I("".concat(t.k));return R(n,r,e,o)},d),Z=function(t,n){return void 0===n&&(n=z(t)),"string"==typeof t?J[n](t):W[n](t)},tt=((l={})[t.HEX]=function(t){return{r:k(t.r),g:k(t.g),b:k(t.b)}},l.HEXA=function(t){var n=tt.HEX(t);return n.a=D(t,"a")?k(255*t.a):"0xFF",n},l[t.RGB]=function(t){return D(t,"a")&&delete t.a,t},l[t.RGBA]=function(t){return t.a=D(t,"a")?T(t.a,2):1,t},l[t.HSL]=function(t){var n=C(t.r,t.g,t.b);return delete n.a,n},l[t.HSLA]=function(t){var n=tt.HSL(t);return n.a=D(t,"a")?T(t.a,2):1,n},l[t.CMYK]=function(t){return S(t.r,t.g,t.b)},l),nt=function(n,r,e){var a=z(n),c="string"==typeof n,i=Z(n,a),u="string"==typeof n&&D(i,"a")||"string"!=typeof n&&D(n,"a"),s=C(i.r,i.g,i.b,i.a);u||delete s.a;var d=e?s.l/(r+1):(100-s.l)/(r+1),l=Array(r).fill(null).map((function(t,n){return o(o({},s),{l:s.l+d*(n+1)*(1-2*+e)})}));switch(a){case t.HEX:default:return l.map((function(t){var n=M(t.h,t.s,t.l);return u&&(n.a=t.a),c?u?w.HEX(o(o({},n),{a:T(255*n.a,2)})):w.HEX(n):u?tt.HEXA(n):tt.HEX(n)}));case t.RGB:case t.RGBA:return l.map((function(t){var n=M(t.h,t.s,t.l);return u&&(n.a=t.a),c?w.RGB(n):u?tt.RGBA(n):tt.RGB(n)}));case t.HSL:case t.HSLA:return l.map((function(t){return c?w.HSL(t):u?tt.HSLA(o(o({},M(t.h,t.s,t.l)),{a:t.a})):tt.HSL(M(t.h,t.s,t.l))}))}},rt=((h={buildHarmony:function(n,r,e){var o=z(n),a=Z(n,o),c=C(a.r,a.g,a.b,a.a),i="string"==typeof n&&D(a,"a")||"string"!=typeof n&&D(n,"a"),u="string"==typeof n;switch(o){case t.HEX:default:return i?this.HEXA(c,r,e,u):this.HEX(c,r,e,u);case t.HSL:return this.HSL(c,r,e,u);case t.HSLA:return this.HSLA(c,r,e,u);case t.RGB:return this.RGB(c,r,e,u);case t.RGBA:return this.RGBA(c,r,e,u)}}})[t.HEX]=function(t,n,r,e){return n(t,r).map((function(t){return e?w.HEX(M(t.h,t.s,t.l)):tt.HEX(M(t.h,t.s,t.l))}))},h.HEXA=function(t,n,r,e){return n(t,r).map((function(t){return e?w.HEX(o(o({},M(t.h,t.s,t.l)),{a:255*K(t.a)})):tt.HEXA(o(o({},M(t.h,t.s,t.l)),{a:K(t.a)}))}))},h[t.RGB]=function(t,n,r,e){return n(t,r).map((function(t){return e?w.RGB(M(t.h,t.s,t.l)):tt.RGB(M(t.h,t.s,t.l))}))},h[t.RGBA]=function(t,n,r,e){return n(t,r).map((function(t){return e?w.RGB(o(o({},M(t.h,t.s,t.l)),{a:K(t.a)})):tt.RGBA(o(o({},M(t.h,t.s,t.l)),{a:K(t.a)}))}))},h[t.HSL]=function(t,n,r,e){return n(t,r).map((function(t){return e?w.HSL({h:t.h,s:t.s,l:t.l}):tt.HSL(M(t.h,t.s,t.l))}))},h[t.HSLA]=function(t,n,r,e){return n(t,r).map((function(t){return e?w.HSL(o(o({},t),{a:K(t.a)})):tt.HSLA(o(o({},M(t.h,t.s,t.l)),{a:K(t.a)}))}))},h),et=((f={mix:function(t,n){var r,e,a,c,i,u,s,d,l,h,f,p,g,b,F,A=t.map((function(t){var n=z(t);return Z(t,n)})),m=n===exports.Mix.SUBTRACTIVE?A.map((function(t){var n,r,e,o,a,c,i,u,s,d,l,h,f,p,g=(n=t.r,r=t.g,e=t.b,o=Math.min(n,r,e),a=Math.min(255-n,255-r,255-e),c=n-o,i=r-o,u=e-o,s=Math.min(c,i),d=c-s,l=(i+s)/2,h=(u+i-s)/2,f=Math.max(d,l,h)/Math.max(c,i,u),p=isNaN(f)||f===1/0||f<=0?1:f,{r:d/p+a,y:l/p+a,b:h/p+a});return D(t,"a")&&(g.a=t.a),g})):null;function y(t){var r=n===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 e=D(r,"a")?r.a:1,a={r:Math.min(t.r+r.r*e,255),b:Math.min(t.b+r.b*e,255),a:1-(1-e)*(1-t.a)},c="g"in t?t.g:t.y,i="g"in r?r.g:r.y;return o(o({},a),n===exports.Mix.ADDITIVE?{g:Math.min(c+i*e,255)}:{y:Math.min(c+i*e,255)})}),r)}if(n===exports.Mix.ADDITIVE)r=y(A);else{var H=y(m);e=H.r,a=H.y,c=H.b,i=Math.min(e,a,c),u=Math.min(255-e,255-a,255-c),s=e-i,d=a-i,l=c-i,h=Math.min(d,l),f=s+d-h,p=d+2*h,g=2*(l-h),b=Math.max(f,p,g)/Math.max(s,d,l),F=isNaN(b)||b===1/0||b<=0?1:b,(r={r:f/F+u,g:p/F+u,b:g/F+u}).a=H.a}return{r:T(r.r,2),g:T(r.g,2),b:T(r.b,2),a:Y(r.a,0,1)}}})[t.HEX]=function(t,n,r){var e=this.mix(t,n);return delete e.a,r?w.HEX(e):tt.HEX(e)},f.HEXA=function(t,n,r){var e=this.mix(t,n);return e.a=r?255*K(e.a):K(e.a),r?w.HEX(e):tt.HEXA(e)},f[t.RGB]=function(t,n,r){var e=this.mix(t,n);return delete e.a,r?w.RGB(e):tt.RGB(e)},f[t.RGBA]=function(t,n,r){var e=this.mix(t,n);return r?w.RGB(e):tt.RGBA(e)},f[t.HSL]=function(t,n,r){var e=this.mix(t,n),o=C(e.r,e.g,e.b);return delete e.a,delete o.a,r?w.HSL(o):tt.HSL(e)},f[t.HSLA]=function(t,n,r){var e=this.mix(t,n),o=C(e.r,e.g,e.b,e.a);return r?w.HSL(o):tt.HSLA(e)},f),ot=function(t,n){return"string"==typeof t&&n||"object"==typeof t&&!n},at=function(t,n,r,e,o){var a=e(Z(t,n));return r?o(a):a},ct=function(t,n,r,e,o,a){r<1&&(r=5);var c=function(t,n,r){var e=r-1,o=(n.r-t.r)/e,a=(n.g-t.g)/e,c=(n.b-t.b)/e,i=K(t.a),u=(K(n.a)-i)/e;return Array(r).fill(null).map((function(r,s){return 0===s?t:s===e?n:{r:T(t.r+o*s),g:T(t.g+a*s),b:T(t.b+c*s),a:T(i+u*s,2)}}))}(Z(t),Z(n),r);return c.map((function(t){var n=o(t);return e?a(n):n}))},it=function(){function n(t){this.rgb=Z(t),this.updateHSL(),this.updateCMYK()}return n.prototype.updateRGB=function(){this.rgb=o(o({},M(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},n.prototype.updateRGBFromCMYK=function(){this.rgb=o(o({},R(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},n.prototype.updateHSL=function(){this.hsl=C(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},n.prototype.updateCMYK=function(){this.cmyk=S(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=P(t),this.updateRGBAndCMYK()},n.prototype.setS=function(t){return this.hsl.s=Y(t,0,100),this.updateRGBAndCMYK()},n.prototype.setL=function(t){return this.hsl.l=Y(t,0,100),this.updateRGBAndCMYK()},n.prototype.setR=function(t){return this.rgb.r=Y(t,0,255),this.updateHSLAndCMYK()},n.prototype.setG=function(t){return this.rgb.g=Y(t,0,255),this.updateHSLAndCMYK()},n.prototype.setB=function(t){return this.rgb.b=Y(t,0,255),this.updateHSLAndCMYK()},n.prototype.setA=function(t){return this.hsl.a=this.rgb.a=Y(t,0,1),this},n.prototype.setC=function(t){return this.cmyk.c=Y(t,0,100),this.updateRGBAndHSL()},n.prototype.setM=function(t){return this.cmyk.m=Y(t,0,100),this.updateRGBAndHSL()},n.prototype.setY=function(t){return this.cmyk.y=Y(t,0,100),this.updateRGBAndHSL()},n.prototype.setK=function(t){return this.cmyk.k=Y(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(n.prototype,"H",{get:function(){return T(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"S",{get:function(){return T(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"L",{get:function(){return T(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"R",{get:function(){return T(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"G",{get:function(){return T(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"B",{get:function(){return T(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"A",{get:function(){return T(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"C",{get:function(){return T(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"M",{get:function(){return T(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"Y",{get:function(){return T(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"K",{get:function(){return T(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HEXObject",{get:function(){return tt.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HEXAObject",{get:function(){return tt.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 o(o({},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 o(o({},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,n={r:t.r,g:t.g,b:t.b};return w.HEX(n)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HEXA",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b,a:255*this.A};return w.HEX(n)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGB",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b};return w.RGB(n)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGBA",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b,a:this.A};return w.RGB(n)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HSL",{get:function(){var t=this.hsl,n={h:t.h,s:t.s,l:t.l};return w.HSL(n)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"HSLA",{get:function(){return w.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"CMYK",{get:function(){return w.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),n.toHEX=function(t,n){void 0===n&&(n=!0);var r=z(t);return at(t,r,n,tt.HEX,w.HEX)},n.toHEXA=function(t,n){void 0===n&&(n=!0);var r=z(t);return at(t,r,n,tt.HEXA,w.HEX)},n.toRGB=function(t,n){void 0===n&&(n=!0);var r=z(t);return at(t,r,n,tt.RGB,w.RGB)},n.toRGBA=function(t,n){void 0===n&&(n=!0);var r=z(t);return at(t,r,n,tt.RGBA,w.RGB)},n.toHSL=function(n,r){void 0===r&&(r=!0);var e=z(n);return e===t.HSL&&ot(n,r)?n:at(n,e,r,tt.HSL,w.HSL)},n.toHSLA=function(n,r){void 0===r&&(r=!0);var e=z(n);return e===t.HSLA&&ot(n,r)?n:at(n,e,r,tt.HSLA,w.HSL)},n.toCMYK=function(n,r){void 0===r&&(r=!0);var e=z(n);return e===t.CMYK&&ot(n,r)?n:at(n,e,r,tt.CMYK,w.CMYK)},n.getBlendHEX=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),ct(t,n,r,e,tt.HEX,w.HEX)},n.getBlendHEXA=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),ct(t,n,r,e,tt.HEXA,w.HEX)},n.getBlendRGB=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),ct(t,n,r,e,tt.RGB,w.RGB)},n.getBlendRGBA=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),ct(t,n,r,e,tt.RGBA,w.RGB)},n.getBlendHSL=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),ct(t,n,r,e,tt.HSL,w.HSL)},n.getBlendHSLA=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),ct(t,n,r,e,tt.HSLA,w.HSL)},n.getMixHEX=function(t,n,r){return void 0===n&&(n=exports.Mix.ADDITIVE),void 0===r&&(r=!0),et.HEX(t,n,r)},n.getMixHEXA=function(t,n,r){return void 0===n&&(n=exports.Mix.ADDITIVE),void 0===r&&(r=!0),et.HEXA(t,n,r)},n.getMixRGB=function(t,n,r){return void 0===n&&(n=exports.Mix.ADDITIVE),void 0===r&&(r=!0),et.RGB(t,n,r)},n.getMixRGBA=function(t,n,r){return void 0===n&&(n=exports.Mix.ADDITIVE),void 0===r&&(r=!0),et.RGBA(t,n,r)},n.getMixHSL=function(t,n,r){return void 0===n&&(n=exports.Mix.ADDITIVE),void 0===r&&(r=!0),et.HSL(t,n,r)},n.getMixHSLA=function(t,n,r){return void 0===n&&(n=exports.Mix.ADDITIVE),void 0===r&&(r=!0),et.HSLA(t,n,r)},n.getShades=function(t,n){return nt(t,n,!0)},n.getTints=function(t,n){return nt(t,n,!1)},n.getHarmony=function(t,n,r){switch(void 0===n&&(n=exports.Harmony.COMPLEMENTARY),void 0===r&&(r=exports.Mix.ADDITIVE),n){case exports.Harmony.ANALOGOUS:return rt.buildHarmony(t,V,r);case exports.Harmony.SPLIT_COMPLEMENTARY:return rt.buildHarmony(t,$,r);case exports.Harmony.TRIADIC:return rt.buildHarmony(t,q,r);case exports.Harmony.TETRADIC:return rt.buildHarmony(t,Q,r);case exports.Harmony.SQUARE:return rt.buildHarmony(t,_,r);default:return rt.buildHarmony(t,U,r)}},n}();exports.ColorTranslator=it;
"use strict";var t,r,e,n,o=function(){return o=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},o.apply(this,arguments)};function i(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",t.CMYK="CMYK"}(t||(t={})),exports.Harmony=void 0,(r=exports.Harmony||(exports.Harmony={})).ANALOGOUS="ANALOGOUS",r.COMPLEMENTARY="COMPLEMENTARY",r.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",r.TRIADIC="TRIADIC",r.TETRADIC="TETRADIC",r.SQUARE="SQUARE",exports.Mix=void 0,(e=exports.Mix||(exports.Mix={})).ADDITIVE="ADDITIVE",e.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,c,s,d,l,h,f=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]=/^rgba?\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,a[t.HSL]=/^hsla?\s*\(\s*(?:(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*,\s*((?:\d*\.)?\d+)%\s*,\s*((?:\d*\.)?\d+)%(?:\s*,\s*((?:\d*\.)?\d+))?|(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*((?:\d*\.)?\d+)%\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+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,a),g=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,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)},E=function(t,r,e){r/=100;var n=(e/=100)<=.5?e*(r+1):e+r-e*r,o=2*e-n;return{r:A(o,n,(t/=60)+2),g:A(o,n,t),b:A(o,n,t-2)}},H=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)}},v=function(t,r,e){t/=255,r/=255,e/=255;var n=1-Math.max(t,r,e),o=1-n,i=(o-t)/o,a=(o-r)/o,u=(o-e)/o;return{c:Math.round(100*i),m:Math.round(100*a),y:Math.round(100*u),k:Math.round(100*n)}},B=function(t,r,e,n){void 0===n&&(n=1),t/=255,r/=255,e/=255,n=Math.min(n,1);var o=Math.max(t,r,e),i=Math.min(t,r,e),a=o-i,u=0,c=0,s=(o+i)/2;if(0===a)u=0,c=0;else{switch(o){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),c=a/(1-Math.abs(2*s-1))}return{h:u,s:Math.round(100*c),l:Math.round(100*s),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]],o=r?n:e,i=0,a=0,u=0,c=0;return(r?e:n).find((function(r,e){return t>=r[0]&&t<r[1]&&(i=r[0],a=r[1],u=o[e][0],c=o[e][1],!0)})),u+(c-u)/(a-i)*(t-i)},C=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},D=function(t){return b.test("".concat(t))?+"".concat(t).replace(b,"$1"):Math.min(+t,100)},R=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},S=function(t){var r=parseInt("".concat(t)).toString(16).toUpperCase();return 1===r.length?"0x0".concat(r):"0x".concat(r)},L=function(t){var r=parseInt("".concat(t)).toString(16).toUpperCase();return 1===r.length&&(r="0".concat(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)},x=function(t){return t.sort().join("").toUpperCase()},O=function(t,r){void 0===r&&(r=0);var e=Math.pow(10,r);return Math.round(+t*e)/e},X=function(t,r,e){return Math.max(r,Math.min(t,e))},j=((u={})[t.HEX]=function(t){return"#".concat(L(t.r)).concat(L(t.g)).concat(L(t.b)).concat(C(t,"a")&&L(t.a)||"")},u[t.RGB]=function(t){return"rgb".concat(C(t,"a")?"a":"","(").concat(O(t.r),",").concat(O(t.g),",").concat(O(t.b)).concat(C(t,"a")&&",".concat(O(t.a,2))||"",")")},u[t.HSL]=function(t){return"hsl".concat(C(t,"a")?"a":"","(").concat(O(t.h),",").concat(O(t.s),"%,").concat(O(t.l),"%").concat(C(t,"a")&&",".concat(O(t.a,2))||"",")")},u[t.CMYK]=function(t){return"cmyk(".concat(O(t.c),"%,").concat(O(t.m),"%,").concat(O(t.y),"%,").concat(O(t.k),"%").concat(C(t,"a")&&",".concat(O(t.a,2))||"",")")},u),I=function(t){if("string"==typeof t){var r=t.match(g),e=+r[1];switch(r[2]){case"rad":t=Math.round(180*e/Math.PI);break;case"turn":t=Math.round(360*e);break;default:t=e}}return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},Y=function(t){return"string"==typeof t&&(t=b.test(t)?+t.replace(b,"$1")/100:+t),isNaN(+t)||t>1?1:O(t,2)},T=function(t,r,e){return r.reduce((function(r,n){return i(i([],r,!0),[o(o({},t),{h:e===exports.Mix.ADDITIVE?I(t.h+n):I(M(M(t.h,!1)+n,!0))})],!1)}),[o({},t)])},K=function(t,r){return T(t,[30,-30],r)},P=function(t,r){return T(t,[180],r)},w=function(t,r){return T(t,[150,-150],r)},N=function(t,r){return T(t,[120,-120],r)},V=function(t,r){return T(t,[60,-120,180],r)},U=function(t,r){return T(t,[90,-90,180],r)},$=Object.entries(t).reduce((function(r,e){var n=e[0],o=e[1];if(n!==t.HEX){var i=x(n.split(""));r[i]=o,r["A"+i]=o}return r}),{}),q=function(r){return"string"==typeof r?function(r){var e;if(Object.keys(t).some((function(t){if(p[t].test(r))return e=t,!0})),!e&&~f.indexOf(r)&&(e=t.HEX),!e)throw new Error(y);return e}(r):function(r){var e,n=!1,o=x(Object.keys(r));if($[o]&&(e=$[o]),e&&e===t.RGB){var i=Object.entries(r).some((function(t){return!F.test("".concat(t[1]))})),a=Object.entries(r).some((function(t){return!(b.test("".concat(t[1]))||!F.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255)}));i&&a&&(n=!0),i||(e=t.HEX)}if(!e||n)throw new Error(m);return e}(r)},Q=((c={})[t.HEX]=function(t){var r=(~f.indexOf(t)?n[t]:t).match(p.HEX),e={r:R(r[1]||r[5]),g:R(r[2]||r[6]),b:R(r[3]||r[7])},o=r[4]||r[8];return void 0!==o&&(e.a=R(o)/255),e},c[t.RGB]=function(t){var r=t.match(p.RGB),e=G(r[1]||r[5]),n=G(r[2]||r[6]),o=G(r[3]||r[7]),i=r[4]||r[8],a={r:Math.min(e,255),g:Math.min(n,255),b:Math.min(o,255)};return void 0!==i&&(a.a=Y(i)),a},c[t.HSL]=function(t){var r=t.match(p.HSL),e=I(r[1]||r[5]),n=D(r[2]||r[6]),o=D(r[3]||r[7]),i=r[4]||r[8],a=E(e,n,o);return void 0!==i&&(a.a=Y(i)),a},c[t.CMYK]=function(t){var r=t.match(p.CMYK),e=k(r[1]||r[6]),n=k(r[2]||r[7]),o=k(r[3]||r[8]),i=k(r[4]||r[9]),a=r[5]||r[10],u=H(e,n,o,i);return void 0!==a&&(u.a=Y(a)),u},c),_=((s={})[t.HEX]=function(t){var r={r:G("".concat(t.r)),g:G("".concat(t.g)),b:G("".concat(t.b))};return C(t,"a")&&(r.a=Math.min(G("".concat(t.a),!0),1)),r},s[t.RGB]=function(t){return this.HEX(t)},s[t.HSL]=function(t){var r=D("".concat(t.s)),e=D("".concat(t.l)),n=E(I(t.h),r,e);return C(t,"a")&&(n.a=Y(t.a)),n},s[t.CMYK]=function(t){var r=k("".concat(t.c)),e=k("".concat(t.m)),n=k("".concat(t.y)),o=k("".concat(t.k)),i=H(r,e,n,o);return C(t,"a")&&(i.a=Y(t.a)),i},s),z=function(t,r){return void 0===r&&(r=q(t)),"string"==typeof t?Q[r](t):_[r](t)},J=((d={})[t.HEX]=function(t){return{r:S(t.r),g:S(t.g),b:S(t.b)}},d.HEXA=function(t){var r=J.HEX(t);return r.a=C(t,"a")?S(255*t.a):"0xFF",r},d[t.RGB]=function(t){return C(t,"a")&&delete t.a,t},d.RGBA=function(t){return t.a=C(t,"a")?O(t.a,2):1,t},d[t.HSL]=function(t){var r=B(t.r,t.g,t.b);return delete r.a,r},d.HSLA=function(t){var r=J.HSL(t);return r.a=C(t,"a")?O(t.a,2):1,r},d[t.CMYK]=function(t){return v(t.r,t.g,t.b)},d.CMYKA=function(t){var r=v(t.r,t.g,t.b);return r.a=C(t,"a")?O(t.a,2):1,r},d),W=function(r,e,n){var i=q(r),a="string"==typeof r,u=z(r,i),c="string"==typeof r&&C(u,"a")||"string"!=typeof r&&C(r,"a"),s=B(u.r,u.g,u.b,u.a);c||delete s.a;var d=n?s.l/(e+1):(100-s.l)/(e+1),l=Array(e).fill(null).map((function(t,r){return o(o({},s),{l:s.l+d*(r+1)*(1-2*+n)})}));switch(i){case t.HEX:default:return l.map((function(t){var r=E(t.h,t.s,t.l);return c&&(r.a=t.a),a?c?j.HEX(o(o({},r),{a:O(255*r.a,2)})):j.HEX(r):c?J.HEXA(r):J.HEX(r)}));case t.RGB:return l.map((function(t){var r=E(t.h,t.s,t.l);return c&&(r.a=t.a),a?j.RGB(r):c?J.RGBA(r):J.RGB(r)}));case t.HSL:return l.map((function(t){return a?j.HSL(t):c?J.HSLA(o(o({},E(t.h,t.s,t.l)),{a:t.a})):J.HSL(E(t.h,t.s,t.l))}))}},Z=((l={buildHarmony:function(r,e,n){var o=q(r),i=z(r,o),a=B(i.r,i.g,i.b,i.a),u="string"==typeof r&&C(i,"a")||"string"!=typeof r&&C(r,"a"),c="string"==typeof r;switch(o){case t.HEX:default:return u?this.HEXA(a,e,n,c):this.HEX(a,e,n,c);case t.HSL:return u?this.HSLA(a,e,n,c):this.HSL(a,e,n,c);case t.RGB:return u?this.RGBA(a,e,n,c):this.RGB(a,e,n,c)}}})[t.HEX]=function(t,r,e,n){return r(t,e).map((function(t){return n?j.HEX(E(t.h,t.s,t.l)):J.HEX(E(t.h,t.s,t.l))}))},l.HEXA=function(t,r,e,n){return r(t,e).map((function(t){return n?j.HEX(o(o({},E(t.h,t.s,t.l)),{a:255*Y(t.a)})):J.HEXA(o(o({},E(t.h,t.s,t.l)),{a:Y(t.a)}))}))},l[t.RGB]=function(t,r,e,n){return r(t,e).map((function(t){return n?j.RGB(E(t.h,t.s,t.l)):J.RGB(E(t.h,t.s,t.l))}))},l.RGBA=function(t,r,e,n){return r(t,e).map((function(t){return n?j.RGB(o(o({},E(t.h,t.s,t.l)),{a:Y(t.a)})):J.RGBA(o(o({},E(t.h,t.s,t.l)),{a:Y(t.a)}))}))},l[t.HSL]=function(t,r,e,n){return r(t,e).map((function(t){return n?j.HSL({h:t.h,s:t.s,l:t.l}):J.HSL(E(t.h,t.s,t.l))}))},l.HSLA=function(t,r,e,n){return r(t,e).map((function(t){return n?j.HSL(o(o({},t),{a:Y(t.a)})):J.HSLA(o(o({},E(t.h,t.s,t.l)),{a:Y(t.a)}))}))},l),tt=((h={mix:function(t,r){var e,n,i,a,u,c,s,d,l,h,f,p,g,b,F,y=t.map((function(t){var r=q(t);return z(t,r)})),m=r===exports.Mix.SUBTRACTIVE?y.map((function(t){var r,e,n,o,i,a,u,c,s,d,l,h,f,p,g=(r=t.r,e=t.g,n=t.b,o=Math.min(r,e,n),i=Math.min(255-r,255-e,255-n),a=r-o,u=e-o,c=n-o,s=Math.min(a,u),d=a-s,l=(u+s)/2,h=(c+u-s)/2,f=Math.max(d,l,h)/Math.max(a,u,c),p=isNaN(f)||f===1/0||f<=0?1:f,{r:d/p+i,y:l/p+i,b:h/p+i});return C(t,"a")&&(g.a=t.a),g})):null;function A(t){var e=r===exports.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return t.reduce((function(t,e){var n=C(e,"a")?e.a:1,i={r:Math.min(t.r+e.r*n,255),b:Math.min(t.b+e.b*n,255),a:1-(1-n)*(1-t.a)},a="g"in t?t.g:t.y,u="g"in e?e.g:e.y;return o(o({},i),r===exports.Mix.ADDITIVE?{g:Math.min(a+u*n,255)}:{y:Math.min(a+u*n,255)})}),e)}if(r===exports.Mix.ADDITIVE)e=A(y);else{var E=A(m);n=E.r,i=E.y,a=E.b,u=Math.min(n,i,a),c=Math.min(255-n,255-i,255-a),s=n-u,d=i-u,l=a-u,h=Math.min(d,l),f=s+d-h,p=d+2*h,g=2*(l-h),b=Math.max(f,p,g)/Math.max(s,d,l),F=isNaN(b)||b===1/0||b<=0?1:b,(e={r:f/F+c,g:p/F+c,b:g/F+c}).a=E.a}return{r:O(e.r,2),g:O(e.g,2),b:O(e.b,2),a:X(e.a,0,1)}}})[t.HEX]=function(t,r,e){var n=this.mix(t,r);return delete n.a,e?j.HEX(n):J.HEX(n)},h.HEXA=function(t,r,e){var n=this.mix(t,r);return n.a=e?255*Y(n.a):Y(n.a),e?j.HEX(n):J.HEXA(n)},h[t.RGB]=function(t,r,e){var n=this.mix(t,r);return delete n.a,e?j.RGB(n):J.RGB(n)},h.RGBA=function(t,r,e){var n=this.mix(t,r);return e?j.RGB(n):J.RGBA(n)},h[t.HSL]=function(t,r,e){var n=this.mix(t,r),o=B(n.r,n.g,n.b);return delete n.a,delete o.a,e?j.HSL(o):J.HSL(n)},h.HSLA=function(t,r,e){var n=this.mix(t,r),o=B(n.r,n.g,n.b,n.a);return e?j.HSL(o):J.HSLA(n)},h),rt=function(t,r,e,n,o){var i=n(z(t,r));return e?o(i):i},et=function(t,r,e,n,o,i){e<1&&(e=5);var a=function(t,r,e){var n=e-1,o=(r.r-t.r)/n,i=(r.g-t.g)/n,a=(r.b-t.b)/n,u=Y(t.a),c=(Y(r.a)-u)/n;return Array(e).fill(null).map((function(e,s){return 0===s?t:s===n?r:{r:O(t.r+o*s),g:O(t.g+i*s),b:O(t.b+a*s),a:O(u+c*s,2)}}))}(z(t),z(r),e);return a.map((function(t){var r=o(t);return n?i(r):r}))},nt=function(){function t(t){this.rgb=z(t),this.updateHSL(),this.updateCMYK()}return t.prototype.updateRGB=function(){this.rgb=o(o({},E(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},t.prototype.updateRGBFromCMYK=function(){this.rgb=o(o({},H(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},t.prototype.updateHSL=function(){this.hsl=B(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},t.prototype.updateCMYK=function(){this.cmyk=v(this.rgb.r,this.rgb.g,this.rgb.b)},t.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},t.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},t.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},t.prototype.setH=function(t){return this.hsl.h=I(t),this.updateRGBAndCMYK()},t.prototype.setS=function(t){return this.hsl.s=X(t,0,100),this.updateRGBAndCMYK()},t.prototype.setL=function(t){return this.hsl.l=X(t,0,100),this.updateRGBAndCMYK()},t.prototype.setR=function(t){return this.rgb.r=X(t,0,255),this.updateHSLAndCMYK()},t.prototype.setG=function(t){return this.rgb.g=X(t,0,255),this.updateHSLAndCMYK()},t.prototype.setB=function(t){return this.rgb.b=X(t,0,255),this.updateHSLAndCMYK()},t.prototype.setA=function(t){return this.hsl.a=this.rgb.a=X(t,0,1),this},t.prototype.setC=function(t){return this.cmyk.c=X(t,0,100),this.updateRGBAndHSL()},t.prototype.setM=function(t){return this.cmyk.m=X(t,0,100),this.updateRGBAndHSL()},t.prototype.setY=function(t){return this.cmyk.y=X(t,0,100),this.updateRGBAndHSL()},t.prototype.setK=function(t){return this.cmyk.k=X(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(t.prototype,"H",{get:function(){return O(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"S",{get:function(){return O(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"L",{get:function(){return O(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"R",{get:function(){return O(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"G",{get:function(){return O(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"B",{get:function(){return O(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"A",{get:function(){return O(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"C",{get:function(){return O(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"M",{get:function(){return O(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Y",{get:function(){return O(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"K",{get:function(){return O(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HEXObject",{get:function(){return J.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HEXAObject",{get:function(){return J.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RGBAObject",{get:function(){return o(o({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HSLAObject",{get:function(){return o(o({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMYKAObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HEX",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return j.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HEXA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:255*this.A};return j.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RGB",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return j.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RGBA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:this.A};return j.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HSL",{get:function(){var t=this.hsl,r={h:t.h,s:t.s,l:t.l};return j.HSL(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HSLA",{get:function(){return j.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMYK",{get:function(){return j.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMYKA",{get:function(){return j.CMYK(o(o({},this.cmyk),{a:this.A}))},enumerable:!1,configurable:!0}),t.toHEX=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.HEX,j.HEX)},t.toHEXA=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.HEXA,j.HEX)},t.toRGB=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.RGB,j.RGB)},t.toRGBA=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.RGBA,j.RGB)},t.toHSL=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.HSL,j.HSL)},t.toHSLA=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.HSLA,j.HSL)},t.toCMYK=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.CMYK,j.CMYK)},t.toCMYKA=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.CMYKA,j.CMYK)},t.getBlendHEX=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,J.HEX,j.HEX)},t.getBlendHEXA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,J.HEXA,j.HEX)},t.getBlendRGB=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,J.RGB,j.RGB)},t.getBlendRGBA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,J.RGBA,j.RGB)},t.getBlendHSL=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,J.HSL,j.HSL)},t.getBlendHSLA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),et(t,r,e,n,J.HSLA,j.HSL)},t.getMixHEX=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.HEX(t,r,e)},t.getMixHEXA=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.HEXA(t,r,e)},t.getMixRGB=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.RGB(t,r,e)},t.getMixRGBA=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.RGBA(t,r,e)},t.getMixHSL=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.HSL(t,r,e)},t.getMixHSLA=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.HSLA(t,r,e)},t.getShades=function(t,r){return W(t,r,!0)},t.getTints=function(t,r){return W(t,r,!1)},t.getHarmony=function(t,r,e){switch(void 0===r&&(r=exports.Harmony.COMPLEMENTARY),void 0===e&&(e=exports.Mix.ADDITIVE),r){case exports.Harmony.ANALOGOUS:return Z.buildHarmony(t,K,e);case exports.Harmony.SPLIT_COMPLEMENTARY:return Z.buildHarmony(t,w,e);case exports.Harmony.TRIADIC:return Z.buildHarmony(t,N,e);case exports.Harmony.TETRADIC:return Z.buildHarmony(t,V,e);case exports.Harmony.SQUARE:return Z.buildHarmony(t,U,e);default:return Z.buildHarmony(t,P,e)}},t}();exports.ColorTranslator=nt;
{
"name": "colortranslator",
"version": "1.9.4",
"version": "1.10.0",
"description": "A JavaScript library, written in TypeScript, to convert among different color models",

@@ -28,2 +28,3 @@ "main": "index.js",

"docs": "webpack --config webpack.demo.publish.js --mode production",
"compile:regexps": "yarn plop",
"prepare": "npm run build",

@@ -75,2 +76,3 @@ "prepublishOnly": "npm run lint && npm run test",

"node-sass": "^8.0.0",
"plop": "^3.1.1",
"rimraf": "^3.0.2",

@@ -77,0 +79,0 @@ "rollup": "^3.8.1",

@@ -96,17 +96,45 @@ <p align="center">

| Example of CSS string inputs | Description |
| --------------------------------- | ---------------------------------------------------------- |
| `fuchsia` | Color keyword |
| `#FF00FF` | Hexadecimal color |
| `#F0F` | Shorthand hexadecimal color |
| `#FF00FF80` | Hexadecimal color with alpha |
| `rgb(255, 0, 255)` | Functional RGB notation |
| `rgba(255, 0, 255, 0.5)` | Functional RGB notation with alpha |
| `hsl(300, 100%, 50%)` | Functional HSL notation |
| `hsla(300, 100%, 50%, 0.5)` | Functional HSL notation with alpha |
| `cmyk(0%, 100%, 100%, 0%)` | Functional CMYK notation with percentages |
| `cmyk(0, 1, 1, 0)` | Functional CMYK notation with numbers |
| `device-cmyk(0%, 100%, 100%, 0%)` | Device-dependent functional CMYK notation with percentages |
| `device-cmyk(0, 1, 1, 0)` | Device-dependent functional CMYK notation with numbers |
| Example of CSS string inputs | Description |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `fuchsia` | Color keyword |
| `#FF00FF` | Hexadecimal color |
| `#F0F` | Shorthand hexadecimal color |
| `#FF00FF80` | Hexadecimal color with alpha |
| `#F0FF` | Shorthand hexadecimal color with alpha |
| `rgb(255, 0, 255)` | Functional RGB notation |
| `rgba(255, 0, 255, 0.5)` | Functional RGB notation with alpha |
| `rgb(255 0 255)` | Functional RGB notation (CSS Colors 4 space-separated) |
| `rgba(255 0 255 / 0.5)` | Functional RGB notation with alpha (CSS Colors 4 space-separated) |
| `rgba(255 0 255 / 50%)` | Functional RGB notation CSS with alpha in percenatages (Colors 4 space-separated) |
| `hsl(300, 100%, 50%)` | Functional HSL notation |
| `hsl(300grad, 100%, 50%)` | Functional HSL notation with hue in grads |
| `hsl(300deg, 100%, 50%)` | Functional HSL notation with hue in degrees |
| `hsl(5.24rad, 100%, 50%)` | Functional HSL notation with hue in radians |
| `hsl(0.83turn, 100%, 50%)` | Functional HSL notation with hue in turns |
| `hsla(300, 100%, 50%, 0.5)` | Functional HSL notation with alpha |
| `hsl(300 100% 50%)` | Functional HSL notation (CSS Colors 4 space-separated) |
| `hsla(300 100% 50% / 0.5)` | Functional HSL notation with alpha (CSS Colors 4 space-separated) |
| `hsla(300 100% 50% / 50%)` | Functional HSL notation with alpha in percentages (CSS Colors 4 space-separated) |
| `cmyk(0%, 100%, 100%, 0%)` | Functional CMYK notation with percentages |
| `cmyk(0%, 100%, 100%, 0%, 1)` | Functional CMYK notation with percentages and alpha |
| `cmyk(0% 100% 100% 0%)` | Functional CMYK notation with percentages (CSS Colors 4 space-separated) |
| `cmyk(0% 100% 100% 0% / 1)` | Functional CMYK notation with percentages and alpha (CSS Colors 4 space-separated) |
| `cmyk(0% 100% 100% 0% / 100%)` | Functional CMYK notation with percentages and alpha in percentages (CSS Colors 4 space-separated) |
| `cmyk(0, 1, 1, 0)` | Functional CMYK notation with numbers |
| `cmyk(0, 1, 1, 0, 1)` | Functional CMYK notation with numbers and alpha |
| `cmyk(0 1 1 0)` | Functional CMYK notation with numbers (CSS Colors 4 space-separated) |
| `cmyk(0 1 1 0 / 1)` | Functional CMYK notation with numbers and alpha (CSS Colors 4 space-separated) |
| `cmyk(0 1 1 0 / 100%)` | Functional CMYK notation with numbers and alpha in percentages (CSS Colors 4 space-separated) |
| `device-cmyk(0%, 100%, 100%, 0%)` | Device-dependent functional CMYK notation with percentages |
| `device-cmyk(0%, 100%, 100%, 0%, 1)` | Device-dependent functional CMYK notation with percentages and alpha |
| `device-cmyk(0% 100% 100% 0%)` | Device-dependent functional CMYK notation with percentages (CSS Colors 4 space-separated) |
| `device-cmyk(0% 100% 100% 0% / 1)` | Device-dependent functional CMYK notation with percentages and alpha (CSS Colors 4 space-separated) |
| `device-cmyk(0% 100% 100% 0% / 100%)` | Device-dependent functional CMYK notation with percentages and alpha in percentages (CSS Colors 4 space-separated) |
| `device-cmyk(0, 1, 1, 0)` | Device-dependent functional CMYK notation with numbers |
| `device-cmyk(0, 1, 1, 0, 1)` | Device-dependent functional CMYK notation with numbers and alpha |
| `device-cmyk(0 1 1 0)` | Device-dependent functional CMYK notation with numbers (CSS Colors 4 space-separated) |
| `device-cmyk(0 1 1 0 / 1)` | Device-dependent functional CMYK notation with numbers and alpha (CSS Colors 4 space-separated) |
| `device-cmyk(0 1 1 0 / 100%)` | Device-dependent functional CMYK notation with numbers and alpha in percentages (CSS Colors 4 space-separated) |
###### Object inputs

@@ -119,2 +147,3 @@

| `{r: "0xFF", g: "0x00", b: "0xFF", a: "0x80"}` | Hexadecimal color with alpha |
| `{r: "0xF", g: "0x0", b: "0xF", a: "0xF"}` | Shorthand hexadecimal color with alpha |
| `{r: 255, g: 0, b: 255}` | RGB notation |

@@ -121,0 +150,0 @@ | `{r: 255, g: 0, b: 255, a: 0.5}` | RGB notation with alpha |

@@ -1,1 +0,1 @@

var colortranslator=function(t){"use strict";var n,r,e,o,a=function(){return a=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},a.apply(this,arguments)};function c(t,n,r){if(r||2===arguments.length)for(var e,o=0,a=n.length;o<a;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}!function(t){t.HEX="HEX",t.RGB="RGB",t.RGBA="RGBA",t.HSL="HSL",t.HSLA="HSLA",t.CMYK="CMYK"}(n||(n={})),t.Harmony=void 0,(r=t.Harmony||(t.Harmony={})).ANALOGOUS="ANALOGOUS",r.COMPLEMENTARY="COMPLEMENTARY",r.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",r.TRIADIC="TRIADIC",r.TETRADIC="TETRADIC",r.SQUARE="SQUARE",t.Mix=void 0,(e=t.Mix||(t.Mix={})).ADDITIVE="ADDITIVE",e.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"}(o||(o={}));var i,u,s,l,h,f,d,p,g=Object.keys(o),b="[a-f\\d]",F="".concat(b,"{2}"),A="\\d+",m="(?:\\d?\\.)?\\d*",y="\\d+\\.?\\d*",H="\\d+%",E="\\s*",B="".concat(E,",").concat(E),v=function(t,n){void 0===n&&(n=!1);var r=t.replace(/\s*/gm,"");return n?new RegExp(r,"i"):new RegExp(r)},M=((i={})[n.HEX]="\n ^#(?:\n (".concat(b,")\n (").concat(b,")\n (").concat(b,")\n (").concat(b,")?\n |\n (").concat(F,")\n (").concat(F,")\n (").concat(F,")\n (").concat(F,")?\n )$\n "),i[n.RGB]="\n ^rgb".concat(E,"\\(\n ").concat(E,"\n (?:\n (").concat(H,")\n ").concat(B,"\n (").concat(H,")\n ").concat(B,"\n (").concat(H,")\n |\n (").concat(A,")\n ").concat(B,"\n (").concat(A,")\n ").concat(B,"\n (").concat(A,")\n )\n ").concat(E,"\n \\)$\n "),i[n.RGBA]="\n ^rgba".concat(E,"\\(\n ").concat(E,"\n (?:\n (").concat(H,")\n ").concat(B,"\n (").concat(H,")\n ").concat(B,"\n (").concat(H,")\n |\n (").concat(A,")\n ").concat(B,"\n (").concat(A,")\n ").concat(B,"\n (").concat(A,")\n )\n ").concat(B,"\n (").concat(m,")\n ").concat(E,"\n \\)$\n "),i[n.HSL]="\n ^hsl".concat(E,"\\(\n ").concat(E,"\n (-?").concat(y,")\n ").concat(B,"\n (").concat(y,")%\n ").concat(B,"\n (").concat(y,")%\n ").concat(E,"\n \\)$\n "),i[n.HSLA]="\n ^hsla".concat(E,"\\(\n ").concat(E,"\n (-?").concat(y,")\n ").concat(B,"\n (").concat(y,")%\n ").concat(B,"\n (").concat(y,")%\n ").concat(B,"\n (").concat(m,")\n ").concat(E,"\n \\)$\n "),i[n.CMYK]="\n ^(?:device-cmyk|cmyk)\n ".concat(E,"\n \\(").concat(E,"\n (?:\n (").concat(y,"%)\n ").concat(B,"\n (").concat(y,"%)\n ").concat(B,"\n (").concat(y,"%)\n ").concat(B,"\n (").concat(y,"%)\n |\n (").concat(m,")\n ").concat(B,"\n (").concat(m,")\n ").concat(B,"\n (").concat(m,")\n ").concat(B,"\n (").concat(m,")\n )\n ").concat(E,"\n \\)$\n "),i),R=((u={})[n.HEX]=v(M.HEX,!0),u[n.RGB]=v(M.RGB),u[n.RGBA]=v(M.RGBA),u[n.HSL]=v(M.HSL),u[n.HSLA]=v(M.HSLA),u[n.CMYK]=v(M.CMYK),u),S=/^(\d+(?:\.\d+)?|\.\d+)%$/,C=/^0x([a-f\d]{1,2})$/i,L="The provided string color doesn't have a correct format",D="The provided color object doesn't have the proper keys or format",G=function(t,n,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?Math.round(255*((n-t)*r+t)):r<3?Math.round(255*n):r<4?Math.round(255*((n-t)*(4-r)+t)):Math.round(255*t)},k=function(t,n,r){n/=100;var e=(r/=100)<=.5?r*(n+1):r+n-r*n,o=2*r-e;return{r:G(o,e,(t/=60)+2),g:G(o,e,t),b:G(o,e,t-2)}},X=function(t,n,r,e){return e=1-e,{r:Math.round(255*(1-t)*e),g:Math.round(255*(1-n)*e),b:Math.round(255*(1-r)*e)}},O=function(t,n,r){t/=255,n/=255,r/=255;var e=1-Math.max(t,n,r),o=1-e,a=(o-t)/o,c=(o-n)/o,i=(o-r)/o;return{c:Math.round(100*a),m:Math.round(100*c),y:Math.round(100*i),k:Math.round(100*e)}},I=function(t,n,r,e){void 0===e&&(e=1),t/=255,n/=255,r/=255,e=Math.min(e,1);var o=Math.max(t,n,r),a=Math.min(t,n,r),c=o-a,i=0,u=0,s=(o+a)/2;if(0===c)i=0,u=0;else{switch(o){case t:i=(n-r)/c%6;break;case n:i=(r-t)/c+2;break;case r:i=(t-n)/c+4}(i=Math.round(60*i))<0&&(i+=360),u=c/(1-Math.abs(2*s-1))}return{h:i,s:Math.round(100*u),l:Math.round(100*s),a:e}},j=function(t,n){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]],e=[[0,60],[60,120],[120,240],[240,360]],o=n?e:r,a=0,c=0,i=0,u=0;return(n?r:e).find((function(n,r){return t>=n[0]&&t<n[1]&&(a=n[0],c=n[1],i=o[r][0],u=o[r][1],!0)})),i+(u-i)/(c-a)*(t-a)},x=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},T=function(t){return S.test("".concat(t))?+"".concat(t).replace(S,"$1"):Math.min(+t,100)},Y=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},w=function(t){var n=parseInt("".concat(t)).toString(16).toUpperCase();return 1===n.length?"0x0".concat(n):"0x".concat(n)},P=function(t){var n=parseInt("".concat(t)).toString(16).toUpperCase();return 1===n.length&&(n="0".concat(n)),n},K=function(t,n){return void 0===n&&(n=!1),!n&&S.test(t)?Math.min(255*+t.replace(S,"$1")/100,255):C.test(t)?3===t.length?n?parseInt(t+t.slice(-1))/255:parseInt(t+t.slice(-1)):n?parseInt(t)/255:parseInt(t):Math.min(+t,n?1:255)},N=function(t){return Math.min(S.test(t)?+t.replace(S,"$1")/100:+t,1)},V=function(t){return t.sort().join().toUpperCase()},U=function(t,n){void 0===n&&(n=0);var r=Math.pow(10,n);return Math.round(+t*r)/r},$=function(t,n,r){return Math.max(n,Math.min(t,r))},q=((s={})[n.HEX]=function(t){return"#".concat(P(t.r)).concat(P(t.g)).concat(P(t.b)).concat(x(t,"a")&&P(t.a)||"")},s[n.RGB]=function(t){return"rgb".concat(x(t,"a")?"a":"","(").concat(U(t.r),",").concat(U(t.g),",").concat(U(t.b)).concat(x(t,"a")&&",".concat(U(t.a,2))||"",")")},s[n.HSL]=function(t){return"hsl".concat(x(t,"a")?"a":"","(").concat(U(t.h),",").concat(U(t.s),"%,").concat(U(t.l),"%").concat(x(t,"a")&&",".concat(U(t.a,2))||"",")")},s[n.CMYK]=function(t){return"cmyk(".concat(U(t.c),"%,").concat(U(t.m),"%,").concat(U(t.y),"%,").concat(U(t.k),"%)")},s),Q=function(t){return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},_=function(t){return isNaN(+t)||t>1?1:U(t,2)},z=function(n,r,e){return r.reduce((function(r,o){return c(c([],r,!0),[a(a({},n),{h:e===t.Mix.ADDITIVE?Q(n.h+o):Q(j(j(n.h,!1)+o,!0))})],!1)}),[a({},n)])},J=function(t,n){return z(t,[30,-30],n)},W=function(t,n){return z(t,[180],n)},Z=function(t,n){return z(t,[150,-150],n)},tt=function(t,n){return z(t,[120,-120],n)},nt=function(t,n){return z(t,[60,-120,180],n)},rt=function(t,n){return z(t,[90,-90,180],n)},et=function(t){return"string"==typeof t?function(t){var r;if(Object.keys(n).some((function(n){if(R[n].test(t))return r=n,!0})),!r&&~g.indexOf(t)&&(r=n.HEX),!r)throw new Error(L);return r}(t):function(t){var r,e=!1,o=V(Object.keys(t));if(Object.keys(n).filter((function(t){return t!==n.HEX})).some((function(t){if(V(t.split(""))===o)return r=t,!0})),r&&r===n.RGB||r===n.RGBA){var a=Object.entries(t).map((function(t){return C.test("".concat(t[1]))})),c=Object.entries(t).map((function(t){return S.test("".concat(t[1]))||!C.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255})),i=a.some((function(t,n){return n>0&&t!==a[n-1]})),u=c.some((function(t,n){return n>0&&t!==c[n-1]}));!(e=i||u||!a[0]&&!c[0])&&a[0]&&(r=n.HEX)}if(!r||e)throw new Error(D);return r}(t)},ot=((l={})[n.HEX]=function(t){var n=(~g.indexOf(t)?o[t]:t).match(R.HEX),r={r:Y(n[1]||n[5]),g:Y(n[2]||n[6]),b:Y(n[3]||n[7])},e=n[4]||n[8];return void 0!==e&&(r.a=Y(e)/255),r},l[n.RGB]=function(t){var n=t.match(R.RGB),r=K(n[1]||n[4]),e=K(n[2]||n[5]),o=K(n[3]||n[6]);return{r:Math.min(r,255),g:Math.min(e,255),b:Math.min(o,255)}},l[n.RGBA]=function(t){var n=t.match(R.RGBA),r=K(n[1]||n[4]),e=K(n[2]||n[5]),o=K(n[3]||n[6]),a=+n[7];return{r:Math.min(r,255),g:Math.min(e,255),b:Math.min(o,255),a:_(a)}},l[n.HSL]=function(t){var n=t.match(R.HSL),r=Q(+n[1]),e=T(n[2]),o=T(n[3]);return k(r,e,o)},l[n.HSLA]=function(t){var n=t.match(R.HSLA),r=Q(+n[1]),e=T(n[2]),o=T(n[3]),a=+n[4],c=k(r,e,o);return c.a=_(a),c},l[n.CMYK]=function(t){var n=t.match(R.CMYK),r=N(n[1]||n[5]),e=N(n[2]||n[6]),o=N(n[3]||n[7]),a=N(n[4]||n[8]);return X(r,e,o,a)},l),at=((h={})[n.HEX]=function(t){var n={r:K("".concat(t.r)),g:K("".concat(t.g)),b:K("".concat(t.b))};return n.a=x(t,"a")?Math.min(K("".concat(t.a),!0),1):1,n},h[n.RGB]=function(t){var n=this.HEX(t);return delete n.a,n},h[n.RGBA]=function(t){return this.HEX(t)},h[n.HSL]=function(t){var n=T("".concat(t.s)),r=T("".concat(t.l));return k(Q(t.h),n,r)},h[n.HSLA]=function(t){var n=this.HSL(t);return n.a=_(t.a),n},h[n.CMYK]=function(t){var n=N("".concat(t.c)),r=N("".concat(t.m)),e=N("".concat(t.y)),o=N("".concat(t.k));return X(n,r,e,o)},h),ct=function(t,n){return void 0===n&&(n=et(t)),"string"==typeof t?ot[n](t):at[n](t)},it=((f={})[n.HEX]=function(t){return{r:w(t.r),g:w(t.g),b:w(t.b)}},f.HEXA=function(t){var n=it.HEX(t);return n.a=x(t,"a")?w(255*t.a):"0xFF",n},f[n.RGB]=function(t){return x(t,"a")&&delete t.a,t},f[n.RGBA]=function(t){return t.a=x(t,"a")?U(t.a,2):1,t},f[n.HSL]=function(t){var n=I(t.r,t.g,t.b);return delete n.a,n},f[n.HSLA]=function(t){var n=it.HSL(t);return n.a=x(t,"a")?U(t.a,2):1,n},f[n.CMYK]=function(t){return O(t.r,t.g,t.b)},f),ut=function(t,r,e){var o=et(t),c="string"==typeof t,i=ct(t,o),u="string"==typeof t&&x(i,"a")||"string"!=typeof t&&x(t,"a"),s=I(i.r,i.g,i.b,i.a);u||delete s.a;var l=e?s.l/(r+1):(100-s.l)/(r+1),h=Array(r).fill(null).map((function(t,n){return a(a({},s),{l:s.l+l*(n+1)*(1-2*+e)})}));switch(o){case n.HEX:default:return h.map((function(t){var n=k(t.h,t.s,t.l);return u&&(n.a=t.a),c?u?q.HEX(a(a({},n),{a:U(255*n.a,2)})):q.HEX(n):u?it.HEXA(n):it.HEX(n)}));case n.RGB:case n.RGBA:return h.map((function(t){var n=k(t.h,t.s,t.l);return u&&(n.a=t.a),c?q.RGB(n):u?it.RGBA(n):it.RGB(n)}));case n.HSL:case n.HSLA:return h.map((function(t){return c?q.HSL(t):u?it.HSLA(a(a({},k(t.h,t.s,t.l)),{a:t.a})):it.HSL(k(t.h,t.s,t.l))}))}},st=((d={buildHarmony:function(t,r,e){var o=et(t),a=ct(t,o),c=I(a.r,a.g,a.b,a.a),i="string"==typeof t&&x(a,"a")||"string"!=typeof t&&x(t,"a"),u="string"==typeof t;switch(o){case n.HEX:default:return i?this.HEXA(c,r,e,u):this.HEX(c,r,e,u);case n.HSL:return this.HSL(c,r,e,u);case n.HSLA:return this.HSLA(c,r,e,u);case n.RGB:return this.RGB(c,r,e,u);case n.RGBA:return this.RGBA(c,r,e,u)}}})[n.HEX]=function(t,n,r,e){return n(t,r).map((function(t){return e?q.HEX(k(t.h,t.s,t.l)):it.HEX(k(t.h,t.s,t.l))}))},d.HEXA=function(t,n,r,e){return n(t,r).map((function(t){return e?q.HEX(a(a({},k(t.h,t.s,t.l)),{a:255*_(t.a)})):it.HEXA(a(a({},k(t.h,t.s,t.l)),{a:_(t.a)}))}))},d[n.RGB]=function(t,n,r,e){return n(t,r).map((function(t){return e?q.RGB(k(t.h,t.s,t.l)):it.RGB(k(t.h,t.s,t.l))}))},d[n.RGBA]=function(t,n,r,e){return n(t,r).map((function(t){return e?q.RGB(a(a({},k(t.h,t.s,t.l)),{a:_(t.a)})):it.RGBA(a(a({},k(t.h,t.s,t.l)),{a:_(t.a)}))}))},d[n.HSL]=function(t,n,r,e){return n(t,r).map((function(t){return e?q.HSL({h:t.h,s:t.s,l:t.l}):it.HSL(k(t.h,t.s,t.l))}))},d[n.HSLA]=function(t,n,r,e){return n(t,r).map((function(t){return e?q.HSL(a(a({},t),{a:_(t.a)})):it.HSLA(a(a({},k(t.h,t.s,t.l)),{a:_(t.a)}))}))},d),lt=((p={mix:function(n,r){var e,o,c,i,u,s,l,h,f,d,p,g,b,F,A,m=n.map((function(t){var n=et(t);return ct(t,n)})),y=r===t.Mix.SUBTRACTIVE?m.map((function(t){var n,r,e,o,a,c,i,u,s,l,h,f,d,p,g=(n=t.r,r=t.g,e=t.b,o=Math.min(n,r,e),a=Math.min(255-n,255-r,255-e),c=n-o,i=r-o,u=e-o,s=Math.min(c,i),l=c-s,h=(i+s)/2,f=(u+i-s)/2,d=Math.max(l,h,f)/Math.max(c,i,u),p=isNaN(d)||d===1/0||d<=0?1:d,{r:l/p+a,y:h/p+a,b:f/p+a});return x(t,"a")&&(g.a=t.a),g})):null;function H(n){var e=r===t.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return n.reduce((function(n,e){var o=x(e,"a")?e.a:1,c={r:Math.min(n.r+e.r*o,255),b:Math.min(n.b+e.b*o,255),a:1-(1-o)*(1-n.a)},i="g"in n?n.g:n.y,u="g"in e?e.g:e.y;return a(a({},c),r===t.Mix.ADDITIVE?{g:Math.min(i+u*o,255)}:{y:Math.min(i+u*o,255)})}),e)}if(r===t.Mix.ADDITIVE)e=H(m);else{var E=H(y);o=E.r,c=E.y,i=E.b,u=Math.min(o,c,i),s=Math.min(255-o,255-c,255-i),l=o-u,h=c-u,f=i-u,d=Math.min(h,f),p=l+h-d,g=h+2*d,b=2*(f-d),F=Math.max(p,g,b)/Math.max(l,h,f),A=isNaN(F)||F===1/0||F<=0?1:F,(e={r:p/A+s,g:g/A+s,b:b/A+s}).a=E.a}return{r:U(e.r,2),g:U(e.g,2),b:U(e.b,2),a:$(e.a,0,1)}}})[n.HEX]=function(t,n,r){var e=this.mix(t,n);return delete e.a,r?q.HEX(e):it.HEX(e)},p.HEXA=function(t,n,r){var e=this.mix(t,n);return e.a=r?255*_(e.a):_(e.a),r?q.HEX(e):it.HEXA(e)},p[n.RGB]=function(t,n,r){var e=this.mix(t,n);return delete e.a,r?q.RGB(e):it.RGB(e)},p[n.RGBA]=function(t,n,r){var e=this.mix(t,n);return r?q.RGB(e):it.RGBA(e)},p[n.HSL]=function(t,n,r){var e=this.mix(t,n),o=I(e.r,e.g,e.b);return delete e.a,delete o.a,r?q.HSL(o):it.HSL(e)},p[n.HSLA]=function(t,n,r){var e=this.mix(t,n),o=I(e.r,e.g,e.b,e.a);return r?q.HSL(o):it.HSLA(e)},p),ht=function(t,n){return"string"==typeof t&&n||"object"==typeof t&&!n},ft=function(t,n,r,e,o){var a=e(ct(t,n));return r?o(a):a},dt=function(t,n,r,e,o,a){r<1&&(r=5);var c=function(t,n,r){var e=r-1,o=(n.r-t.r)/e,a=(n.g-t.g)/e,c=(n.b-t.b)/e,i=_(t.a),u=(_(n.a)-i)/e;return Array(r).fill(null).map((function(r,s){return 0===s?t:s===e?n:{r:U(t.r+o*s),g:U(t.g+a*s),b:U(t.b+c*s),a:U(i+u*s,2)}}))}(ct(t),ct(n),r);return c.map((function(t){var n=o(t);return e?a(n):n}))},pt=function(){function r(t){this.rgb=ct(t),this.updateHSL(),this.updateCMYK()}return r.prototype.updateRGB=function(){this.rgb=a(a({},k(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},r.prototype.updateRGBFromCMYK=function(){this.rgb=a(a({},X(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},r.prototype.updateHSL=function(){this.hsl=I(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},r.prototype.updateCMYK=function(){this.cmyk=O(this.rgb.r,this.rgb.g,this.rgb.b)},r.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},r.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},r.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},r.prototype.setH=function(t){return this.hsl.h=Q(t),this.updateRGBAndCMYK()},r.prototype.setS=function(t){return this.hsl.s=$(t,0,100),this.updateRGBAndCMYK()},r.prototype.setL=function(t){return this.hsl.l=$(t,0,100),this.updateRGBAndCMYK()},r.prototype.setR=function(t){return this.rgb.r=$(t,0,255),this.updateHSLAndCMYK()},r.prototype.setG=function(t){return this.rgb.g=$(t,0,255),this.updateHSLAndCMYK()},r.prototype.setB=function(t){return this.rgb.b=$(t,0,255),this.updateHSLAndCMYK()},r.prototype.setA=function(t){return this.hsl.a=this.rgb.a=$(t,0,1),this},r.prototype.setC=function(t){return this.cmyk.c=$(t,0,100),this.updateRGBAndHSL()},r.prototype.setM=function(t){return this.cmyk.m=$(t,0,100),this.updateRGBAndHSL()},r.prototype.setY=function(t){return this.cmyk.y=$(t,0,100),this.updateRGBAndHSL()},r.prototype.setK=function(t){return this.cmyk.k=$(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(r.prototype,"H",{get:function(){return U(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"S",{get:function(){return U(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"L",{get:function(){return U(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"R",{get:function(){return U(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"G",{get:function(){return U(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"B",{get:function(){return U(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"A",{get:function(){return U(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"C",{get:function(){return U(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"M",{get:function(){return U(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Y",{get:function(){return U(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"K",{get:function(){return U(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXObject",{get:function(){return it.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXAObject",{get:function(){return it.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBAObject",{get:function(){return a(a({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLAObject",{get:function(){return a(a({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEX",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b};return q.HEX(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXA",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b,a:255*this.A};return q.HEX(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGB",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b};return q.RGB(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBA",{get:function(){var t=this.rgb,n={r:t.r,g:t.g,b:t.b,a:this.A};return q.RGB(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSL",{get:function(){var t=this.hsl,n={h:t.h,s:t.s,l:t.l};return q.HSL(n)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLA",{get:function(){return q.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYK",{get:function(){return q.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),r.toHEX=function(t,n){void 0===n&&(n=!0);var r=et(t);return ft(t,r,n,it.HEX,q.HEX)},r.toHEXA=function(t,n){void 0===n&&(n=!0);var r=et(t);return ft(t,r,n,it.HEXA,q.HEX)},r.toRGB=function(t,n){void 0===n&&(n=!0);var r=et(t);return ft(t,r,n,it.RGB,q.RGB)},r.toRGBA=function(t,n){void 0===n&&(n=!0);var r=et(t);return ft(t,r,n,it.RGBA,q.RGB)},r.toHSL=function(t,r){void 0===r&&(r=!0);var e=et(t);return e===n.HSL&&ht(t,r)?t:ft(t,e,r,it.HSL,q.HSL)},r.toHSLA=function(t,r){void 0===r&&(r=!0);var e=et(t);return e===n.HSLA&&ht(t,r)?t:ft(t,e,r,it.HSLA,q.HSL)},r.toCMYK=function(t,r){void 0===r&&(r=!0);var e=et(t);return e===n.CMYK&&ht(t,r)?t:ft(t,e,r,it.CMYK,q.CMYK)},r.getBlendHEX=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),dt(t,n,r,e,it.HEX,q.HEX)},r.getBlendHEXA=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),dt(t,n,r,e,it.HEXA,q.HEX)},r.getBlendRGB=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),dt(t,n,r,e,it.RGB,q.RGB)},r.getBlendRGBA=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),dt(t,n,r,e,it.RGBA,q.RGB)},r.getBlendHSL=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),dt(t,n,r,e,it.HSL,q.HSL)},r.getBlendHSLA=function(t,n,r,e){return void 0===r&&(r=5),void 0===e&&(e=!0),dt(t,n,r,e,it.HSLA,q.HSL)},r.getMixHEX=function(n,r,e){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===e&&(e=!0),lt.HEX(n,r,e)},r.getMixHEXA=function(n,r,e){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===e&&(e=!0),lt.HEXA(n,r,e)},r.getMixRGB=function(n,r,e){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===e&&(e=!0),lt.RGB(n,r,e)},r.getMixRGBA=function(n,r,e){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===e&&(e=!0),lt.RGBA(n,r,e)},r.getMixHSL=function(n,r,e){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===e&&(e=!0),lt.HSL(n,r,e)},r.getMixHSLA=function(n,r,e){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===e&&(e=!0),lt.HSLA(n,r,e)},r.getShades=function(t,n){return ut(t,n,!0)},r.getTints=function(t,n){return ut(t,n,!1)},r.getHarmony=function(n,r,e){switch(void 0===r&&(r=t.Harmony.COMPLEMENTARY),void 0===e&&(e=t.Mix.ADDITIVE),r){case t.Harmony.ANALOGOUS:return st.buildHarmony(n,J,e);case t.Harmony.SPLIT_COMPLEMENTARY:return st.buildHarmony(n,Z,e);case t.Harmony.TRIADIC:return st.buildHarmony(n,tt,e);case t.Harmony.TETRADIC:return st.buildHarmony(n,nt,e);case t.Harmony.SQUARE:return st.buildHarmony(n,rt,e);default:return st.buildHarmony(n,W,e)}},r}();return t.ColorTranslator=pt,t}({});
var colortranslator=function(t){"use strict";var r,e,n,o,i=function(){return i=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},i.apply(this,arguments)};function a(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",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"}(o||(o={}));var u,c,s,d,l,h,f,g=Object.keys(o),p=((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]=/^rgba?\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,u[r.HSL]=/^hsla?\s*\(\s*(?:(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*,\s*((?:\d*\.)?\d+)%\s*,\s*((?:\d*\.)?\d+)%(?:\s*,\s*((?:\d*\.)?\d+))?|(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*((?:\d*\.)?\d+)%\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+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,u),b=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,F=/^(\d+(?:\.\d+)?|\.\d+)%$/,y=/^0x([a-f\d]{1,2})$/i,m="The provided string color doesn't have a correct format",A="The provided color object doesn't have the proper keys or format",E=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,o=2*e-n;return{r:E(o,n,(t/=60)+2),g:E(o,n,t),b:E(o,n,t-2)}},v=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),o=1-n,i=(o-t)/o,a=(o-r)/o,u=(o-e)/o;return{c:Math.round(100*i),m:Math.round(100*a),y:Math.round(100*u),k:Math.round(100*n)}},M=function(t,r,e,n){void 0===n&&(n=1),t/=255,r/=255,e/=255,n=Math.min(n,1);var o=Math.max(t,r,e),i=Math.min(t,r,e),a=o-i,u=0,c=0,s=(o+i)/2;if(0===a)u=0,c=0;else{switch(o){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),c=a/(1-Math.abs(2*s-1))}return{h:u,s:Math.round(100*c),l:Math.round(100*s),a:n}},C=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]],o=r?n:e,i=0,a=0,u=0,c=0;return(r?e:n).find((function(r,e){return t>=r[0]&&t<r[1]&&(i=r[0],a=r[1],u=o[e][0],c=o[e][1],!0)})),u+(c-u)/(a-i)*(t-i)},D=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},R=function(t){return F.test("".concat(t))?+"".concat(t).replace(F,"$1"):Math.min(+t,100)},S=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},L=function(t){var r=parseInt("".concat(t)).toString(16).toUpperCase();return 1===r.length?"0x0".concat(r):"0x".concat(r)},G=function(t){var r=parseInt("".concat(t)).toString(16).toUpperCase();return 1===r.length&&(r="0".concat(r)),r},k=function(t,r){return void 0===r&&(r=!1),!r&&F.test(t)?Math.min(255*+t.replace(F,"$1")/100,255):y.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)},O=function(t){return Math.min(F.test(t)?+t.replace(F,"$1")/100:+t,1)},X=function(t){return t.sort().join("").toUpperCase()},j=function(t,r){void 0===r&&(r=0);var e=Math.pow(10,r);return Math.round(+t*e)/e},I=function(t,r,e){return Math.max(r,Math.min(t,e))},Y=((c={})[r.HEX]=function(t){return"#".concat(G(t.r)).concat(G(t.g)).concat(G(t.b)).concat(D(t,"a")&&G(t.a)||"")},c[r.RGB]=function(t){return"rgb".concat(D(t,"a")?"a":"","(").concat(j(t.r),",").concat(j(t.g),",").concat(j(t.b)).concat(D(t,"a")&&",".concat(j(t.a,2))||"",")")},c[r.HSL]=function(t){return"hsl".concat(D(t,"a")?"a":"","(").concat(j(t.h),",").concat(j(t.s),"%,").concat(j(t.l),"%").concat(D(t,"a")&&",".concat(j(t.a,2))||"",")")},c[r.CMYK]=function(t){return"cmyk(".concat(j(t.c),"%,").concat(j(t.m),"%,").concat(j(t.y),"%,").concat(j(t.k),"%").concat(D(t,"a")&&",".concat(j(t.a,2))||"",")")},c),x=function(t){if("string"==typeof t){var r=t.match(b),e=+r[1];switch(r[2]){case"rad":t=Math.round(180*e/Math.PI);break;case"turn":t=Math.round(360*e);break;default:t=e}}return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},T=function(t){return"string"==typeof t&&(t=F.test(t)?+t.replace(F,"$1")/100:+t),isNaN(+t)||t>1?1:j(t,2)},K=function(r,e,n){return e.reduce((function(e,o){return a(a([],e,!0),[i(i({},r),{h:n===t.Mix.ADDITIVE?x(r.h+o):x(C(C(r.h,!1)+o,!0))})],!1)}),[i({},r)])},P=function(t,r){return K(t,[30,-30],r)},w=function(t,r){return K(t,[180],r)},N=function(t,r){return K(t,[150,-150],r)},V=function(t,r){return K(t,[120,-120],r)},U=function(t,r){return K(t,[60,-120,180],r)},$=function(t,r){return K(t,[90,-90,180],r)},q=Object.entries(r).reduce((function(t,e){var n=e[0],o=e[1];if(n!==r.HEX){var i=X(n.split(""));t[i]=o,t["A"+i]=o}return t}),{}),Q=function(t){return"string"==typeof t?function(t){var e;if(Object.keys(r).some((function(r){if(p[r].test(t))return e=r,!0})),!e&&~g.indexOf(t)&&(e=r.HEX),!e)throw new Error(m);return e}(t):function(t){var e,n=!1,o=X(Object.keys(t));if(q[o]&&(e=q[o]),e&&e===r.RGB){var i=Object.entries(t).some((function(t){return!y.test("".concat(t[1]))})),a=Object.entries(t).some((function(t){return!(F.test("".concat(t[1]))||!y.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255)}));i&&a&&(n=!0),i||(e=r.HEX)}if(!e||n)throw new Error(A);return e}(t)},_=((s={})[r.HEX]=function(t){var r=(~g.indexOf(t)?o[t]:t).match(p.HEX),e={r:S(r[1]||r[5]),g:S(r[2]||r[6]),b:S(r[3]||r[7])},n=r[4]||r[8];return void 0!==n&&(e.a=S(n)/255),e},s[r.RGB]=function(t){var r=t.match(p.RGB),e=k(r[1]||r[5]),n=k(r[2]||r[6]),o=k(r[3]||r[7]),i=r[4]||r[8],a={r:Math.min(e,255),g:Math.min(n,255),b:Math.min(o,255)};return void 0!==i&&(a.a=T(i)),a},s[r.HSL]=function(t){var r=t.match(p.HSL),e=x(r[1]||r[5]),n=R(r[2]||r[6]),o=R(r[3]||r[7]),i=r[4]||r[8],a=H(e,n,o);return void 0!==i&&(a.a=T(i)),a},s[r.CMYK]=function(t){var r=t.match(p.CMYK),e=O(r[1]||r[6]),n=O(r[2]||r[7]),o=O(r[3]||r[8]),i=O(r[4]||r[9]),a=r[5]||r[10],u=v(e,n,o,i);return void 0!==a&&(u.a=T(a)),u},s),z=((d={})[r.HEX]=function(t){var r={r:k("".concat(t.r)),g:k("".concat(t.g)),b:k("".concat(t.b))};return D(t,"a")&&(r.a=Math.min(k("".concat(t.a),!0),1)),r},d[r.RGB]=function(t){return this.HEX(t)},d[r.HSL]=function(t){var r=R("".concat(t.s)),e=R("".concat(t.l)),n=H(x(t.h),r,e);return D(t,"a")&&(n.a=T(t.a)),n},d[r.CMYK]=function(t){var r=O("".concat(t.c)),e=O("".concat(t.m)),n=O("".concat(t.y)),o=O("".concat(t.k)),i=v(r,e,n,o);return D(t,"a")&&(i.a=T(t.a)),i},d),J=function(t,r){return void 0===r&&(r=Q(t)),"string"==typeof t?_[r](t):z[r](t)},W=((l={})[r.HEX]=function(t){return{r:L(t.r),g:L(t.g),b:L(t.b)}},l.HEXA=function(t){var r=W.HEX(t);return r.a=D(t,"a")?L(255*t.a):"0xFF",r},l[r.RGB]=function(t){return D(t,"a")&&delete t.a,t},l.RGBA=function(t){return t.a=D(t,"a")?j(t.a,2):1,t},l[r.HSL]=function(t){var r=M(t.r,t.g,t.b);return delete r.a,r},l.HSLA=function(t){var r=W.HSL(t);return r.a=D(t,"a")?j(t.a,2):1,r},l[r.CMYK]=function(t){return B(t.r,t.g,t.b)},l.CMYKA=function(t){var r=B(t.r,t.g,t.b);return r.a=D(t,"a")?j(t.a,2):1,r},l),Z=function(t,e,n){var o=Q(t),a="string"==typeof t,u=J(t,o),c="string"==typeof t&&D(u,"a")||"string"!=typeof t&&D(t,"a"),s=M(u.r,u.g,u.b,u.a);c||delete s.a;var d=n?s.l/(e+1):(100-s.l)/(e+1),l=Array(e).fill(null).map((function(t,r){return i(i({},s),{l:s.l+d*(r+1)*(1-2*+n)})}));switch(o){case r.HEX:default:return l.map((function(t){var r=H(t.h,t.s,t.l);return c&&(r.a=t.a),a?c?Y.HEX(i(i({},r),{a:j(255*r.a,2)})):Y.HEX(r):c?W.HEXA(r):W.HEX(r)}));case r.RGB:return l.map((function(t){var r=H(t.h,t.s,t.l);return c&&(r.a=t.a),a?Y.RGB(r):c?W.RGBA(r):W.RGB(r)}));case r.HSL:return l.map((function(t){return a?Y.HSL(t):c?W.HSLA(i(i({},H(t.h,t.s,t.l)),{a:t.a})):W.HSL(H(t.h,t.s,t.l))}))}},tt=((h={buildHarmony:function(t,e,n){var o=Q(t),i=J(t,o),a=M(i.r,i.g,i.b,i.a),u="string"==typeof t&&D(i,"a")||"string"!=typeof t&&D(t,"a"),c="string"==typeof t;switch(o){case r.HEX:default:return u?this.HEXA(a,e,n,c):this.HEX(a,e,n,c);case r.HSL:return u?this.HSLA(a,e,n,c):this.HSL(a,e,n,c);case r.RGB:return u?this.RGBA(a,e,n,c):this.RGB(a,e,n,c)}}})[r.HEX]=function(t,r,e,n){return r(t,e).map((function(t){return n?Y.HEX(H(t.h,t.s,t.l)):W.HEX(H(t.h,t.s,t.l))}))},h.HEXA=function(t,r,e,n){return r(t,e).map((function(t){return n?Y.HEX(i(i({},H(t.h,t.s,t.l)),{a:255*T(t.a)})):W.HEXA(i(i({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},h[r.RGB]=function(t,r,e,n){return r(t,e).map((function(t){return n?Y.RGB(H(t.h,t.s,t.l)):W.RGB(H(t.h,t.s,t.l))}))},h.RGBA=function(t,r,e,n){return r(t,e).map((function(t){return n?Y.RGB(i(i({},H(t.h,t.s,t.l)),{a:T(t.a)})):W.RGBA(i(i({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},h[r.HSL]=function(t,r,e,n){return r(t,e).map((function(t){return n?Y.HSL({h:t.h,s:t.s,l:t.l}):W.HSL(H(t.h,t.s,t.l))}))},h.HSLA=function(t,r,e,n){return r(t,e).map((function(t){return n?Y.HSL(i(i({},t),{a:T(t.a)})):W.HSLA(i(i({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},h),rt=((f={mix:function(r,e){var n,o,a,u,c,s,d,l,h,f,g,p,b,F,y,m=r.map((function(t){var r=Q(t);return J(t,r)})),A=e===t.Mix.SUBTRACTIVE?m.map((function(t){var r,e,n,o,i,a,u,c,s,d,l,h,f,g,p=(r=t.r,e=t.g,n=t.b,o=Math.min(r,e,n),i=Math.min(255-r,255-e,255-n),a=r-o,u=e-o,c=n-o,s=Math.min(a,u),d=a-s,l=(u+s)/2,h=(c+u-s)/2,f=Math.max(d,l,h)/Math.max(a,u,c),g=isNaN(f)||f===1/0||f<=0?1:f,{r:d/g+i,y:l/g+i,b:h/g+i});return D(t,"a")&&(p.a=t.a),p})):null;function E(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 o=D(n,"a")?n.a:1,a={r:Math.min(r.r+n.r*o,255),b:Math.min(r.b+n.b*o,255),a:1-(1-o)*(1-r.a)},u="g"in r?r.g:r.y,c="g"in n?n.g:n.y;return i(i({},a),e===t.Mix.ADDITIVE?{g:Math.min(u+c*o,255)}:{y:Math.min(u+c*o,255)})}),n)}if(e===t.Mix.ADDITIVE)n=E(m);else{var H=E(A);o=H.r,a=H.y,u=H.b,c=Math.min(o,a,u),s=Math.min(255-o,255-a,255-u),d=o-c,l=a-c,h=u-c,f=Math.min(l,h),g=d+l-f,p=l+2*f,b=2*(h-f),F=Math.max(g,p,b)/Math.max(d,l,h),y=isNaN(F)||F===1/0||F<=0?1:F,(n={r:g/y+s,g:p/y+s,b:b/y+s}).a=H.a}return{r:j(n.r,2),g:j(n.g,2),b:j(n.b,2),a:I(n.a,0,1)}}})[r.HEX]=function(t,r,e){var n=this.mix(t,r);return delete n.a,e?Y.HEX(n):W.HEX(n)},f.HEXA=function(t,r,e){var n=this.mix(t,r);return n.a=e?255*T(n.a):T(n.a),e?Y.HEX(n):W.HEXA(n)},f[r.RGB]=function(t,r,e){var n=this.mix(t,r);return delete n.a,e?Y.RGB(n):W.RGB(n)},f.RGBA=function(t,r,e){var n=this.mix(t,r);return e?Y.RGB(n):W.RGBA(n)},f[r.HSL]=function(t,r,e){var n=this.mix(t,r),o=M(n.r,n.g,n.b);return delete n.a,delete o.a,e?Y.HSL(o):W.HSL(n)},f.HSLA=function(t,r,e){var n=this.mix(t,r),o=M(n.r,n.g,n.b,n.a);return e?Y.HSL(o):W.HSLA(n)},f),et=function(t,r,e,n,o){var i=n(J(t,r));return e?o(i):i},nt=function(t,r,e,n,o,i){e<1&&(e=5);var a=function(t,r,e){var n=e-1,o=(r.r-t.r)/n,i=(r.g-t.g)/n,a=(r.b-t.b)/n,u=T(t.a),c=(T(r.a)-u)/n;return Array(e).fill(null).map((function(e,s){return 0===s?t:s===n?r:{r:j(t.r+o*s),g:j(t.g+i*s),b:j(t.b+a*s),a:j(u+c*s,2)}}))}(J(t),J(r),e);return a.map((function(t){var r=o(t);return n?i(r):r}))},ot=function(){function r(t){this.rgb=J(t),this.updateHSL(),this.updateCMYK()}return r.prototype.updateRGB=function(){this.rgb=i(i({},H(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},r.prototype.updateRGBFromCMYK=function(){this.rgb=i(i({},v(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},r.prototype.updateHSL=function(){this.hsl=M(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},r.prototype.updateCMYK=function(){this.cmyk=B(this.rgb.r,this.rgb.g,this.rgb.b)},r.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},r.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},r.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},r.prototype.setH=function(t){return this.hsl.h=x(t),this.updateRGBAndCMYK()},r.prototype.setS=function(t){return this.hsl.s=I(t,0,100),this.updateRGBAndCMYK()},r.prototype.setL=function(t){return this.hsl.l=I(t,0,100),this.updateRGBAndCMYK()},r.prototype.setR=function(t){return this.rgb.r=I(t,0,255),this.updateHSLAndCMYK()},r.prototype.setG=function(t){return this.rgb.g=I(t,0,255),this.updateHSLAndCMYK()},r.prototype.setB=function(t){return this.rgb.b=I(t,0,255),this.updateHSLAndCMYK()},r.prototype.setA=function(t){return this.hsl.a=this.rgb.a=I(t,0,1),this},r.prototype.setC=function(t){return this.cmyk.c=I(t,0,100),this.updateRGBAndHSL()},r.prototype.setM=function(t){return this.cmyk.m=I(t,0,100),this.updateRGBAndHSL()},r.prototype.setY=function(t){return this.cmyk.y=I(t,0,100),this.updateRGBAndHSL()},r.prototype.setK=function(t){return this.cmyk.k=I(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(r.prototype,"H",{get:function(){return j(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"S",{get:function(){return j(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"L",{get:function(){return j(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"R",{get:function(){return j(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"G",{get:function(){return j(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"B",{get:function(){return j(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"A",{get:function(){return j(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"C",{get:function(){return j(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"M",{get:function(){return j(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Y",{get:function(){return j(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"K",{get:function(){return j(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXObject",{get:function(){return W.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXAObject",{get:function(){return W.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBAObject",{get:function(){return i(i({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLAObject",{get:function(){return i(i({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYKAObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEX",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return Y.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:255*this.A};return Y.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGB",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return Y.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:this.A};return Y.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSL",{get:function(){var t=this.hsl,r={h:t.h,s:t.s,l:t.l};return Y.HSL(r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLA",{get:function(){return Y.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYK",{get:function(){return Y.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYKA",{get:function(){return Y.CMYK(i(i({},this.cmyk),{a:this.A}))},enumerable:!1,configurable:!0}),r.toHEX=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.HEX,Y.HEX)},r.toHEXA=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.HEXA,Y.HEX)},r.toRGB=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.RGB,Y.RGB)},r.toRGBA=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.RGBA,Y.RGB)},r.toHSL=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.HSL,Y.HSL)},r.toHSLA=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.HSLA,Y.HSL)},r.toCMYK=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.CMYK,Y.CMYK)},r.toCMYKA=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.CMYKA,Y.CMYK)},r.getBlendHEX=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),nt(t,r,e,n,W.HEX,Y.HEX)},r.getBlendHEXA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),nt(t,r,e,n,W.HEXA,Y.HEX)},r.getBlendRGB=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),nt(t,r,e,n,W.RGB,Y.RGB)},r.getBlendRGBA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),nt(t,r,e,n,W.RGBA,Y.RGB)},r.getBlendHSL=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),nt(t,r,e,n,W.HSL,Y.HSL)},r.getBlendHSLA=function(t,r,e,n){return void 0===e&&(e=5),void 0===n&&(n=!0),nt(t,r,e,n,W.HSLA,Y.HSL)},r.getMixHEX=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.HEX(r,e,n)},r.getMixHEXA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.HEXA(r,e,n)},r.getMixRGB=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.RGB(r,e,n)},r.getMixRGBA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.RGBA(r,e,n)},r.getMixHSL=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.HSL(r,e,n)},r.getMixHSLA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.HSLA(r,e,n)},r.getShades=function(t,r){return Z(t,r,!0)},r.getTints=function(t,r){return Z(t,r,!1)},r.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 tt.buildHarmony(r,P,n);case t.Harmony.SPLIT_COMPLEMENTARY:return tt.buildHarmony(r,N,n);case t.Harmony.TRIADIC:return tt.buildHarmony(r,V,n);case t.Harmony.TETRADIC:return tt.buildHarmony(r,U,n);case t.Harmony.SQUARE:return tt.buildHarmony(r,$,n);default:return tt.buildHarmony(r,w,n)}},r}();return t.ColorTranslator=ot,t}({});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc