colortranslator
Advanced tools
Comparing version 1.10.2 to 2.0.0
@@ -1,1 +0,1 @@ | ||
var t=function(){return t=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},t.apply(this,arguments)};function e(t,e,r){if(r||2===arguments.length)for(var n,a=0,o=e.length;a<o;a++)!n&&a in e||(n||(n=Array.prototype.slice.call(e,0,a)),n[a]=e[a]);return t.concat(n||Array.prototype.slice.call(e))}var r,n,a,o;!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",t.CMYK="CMYK"}(r||(r={})),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"}(a||(a={})),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,c,s,d,h,l,f=Object.keys(o),g=((i={})[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,i[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*\)$/,i[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*\)$/,i[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*\)$/,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",m="The provided color object doesn't have the proper keys or format",A=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,a=2*r-n;return{r:A(a,n,(t/=60)+2),g:A(a,n,t),b:A(a,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),a=1-n,o=(a-t)/a,i=(a-e)/a,u=(a-r)/a;return{c:Math.round(100*o),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 a=Math.max(t,e,r),o=Math.min(t,e,r),i=a-o,u=0,c=0,s=(a+o)/2;if(0===i)u=0,c=0;else{switch(a){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]],a=e?n:r,o=0,i=0,u=0,c=0;return(e?r:n).find((function(e,r){return t>=e[0]&&t<e[1]&&(o=e[0],i=e[1],u=a[r][0],c=a[r][1],!0)})),u+(c-u)/(i-o)*(t-o)},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=X(t).toString(16).toUpperCase();return 1===e.length?"0x0".concat(e):"0x".concat(e)},L=function(t){var e=X(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?X(t,6)/255:X(t,6):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={})[r.HEX]=function(t){return"#".concat(L(t.r)).concat(L(t.g)).concat(L(t.b)).concat(C(t,"a")&&L(t.a)||"")},u[r.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[r.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[r.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,6)},K=function(r,n,o){return n.reduce((function(n,i){return e(e([],n,!0),[t(t({},r),{h:o===a.ADDITIVE?Y(r.h+i):Y(M(M(r.h,!1)+i,!0))})],!1)}),[t({},r)])},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(r).reduce((function(t,e){var n=e[0],a=e[1];if(n!==r.HEX){var o=O(n.split(""));t[o]=a,t["A"+o]=a}return t}),{}),q=function(t){return"string"==typeof t?function(t){var e;if(Object.keys(r).some((function(r){if(g[r].test(t))return e=r,!0})),!e&&~f.indexOf(t)&&(e=r.HEX),!e)throw new Error(y);return e}(t):function(t){var e,n=!1,a=O(Object.keys(t));if($[a]&&(e=$[a]),e&&e===r.RGB){var o=Object.entries(t).some((function(t){return!F.test("".concat(t[1]))})),i=Object.entries(t).some((function(t){return!(b.test("".concat(t[1]))||!F.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255)}));o&&i&&(n=!0),o||(e=r.HEX)}if(!e||n)throw new Error(m);return e}(t)},Q=((c={})[r.HEX]=function(t){var e=(~f.indexOf(t)?o[t]:t).match(g.HEX),r={r:R(e[1]||e[5]),g:R(e[2]||e[6]),b:R(e[3]||e[7])},n=e[4]||e[8];return void 0!==n&&(r.a=R(n)/255),r},c[r.RGB]=function(t){var e=t.match(g.RGB),r=G(e[1]||e[5]),n=G(e[2]||e[6]),a=G(e[3]||e[7]),o=e[4]||e[8],i={r:Math.min(r,255),g:Math.min(n,255),b:Math.min(a,255)};return void 0!==o&&(i.a=T(o)),i},c[r.HSL]=function(t){var e=t.match(g.HSL),r=Y(e[1]||e[5]),n=D(e[2]||e[6]),a=D(e[3]||e[7]),o=e[4]||e[8],i=E(r,n,a);return void 0!==o&&(i.a=T(o)),i},c[r.CMYK]=function(t){var e=t.match(g.CMYK),r=k(e[1]||e[6]),n=k(e[2]||e[7]),a=k(e[3]||e[8]),o=k(e[4]||e[9]),i=e[5]||e[10],u=H(r,n,a,o);return void 0!==i&&(u.a=T(i)),u},c),_=((s={})[r.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[r.RGB]=function(t){return this.HEX(t)},s[r.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[r.CMYK]=function(t){var e=k("".concat(t.c)),r=k("".concat(t.m)),n=k("".concat(t.y)),a=k("".concat(t.k)),o=H(e,r,n,a);return C(t,"a")&&(o.a=T(t.a)),o},s),z=function(t,e){return void 0===e&&(e=q(t)),"string"==typeof t?Q[e](t):_[e](t)},J=((d={})[r.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[r.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[r.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[r.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,n,a){var o=q(e),i="string"==typeof e,u=z(e,o),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=a?s.l/(n+1):(100-s.l)/(n+1),h=Array(n).fill(null).map((function(e,r){return t(t({},s),{l:s.l+d*(r+1)*(1-2*+a)})}));switch(o){case r.HEX:default:return h.map((function(e){var r=E(e.h,e.s,e.l);return c&&(r.a=e.a),i?c?I.HEX(t(t({},r),{a:X(255*r.a,6)})):I.HEX(r):c?J.HEXA(r):J.HEX(r)}));case r.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 r.HSL:return h.map((function(e){return i?I.HSL(e):c?J.HSLA(t(t({},E(e.h,e.s,e.l)),{a:e.a})):J.HSL(E(e.h,e.s,e.l))}))}},Z=((h={buildHarmony:function(t,e,n){var a=q(t),o=z(t,a),i=B(o.r,o.g,o.b,o.a),u="string"==typeof t&&C(o,"a")||"string"!=typeof t&&C(t,"a"),c="string"==typeof t;switch(a){case r.HEX:default:return u?this.HEXA(i,e,n,c):this.HEX(i,e,n,c);case r.HSL:return u?this.HSLA(i,e,n,c):this.HSL(i,e,n,c);case r.RGB:return u?this.RGBA(i,e,n,c):this.RGB(i,e,n,c)}}})[r.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(e,r,n,a){return r(e,n).map((function(e){return a?I.HEX(t(t({},E(e.h,e.s,e.l)),{a:255*T(e.a)})):J.HEXA(t(t({},E(e.h,e.s,e.l)),{a:T(e.a)}))}))},h[r.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(e,r,n,a){return r(e,n).map((function(e){return a?I.RGB(t(t({},E(e.h,e.s,e.l)),{a:T(e.a)})):J.RGBA(t(t({},E(e.h,e.s,e.l)),{a:T(e.a)}))}))},h[r.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(e,r,n,a){return r(e,n).map((function(e){return a?I.HSL(t(t({},e),{a:T(e.a)})):J.HSLA(t(t({},E(e.h,e.s,e.l)),{a:T(e.a)}))}))},h),tt=((l={mix:function(e,r){var n,o,i,u,c,s,d,h,l,f,g,p,b,F,y,m=e.map((function(t){var e=q(t);return z(t,e)})),A=r===a.SUBTRACTIVE?m.map((function(t){var e,r,n,a,o,i,u,c,s,d,h,l,f,g,p=(e=t.r,r=t.g,n=t.b,a=Math.min(e,r,n),o=Math.min(255-e,255-r,255-n),i=e-a,u=r-a,c=n-a,s=Math.min(i,u),d=i-s,h=(u+s)/2,l=(c+u-s)/2,f=Math.max(d,h,l)/Math.max(i,u,c),g=isNaN(f)||f===1/0||f<=0?1:f,{r:d/g+o,y:h/g+o,b:l/g+o});return C(t,"a")&&(p.a=t.a),p})):null;function E(e){var n=r===a.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return e.reduce((function(e,n){var o=C(n,"a")?n.a:1,i={r:Math.min(e.r+n.r*o,255),b:Math.min(e.b+n.b*o,255),a:1-(1-o)*(1-e.a)},u="g"in e?e.g:e.y,c="g"in n?n.g:n.y;return t(t({},i),r===a.ADDITIVE?{g:Math.min(u+c*o,255)}:{y:Math.min(u+c*o,255)})}),n)}if(r===a.ADDITIVE)n=E(m);else{var H=E(A);o=H.r,i=H.y,u=H.b,c=Math.min(o,i,u),s=Math.min(255-o,255-i,255-u),d=o-c,h=i-c,l=u-c,f=Math.min(h,l),g=d+h-f,p=h+f,b=2*(l-f),F=Math.max(g,p,b)/Math.max(d,h,l),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)}}})[r.HEX]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?I.HEX(n):J.HEX(n)},l.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)},l[r.RGB]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?I.RGB(n):J.RGB(n)},l.RGBA=function(t,e,r){var n=this.mix(t,e);return r?I.RGB(n):J.RGBA(n)},l[r.HSL]=function(t,e,r){var n=this.mix(t,e),a=B(n.r,n.g,n.b);return delete n.a,delete a.a,r?I.HSL(a):J.HSL(n)},l.HSLA=function(t,e,r){var n=this.mix(t,e),a=B(n.r,n.g,n.b,n.a);return r?I.HSL(a):J.HSLA(n)},l),et=function(t,e,r,n,a){var o=n(z(t,e));return r?a(o):o},rt=function(t,e,r,n,a,o){r<1&&(r=5);var i=function(t,e,r){var n=r-1,a=(e.r-t.r)/n,o=(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+a*s),g:X(t.g+o*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=a(t);return n?o(e):e}))},nt=function(){function e(t){this.rgb=z(t),this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=t(t({},E(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=t(t({},H(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=B(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=v(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setH=function(t){return this.hsl.h=Y(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=j(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=j(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=j(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=j(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=j(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=j(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"H",{get:function(){return X(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return X(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return X(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return X(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return X(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return X(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return X(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return X(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return X(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return X(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return X(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return J.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return J.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return t(t({},this.RGBObject),{a:this.hsl.a})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return t(t({},this.HSLObject),{a:this.hsl.a})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKAObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K,a:this.hsl.a}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b};return I.HEX(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b,a:255*this.hsl.a};return I.HEX(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b};return I.RGB(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){var t=this.rgb,e={r:t.r,g:t.g,b:t.b,a:this.hsl.a};return I.RGB(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){var t=this.hsl,e={h:t.h,s:t.s,l:t.l};return I.HSL(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return I.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return I.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKA",{get:function(){return I.CMYK(t(t({},this.cmyk),{a:this.hsl.a}))},enumerable:!1,configurable:!0}),e.toHEX=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.HEX,I.HEX)},e.toHEXA=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.HEXA,I.HEX)},e.toRGB=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.RGB,I.RGB)},e.toRGBA=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.RGBA,I.RGB)},e.toHSL=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.HSL,I.HSL)},e.toHSLA=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.HSLA,I.HSL)},e.toCMYK=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.CMYK,I.CMYK)},e.toCMYKA=function(t,e){void 0===e&&(e=!0);var r=q(t);return et(t,r,e,J.CMYKA,I.CMYK)},e.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)},e.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)},e.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)},e.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)},e.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)},e.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)},e.getMixHEX=function(t,e,r){return void 0===e&&(e=a.ADDITIVE),void 0===r&&(r=!0),tt.HEX(t,e,r)},e.getMixHEXA=function(t,e,r){return void 0===e&&(e=a.ADDITIVE),void 0===r&&(r=!0),tt.HEXA(t,e,r)},e.getMixRGB=function(t,e,r){return void 0===e&&(e=a.ADDITIVE),void 0===r&&(r=!0),tt.RGB(t,e,r)},e.getMixRGBA=function(t,e,r){return void 0===e&&(e=a.ADDITIVE),void 0===r&&(r=!0),tt.RGBA(t,e,r)},e.getMixHSL=function(t,e,r){return void 0===e&&(e=a.ADDITIVE),void 0===r&&(r=!0),tt.HSL(t,e,r)},e.getMixHSLA=function(t,e,r){return void 0===e&&(e=a.ADDITIVE),void 0===r&&(r=!0),tt.HSLA(t,e,r)},e.getShades=function(t,e){return W(t,e,!0)},e.getTints=function(t,e){return W(t,e,!1)},e.getHarmony=function(t,e,r){switch(void 0===e&&(e=n.COMPLEMENTARY),void 0===r&&(r=a.ADDITIVE),e){case n.ANALOGOUS:return Z.buildHarmony(t,P,r);case n.SPLIT_COMPLEMENTARY:return Z.buildHarmony(t,x,r);case n.TRIADIC:return Z.buildHarmony(t,N,r);case n.TETRADIC:return Z.buildHarmony(t,V,r);case n.SQUARE:return Z.buildHarmony(t,U,r);default:return Z.buildHarmony(t,w,r)}},e}();export{nt as ColorTranslator,n as Harmony,a as Mix}; | ||
var t=function(){return t=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}var r,n,i,o;!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",t.CMYK="CMYK"}(r||(r={})),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"}(i||(i={})),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 a,u,c,s,d,h,l,f=Object.keys(o),g={HEX:["r","g","b","a"],RGB:["r","g","b","a"],HSL:["h","s","l","a"],CMYK:["c","m","y","k","a"]},p={BGR:r.RGB,ABGR:r.RGB,HLS:r.HSL,AHLS:r.HSL,CKMY:r.CMYK,ACKMY:r.CMYK},b=((a={})[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,a[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*\)$/,a[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*\)$/,a[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*\)$/,a),F=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,m=/^(\d+(?:\.\d+)?|\.\d+)%$/,y=/^0x([a-f\d]{1,2})$/i,A=/\{(\d+)\}/g,E="The provided string color doesn't have a correct format",v="The provided color object doesn't have the proper keys or format",H=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},B=function(t){return+"".concat(t).replace(m,"$1")},C=function(t){return m.test("".concat(t))?B(t):Math.min(+t,100)},M=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},R=function(t){var e=G(t,0).toString(16).toUpperCase();return 1===e.length?"0x0".concat(e):"0x".concat(e)},D=function(t,e){return void 0===e&&(e=!1),!e&&m.test(t)?Math.min(255*B(t)/100,255):y.test(t)?(3===t.length&&(t+=t.slice(-1)),e?G(t)/255:G(t)):Math.min(+t,e?1:255)},S=function(t){return Math.min(m.test(t)?B(t)/100:+t,1)},L=function(t){return e([],t,!0).sort().join("").toUpperCase()},G=function(t,e){void 0===e&&(e=6);var r=Math.pow(10,e);return Math.round(+t*r)/r},k=function(t,e,r){return Math.max(e,Math.min(t,r))},O=function(t,e,r){return r<0&&(r+=6),r>=6&&(r-=6),G(r<1?255*((e-t)*r+t):r<3?255*e:r<4?255*((e-t)*(4-r)+t):255*t)},X=function(t,e,r){e/=100;var n=(r/=100)<=.5?r*(e+1):r+e-r*e,i=2*r-n;return{r:O(i,n,(t/=60)+2),g:O(i,n,t),b:O(i,n,t-2)}},Y=function(t,e,r,n){return{r:G(255*(1-t)*(n=1-n)),g:G(255*(1-e)*n),b:G(255*(1-r)*n)}},j=function(t,e,r){t/=255,e/=255,r/=255;var n=1-Math.max(t,e,r),i=1-n,o=i&&(i-e)/i,a=i&&(i-r)/i;return{c:G(100*(i&&(i-t)/i)),m:G(100*o),y:G(100*a),k:G(100*n)}},K=function(t,e,r,n){void 0===n&&(n=1),t/=255,e/=255,r/=255,n=Math.min(n,1);var i=Math.max(t,e,r),o=Math.min(t,e,r),a=i-o,u=0,c=0,s=(i+o)/2;if(0!==a){switch(i){case t:u=(e-r)/a%6;break;case e:u=(r-t)/a+2;break;case r:u=(t-e)/a+4}(u=G(60*u))<0&&(u+=360),c=a/(1-Math.abs(2*s-1))}return{h:u,s:G(100*c),l:G(100*s),a:n}},I=function(t,e){if(t<0&&(t+=360),t>360&&(t-=360),360===t||0===t)return t;var r=[[0,120],[120,180],[180,240],[240,360]],n=[[0,60],[60,120],[120,240],[240,360]],i=e?n:r,o=0,a=0,u=0,c=0;return(e?r:n).find((function(e,r){return t>=e[0]&&t<e[1]&&(o=e[0],a=e[1],u=i[r][0],c=i[r][1],!0)})),u+(c-u)/(a-o)*(t-o)},P=function(t,e){void 0===e&&(e=!1);var r=L(Object.keys(t));return g[p[r]].reduce((function(r,n){var i,o,a=t[n];return void 0!==a&&(e?r.push((i=G(a,0),1===(o=G(i,0).toString(16).toUpperCase()).length&&(o="0".concat(o)),o)):r.push(a)),r}),[])},T=function(t,e){return t.replace(A,(function(t,r){return"".concat(e[+r-1])}))},w=((u={})[r.HEX]=function(t){var e=P(t,!0),r=4===e.length?"#{1}{2}{3}{4}":"#{1}{2}{3}";return T(r,e)},u[r.RGB]=function(t){var e=P(t),r=4===e.length?"rgba({1},{2},{3},{4})":"rgb({1},{2},{3})";return T(r,e)},u[r.HSL]=function(t){var e=P(t),r=4===e.length?"hsla({1},{2}%,{3}%,{4})":"hsl({1},{2}%,{3}%)";return T(r,e)},u[r.CMYK]=function(t){var e=P(t),r=5===e.length?"cmyk({1}%,{2}%,{3}%,{4}%,{5})":"cmyk({1}%,{2}%,{3}%,{4}%)";return T(r,e)},u),x=function(t){if("string"==typeof t){var e=t.match(F),r=+e[1];switch(e[2]){case"rad":t=G(180*r/Math.PI);break;case"turn":t=G(360*r);break;default:t=r}}return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},N=function(t){return"string"==typeof t&&(t=m.test(t)?B(t)/100:+t),isNaN(+t)||t>1?1:G(t)},V=function(r,n,o){return n.reduce((function(n,a){return e(e([],n,!0),[t(t({},r),{h:o===i.ADDITIVE?x(r.h+a):x(I(I(r.h,!1)+a,!0))})],!1)}),[t({},r)])},U=function(t,e){return V(t,[30,-30],e)},q=function(t,e){return V(t,[180],e)},$=function(t,e){return V(t,[150,-150],e)},_=function(t,e){return V(t,[120,-120],e)},Q=function(t,e){return V(t,[60,-120,180],e)},z=function(t,e){return V(t,[90,-90,180],e)},J=function(t){return"string"==typeof t?function(t){var e;if(Object.keys(r).some((function(r){if(b[r].test(t))return e=r,!0})),!e&&~f.indexOf(t)&&(e=r.HEX),!e)throw new Error(E);return e}(t):function(t){var e,n=!1,i=L(Object.keys(t));if(p[i]&&(e=p[i]),e&&e===r.RGB){var o=Object.entries(t).some((function(t){return!y.test("".concat(t[1]))})),a=Object.entries(t).some((function(t){return!(m.test("".concat(t[1]))||!y.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255)}));o&&a&&(n=!0),o||(e=r.HEX)}if(!e||n)throw new Error(v);return e}(t)},W=((c={})[r.HEX]=function(t){var e=(~f.indexOf(t)?o[t]:t).match(b.HEX),r={r:M(e[1]||e[5]),g:M(e[2]||e[6]),b:M(e[3]||e[7])},n=e[4]||e[8];return void 0!==n&&(r.a=M(n)/255),r},c[r.RGB]=function(t){var e=t.match(b.RGB),r=D(e[1]||e[5]),n=D(e[2]||e[6]),i=D(e[3]||e[7]),o=e[4]||e[8],a={r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255)};return void 0!==o&&(a.a=N(o)),a},c[r.HSL]=function(t){var e=t.match(b.HSL),r=x(e[1]||e[5]),n=C(e[2]||e[6]),i=C(e[3]||e[7]),o=e[4]||e[8],a=X(r,n,i);return void 0!==o&&(a.a=N(o)),a},c[r.CMYK]=function(t){var e=t.match(b.CMYK),r=S(e[1]||e[6]),n=S(e[2]||e[7]),i=S(e[3]||e[8]),o=S(e[4]||e[9]),a=e[5]||e[10],u=Y(r,n,i,o);return void 0!==a&&(u.a=N(a)),u},c),Z=((s={})[r.HEX]=function(t){var e={r:D("".concat(t.r)),g:D("".concat(t.g)),b:D("".concat(t.b))};return H(t,"a")&&(e.a=Math.min(D("".concat(t.a),!0),1)),e},s[r.RGB]=function(t){return this.HEX(t)},s[r.HSL]=function(t){var e=C("".concat(t.s)),r=C("".concat(t.l)),n=X(x(t.h),e,r);return H(t,"a")&&(n.a=N(t.a)),n},s[r.CMYK]=function(t){var e=S("".concat(t.c)),r=S("".concat(t.m)),n=S("".concat(t.y)),i=S("".concat(t.k)),o=Y(e,r,n,i);return H(t,"a")&&(o.a=N(t.a)),o},s),tt=function(t,e){return void 0===e&&(e=J(t)),"string"==typeof t?W[e](t):Z[e](t)},et=((d={})[r.HEX]=function(t){return{r:R(t.r),g:R(t.g),b:R(t.b)}},d.HEXA=function(t){var e=et.HEX(t);return e.a=H(t,"a")?R(255*t.a):"0xFF",e},d[r.RGB]=function(t,e){return H(t,"a")&&delete t.a,ot(t,e)},d.RGBA=function(t,e){return t.a=H(t,"a")?G(t.a):1,ot(t,e)},d[r.HSL]=function(t,e){var r=K(t.r,t.g,t.b);return delete r.a,at(r,e)},d.HSLA=function(t,e){var r=et.HSL(t,e);return r.a=H(t,"a")?G(t.a,e):1,r},d[r.CMYK]=function(t,e){return ut(j(t.r,t.g,t.b),e)},d.CMYKA=function(t,e){var r=et.CMYK(t,e);return r.a=H(t,"a")?G(t.a,e):1,r},d),rt=function(e,n,i,o){var a=J(e),u="string"==typeof e,c=tt(e,a),s="string"==typeof e&&H(c,"a")||"string"!=typeof e&&H(e,"a"),d=K(c.r,c.g,c.b,c.a);s||delete d.a;var h=i?d.l/(n+1):(100-d.l)/(n+1),l=Array(n).fill(null).map((function(e,r){return t(t({},d),{l:d.l+h*(r+1)*(1-2*+i)})}));switch(a){case r.HEX:default:return l.map((function(e){var r=X(e.h,e.s,e.l);return s&&(r.a=e.a),u?s?w.HEX(ot(t(t({},r),{a:G(255*r.a)}),o)):w.HEX(ot(r,o)):s?et.HEXA(r):et.HEX(r)}));case r.RGB:return l.map((function(t){var e=X(t.h,t.s,t.l);return s&&(e.a=t.a),u?w.RGB(ot(e,o)):s?et.RGBA(e,o):et.RGB(e,o)}));case r.HSL:return l.map((function(e){return u?w.HSL(at(e,o)):s?et.HSLA(t(t({},X(e.h,e.s,e.l)),{a:e.a}),o):et.HSL(X(e.h,e.s,e.l),o)}))}},nt=((h={buildHarmony:function(t,e,n,i){var o=J(t),a=tt(t,o),u=K(a.r,a.g,a.b,a.a),c="string"==typeof t&&H(a,"a")||"string"!=typeof t&&H(t,"a"),s="string"==typeof t;switch(o){case r.HEX:default:return c?this.HEXA(at(u,0),e,n,s):this.HEX(at(u,0),e,n,s);case r.HSL:return c?this.HSLA(u,e,n,s,i):this.HSL(u,e,n,s,i);case r.RGB:return c?this.RGBA(u,e,n,s,i):this.RGB(u,e,n,s,i)}}})[r.HEX]=function(t,e,r,n){return e(t,r).map((function(t){return n?w.HEX(X(t.h,t.s,t.l)):et.HEX(X(t.h,t.s,t.l))}))},h.HEXA=function(e,r,n,i){return r(e,n).map((function(e){return i?w.HEX(t(t({},X(e.h,e.s,e.l)),{a:255*N(e.a)})):et.HEXA(t(t({},X(e.h,e.s,e.l)),{a:N(e.a)}))}))},h[r.RGB]=function(t,e,r,n,i){return e(t,r).map((function(t){return n?w.RGB(ot(X(t.h,t.s,t.l),i)):et.RGB(X(t.h,t.s,t.l),i)}))},h.RGBA=function(e,r,n,i,o){return r(e,n).map((function(e){return i?w.RGB(ot(t(t({},X(e.h,e.s,e.l)),{a:N(e.a)}),o)):et.RGBA(t(t({},X(e.h,e.s,e.l)),{a:N(e.a)}),o)}))},h[r.HSL]=function(t,e,r,n,i){return e(t,r).map((function(t){return n?w.HSL(at({h:t.h,s:t.s,l:t.l},i)):et.HSL(X(t.h,t.s,t.l),i)}))},h.HSLA=function(e,r,n,i,o){return r(e,n).map((function(e){return i?w.HSL(at(t(t({},e),{a:N(e.a)}),o)):et.HSLA(t(t({},X(e.h,e.s,e.l)),{a:N(e.a)}),o)}))},h),it=((l={mix:function(e,r){var n,o,a,u,c,s,d,h,l,f,g,p,b,F,m,y=e.map((function(t){var e=J(t);return tt(t,e)})),A=r===i.SUBTRACTIVE?y.map((function(t){var e,r,n,i,o,a,u,c,s,d,h,l,f,g,p=(e=t.r,r=t.g,n=t.b,i=Math.min(e,r,n),o=Math.min(255-e,255-r,255-n),a=e-i,u=r-i,c=n-i,s=Math.min(a,u),d=a-s,h=(u+s)/2,l=(c+u-s)/2,f=Math.max(d,h,l)/Math.max(a,u,c),g=isNaN(f)||f===1/0||f<=0?1:f,{r:d/g+o,y:h/g+o,b:l/g+o});return H(t,"a")&&(p.a=t.a),p})):null;function E(e){var n=r===i.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return e.reduce((function(e,n){var o=H(n,"a")?n.a:1,a={r:Math.min(e.r+n.r*o,255),b:Math.min(e.b+n.b*o,255),a:1-(1-o)*(1-e.a)},u="g"in e?e.g:e.y,c="g"in n?n.g:n.y;return t(t({},a),r===i.ADDITIVE?{g:Math.min(u+c*o,255)}:{y:Math.min(u+c*o,255)})}),n)}if(r===i.ADDITIVE)n=E(y);else{var v=E(A);o=v.r,a=v.y,u=v.b,c=Math.min(o,a,u),s=Math.min(255-o,255-a,255-u),d=o-c,h=a-c,l=u-c,f=Math.min(h,l),g=d+h-f,p=h+f,b=2*(l-f),F=Math.max(g,p,b)/Math.max(d,h,l),m=isNaN(F)||F===1/0||F<=0?1:F,(n={r:g/m+s,g:p/m+s,b:b/m+s}).a=v.a}return{r:G(n.r),g:G(n.g),b:G(n.b),a:k(n.a,0,1)}}})[r.HEX]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?w.HEX(n):et.HEX(n)},l.HEXA=function(t,e,r){var n=this.mix(t,e);return n.a=r?255*N(n.a):N(n.a),r?w.HEX(n):et.HEXA(n)},l[r.RGB]=function(t,e,r,n){var i=this.mix(t,e);return delete i.a,r?w.RGB(i):et.RGB(i,n)},l.RGBA=function(t,e,r,n){var i=this.mix(t,e);return r?w.RGB(i):et.RGBA(i,n)},l[r.HSL]=function(t,e,r,n){var i=this.mix(t,e),o=K(i.r,i.g,i.b);return delete i.a,delete o.a,r?w.HSL(o):et.HSL(i,n)},l.HSLA=function(t,e,r,n){var i=this.mix(t,e),o=K(i.r,i.g,i.b,i.a);return r?w.HSL(o):et.HSLA(i,n)},l),ot=function(e,r){return t({r:G(e.r,r),g:G(e.g,r),b:G(e.b,r)},H(e,"a")?{a:G(e.a,r)}:{})},at=function(e,r){return t({h:G(e.h,r),s:G(e.s,r),l:G(e.l,r)},H(e,"a")?{a:G(e.a,r)}:{})},ut=function(t,e){return{c:G(t.c,e),m:G(t.m,e),y:G(t.y,e),k:G(t.k,e)}},ct=function(t,e,r,n,i,o){var a=i(tt(t,e),n);return r?o(a):a},st=function(t,e,r,n,i,o,a){r<1&&(r=5);var u=function(t,e,r){var n=r-1,i=(e.r-t.r)/n,o=(e.g-t.g)/n,a=(e.b-t.b)/n,u=N(t.a),c=(N(e.a)-u)/n;return Array(r).fill(null).map((function(r,s){return 0===s?t:s===n?e:{r:G(t.r+i*s),g:G(t.g+o*s),b:G(t.b+a*s),a:G(u+c*s)}}))}(tt(t),tt(e),r);return u.map((function(t){var e=o(t,i);return n?a(e):e}))},dt=function(){function e(t,e){void 0===e&&(e=6),this.rgb=tt(t),this._decimals=e,this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=t(t({},X(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=t(t({},Y(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=K(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=j(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setDecimals=function(t){return this._decimals=t,this},e.prototype.setH=function(t){return this.hsl.h=x(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=k(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=k(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=k(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=k(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=k(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=k(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=k(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=k(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=k(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=k(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"decimals",{get:function(){return this._decimals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"H",{get:function(){return G(this.hsl.h,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return G(this.hsl.s,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return G(this.hsl.l,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return G(this.rgb.r,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return G(this.rgb.g,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return G(this.rgb.b,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return G(this.hsl.a,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return G(this.cmyk.c,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return G(this.cmyk.m,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return G(this.cmyk.y,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return G(this.cmyk.k,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return et.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return et.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return t(t({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return t(t({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKAObject",{get:function(){return t(t({},this.CMYKObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){return w.HEX({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){return w.HEX({r:this.R,g:this.G,b:this.B,a:255*this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){return w.RGB({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){return w.RGB({r:this.R,g:this.G,b:this.B,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){return w.HSL({h:this.H,s:this.S,l:this.L})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return w.HSL({h:this.H,s:this.S,l:this.L,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return w.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKA",{get:function(){return w.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A})},enumerable:!1,configurable:!0}),e.toHEX=function(t,e){void 0===e&&(e=!0);var r=J(t);return ct(t,r,e,0,et.HEX,w.HEX)},e.toHEXA=function(t,e){void 0===e&&(e=!0);var r=J(t);return ct(t,r,e,0,et.HEXA,w.HEX)},e.toRGB=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return ct(t,n,e,r,et.RGB,w.RGB)},e.toRGBA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return ct(t,n,e,r,et.RGBA,w.RGB)},e.toHSL=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return ct(t,n,e,r,et.HSL,w.HSL)},e.toHSLA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return ct(t,n,e,r,et.HSLA,w.HSL)},e.toCMYK=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return ct(t,n,e,r,et.CMYK,w.CMYK)},e.toCMYKA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return ct(t,n,e,r,et.CMYKA,w.CMYK)},e.getBlendHEX=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),st(t,e,r,n,i,et.HEX,w.HEX)},e.getBlendHEXA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),st(t,e,r,n,i,et.HEXA,w.HEX)},e.getBlendRGB=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),st(t,e,r,n,i,et.RGB,w.RGB)},e.getBlendRGBA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),st(t,e,r,n,i,et.RGBA,w.RGB)},e.getBlendHSL=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),st(t,e,r,n,i,et.HSL,w.HSL)},e.getBlendHSLA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),st(t,e,r,n,i,et.HSLA,w.HSL)},e.getMixHEX=function(t,e,r){return void 0===e&&(e=i.ADDITIVE),void 0===r&&(r=!0),it.HEX(t,e,r)},e.getMixHEXA=function(t,e,r){return void 0===e&&(e=i.ADDITIVE),void 0===r&&(r=!0),it.HEXA(t,e,r)},e.getMixRGB=function(t,e,r,n){return void 0===e&&(e=i.ADDITIVE),void 0===r&&(r=!0),void 0===n&&(n=6),it.RGB(t,e,r,n)},e.getMixRGBA=function(t,e,r,n){return void 0===e&&(e=i.ADDITIVE),void 0===r&&(r=!0),void 0===n&&(n=6),it.RGBA(t,e,r,n)},e.getMixHSL=function(t,e,r,n){return void 0===e&&(e=i.ADDITIVE),void 0===r&&(r=!0),void 0===n&&(n=6),it.HSL(t,e,r,n)},e.getMixHSLA=function(t,e,r,n){return void 0===e&&(e=i.ADDITIVE),void 0===r&&(r=!0),void 0===n&&(n=6),it.HSLA(t,e,r,n)},e.getShades=function(t,e,r){return void 0===r&&(r=6),rt(t,e,!0,r)},e.getTints=function(t,e,r){return void 0===r&&(r=6),rt(t,e,!1,r)},e.getHarmony=function(t,e,r,o){return void 0===e&&(e=n.COMPLEMENTARY),void 0===r&&(r=i.ADDITIVE),void 0===o&&(o=6),function(t,e,r,i){var o;return(o={},o[n.ANALOGOUS]=nt.buildHarmony(e,U,i,r),o[n.COMPLEMENTARY]=nt.buildHarmony(e,q,i,r),o[n.SPLIT_COMPLEMENTARY]=nt.buildHarmony(e,$,i,r),o[n.TRIADIC]=nt.buildHarmony(e,_,i,r),o[n.TETRADIC]=nt.buildHarmony(e,Q,i,r),o[n.SQUARE]=nt.buildHarmony(e,z,i,r),o)[t]}(e,t,o,r)},e}();export{dt as ColorTranslator,n as Harmony,i as Mix}; |
@@ -61,6 +61,7 @@ type NumberOrString = number | string; | ||
declare class ColorTranslator { | ||
constructor(color: ColorInput); | ||
constructor(color: ColorInput, decimals?: number); | ||
private rgb; | ||
private hsl; | ||
private cmyk; | ||
private _decimals; | ||
private updateRGB; | ||
@@ -73,2 +74,3 @@ private updateRGBFromCMYK; | ||
private updateRGBAndHSL; | ||
setDecimals(decimals: number): ColorTranslator; | ||
setH(h: number): ColorTranslator; | ||
@@ -85,2 +87,3 @@ setS(s: number): ColorTranslator; | ||
setK(k: number): ColorTranslator; | ||
get decimals(): number; | ||
get H(): number; | ||
@@ -120,37 +123,37 @@ get S(): number; | ||
static toRGB(color: ColorInput): string; | ||
static toRGB(color: ColorInput, css: true): string; | ||
static toRGB(color: ColorInput, css: false): RGBObject; | ||
static toRGB(color: ColorInput, css: true, decimals?: number): string; | ||
static toRGB(color: ColorInput, css: false, decimals?: number): RGBObject; | ||
static toRGBA(color: ColorInput): string; | ||
static toRGBA(color: ColorInput, css: true): string; | ||
static toRGBA(color: ColorInput, css: false): RGBObject; | ||
static toRGBA(color: ColorInput, css: true, decimals?: number): string; | ||
static toRGBA(color: ColorInput, css: false, decimals?: number): RGBObject; | ||
static toHSL(color: ColorInput): string; | ||
static toHSL(color: ColorInput, css: true): string; | ||
static toHSL(color: ColorInput, css: false): HSLObject; | ||
static toHSL(color: ColorInput, css: true, decimals?: number): string; | ||
static toHSL(color: ColorInput, css: false, decimals?: number): HSLObject; | ||
static toHSLA(color: ColorInput): string; | ||
static toHSLA(color: ColorInput, css: true): string; | ||
static toHSLA(color: ColorInput, css: false): HSLObject; | ||
static toHSLA(color: ColorInput, css: true, decimals?: number): string; | ||
static toHSLA(color: ColorInput, css: false, decimals?: number): HSLObject; | ||
static toCMYK(color: ColorInput): string; | ||
static toCMYK(color: ColorInput, css: true): string; | ||
static toCMYK(color: ColorInput, css: false): CMYKObject; | ||
static toCMYK(color: ColorInput, css: true, decimals?: number): string; | ||
static toCMYK(color: ColorInput, css: false, decimals?: number): CMYKObject; | ||
static toCMYKA(color: ColorInput): string; | ||
static toCMYKA(color: ColorInput, css: true): string; | ||
static toCMYKA(color: ColorInput, css: false): CMYKObject; | ||
static toCMYKA(color: ColorInput, css: true, decimals?: number): string; | ||
static toCMYKA(color: ColorInput, css: false, decimals?: number): CMYKObject; | ||
static getBlendHEX(from: ColorInput, to: ColorInput, steps?: number): string[]; | ||
static getBlendHEX(from: ColorInput, to: ColorInput, steps: number, css: true): string[]; | ||
static getBlendHEX(from: ColorInput, to: ColorInput, steps: number, css: false): HEXObject[]; | ||
static getBlendHEX(from: ColorInput, to: ColorInput, steps: number, css: true, decimals?: number): string[]; | ||
static getBlendHEX(from: ColorInput, to: ColorInput, steps: number, css: false, decimals?: number): HEXObject[]; | ||
static getBlendHEXA(from: ColorInput, to: ColorInput, steps?: number): string[]; | ||
static getBlendHEXA(from: ColorInput, to: ColorInput, steps: number, css: true): string[]; | ||
static getBlendHEXA(from: ColorInput, to: ColorInput, steps: number, css: false): HEXObject[]; | ||
static getBlendHEXA(from: ColorInput, to: ColorInput, steps: number, css: true, decimals?: number): string[]; | ||
static getBlendHEXA(from: ColorInput, to: ColorInput, steps: number, css: false, decimals?: number): HEXObject[]; | ||
static getBlendRGB(from: ColorInput, to: ColorInput, steps?: number): string[]; | ||
static getBlendRGB(from: ColorInput, to: ColorInput, steps: number, css: true): string[]; | ||
static getBlendRGB(from: ColorInput, to: ColorInput, steps: number, css: false): RGBObject[]; | ||
static getBlendRGB(from: ColorInput, to: ColorInput, steps: number, css: true, decimals?: number): string[]; | ||
static getBlendRGB(from: ColorInput, to: ColorInput, steps: number, css: false, decimals?: number): RGBObject[]; | ||
static getBlendRGBA(from: ColorInput, to: ColorInput, steps: number): string[]; | ||
static getBlendRGBA(from: ColorInput, to: ColorInput, steps: number, css: true): string[]; | ||
static getBlendRGBA(from: ColorInput, to: ColorInput, steps: number, css: false): RGBObject[]; | ||
static getBlendRGBA(from: ColorInput, to: ColorInput, steps: number, css: true, decimals?: number): string[]; | ||
static getBlendRGBA(from: ColorInput, to: ColorInput, steps: number, css: false, decimals?: number): RGBObject[]; | ||
static getBlendHSL(from: ColorInput, to: ColorInput, steps?: number): string[]; | ||
static getBlendHSL(from: ColorInput, to: ColorInput, steps: number, css: true): string[]; | ||
static getBlendHSL(from: ColorInput, to: ColorInput, steps: number, css: false): HSLObject[]; | ||
static getBlendHSL(from: ColorInput, to: ColorInput, steps: number, css: true, decimals?: number): string[]; | ||
static getBlendHSL(from: ColorInput, to: ColorInput, steps: number, css: false, decimals?: number): HSLObject[]; | ||
static getBlendHSLA(from: ColorInput, to: ColorInput, steps?: number): string[]; | ||
static getBlendHSLA(from: ColorInput, to: ColorInput, steps: number, css: true): string[]; | ||
static getBlendHSLA(from: ColorInput, to: ColorInput, steps: number, css: false): HSLObject[]; | ||
static getBlendHSLA(from: ColorInput, to: ColorInput, steps: number, css: true, decimals?: number): string[]; | ||
static getBlendHSLA(from: ColorInput, to: ColorInput, steps: number, css: false, decimals?: number): HSLObject[]; | ||
static getMixHEX(colors: ColorInput[]): string; | ||
@@ -166,29 +169,29 @@ static getMixHEX(colors: ColorInput[], mode: Mix): string; | ||
static getMixRGB(colors: ColorInput[], mode: Mix): string; | ||
static getMixRGB(colors: ColorInput[], mode: Mix, css: true): string; | ||
static getMixRGB(colors: ColorInput[], mode: Mix, css: false): RGBObject; | ||
static getMixRGB(colors: ColorInput[], mode: Mix, css: true, decimals?: number): string; | ||
static getMixRGB(colors: ColorInput[], mode: Mix, css: false, decimals?: number): RGBObject; | ||
static getMixRGBA(colors: ColorInput[]): string; | ||
static getMixRGBA(colors: ColorInput[], mode: Mix): string; | ||
static getMixRGBA(colors: ColorInput[], mode: Mix, css: true): string; | ||
static getMixRGBA(colors: ColorInput[], mode: Mix, css: false): RGBObject; | ||
static getMixRGBA(colors: ColorInput[], mode: Mix, css: true, decimals?: number): string; | ||
static getMixRGBA(colors: ColorInput[], mode: Mix, css: false, decimals?: number): RGBObject; | ||
static getMixHSL(colors: ColorInput[]): string; | ||
static getMixHSL(colors: ColorInput[], mode: Mix): string; | ||
static getMixHSL(colors: ColorInput[], mode: Mix, css: true): string; | ||
static getMixHSL(colors: ColorInput[], mode: Mix, css: false): HSLObject; | ||
static getMixHSL(colors: ColorInput[], mode: Mix, css: true, decimals?: number): string; | ||
static getMixHSL(colors: ColorInput[], mode: Mix, css: false, decimals?: number): HSLObject; | ||
static getMixHSLA(colors: ColorInput[]): string; | ||
static getMixHSLA(colors: ColorInput[], mode: Mix): string; | ||
static getMixHSLA(colors: ColorInput[], mode: Mix, css: true): string; | ||
static getMixHSLA(colors: ColorInput[], mode: Mix, css: false): HSLObject; | ||
static getShades(color: string, shades: number): string[]; | ||
static getShades(color: HEXObject, shades: number): HEXObject[]; | ||
static getShades(color: RGBObject, shades: number): RGBObject[]; | ||
static getShades(color: HSLObjectGeneric, shades: number): HSLObject[]; | ||
static getTints(color: string, tints: number): string[]; | ||
static getTints(color: HEXObject, tints: number): HEXObject[]; | ||
static getTints(color: RGBObject, tints: number): RGBObject[]; | ||
static getTints(color: HSLObjectGeneric, tints: number): HSLObject[]; | ||
static getHarmony(color: string, armony?: Harmony, mode?: Mix): string[]; | ||
static getHarmony(color: HEXObject, armony?: Harmony, mode?: Mix): HEXObject[]; | ||
static getHarmony(color: RGBObject, armony?: Harmony, mode?: Mix): RGBObject[]; | ||
static getHarmony(color: HSLObjectGeneric, armony?: Harmony, mode?: Mix): HSLObject[]; | ||
static getMixHSLA(colors: ColorInput[], mode: Mix, css: true, decimals?: number): string; | ||
static getMixHSLA(colors: ColorInput[], mode: Mix, css: false, decimals?: number): HSLObject; | ||
static getShades(color: string, shades: number, decimals?: number): string[]; | ||
static getShades(color: HEXObject, shades: number, decimals?: number): HEXObject[]; | ||
static getShades(color: RGBObject, shades: number, decimals?: number): RGBObject[]; | ||
static getShades(color: HSLObjectGeneric, shades: number, decimals?: number): HSLObject[]; | ||
static getTints(color: string, tints: number, decimals?: number): string[]; | ||
static getTints(color: HEXObject, tints: number, decimals?: number): HEXObject[]; | ||
static getTints(color: RGBObject, tints: number, decimals?: number): RGBObject[]; | ||
static getTints(color: HSLObjectGeneric, tints: number, decimals?: number): HSLObject[]; | ||
static getHarmony(color: string, harmony?: Harmony, mode?: Mix, decimals?: number): string[]; | ||
static getHarmony(color: HEXObject, harmony?: Harmony, mode?: Mix, decimals?: number): HEXObject[]; | ||
static getHarmony(color: RGBObject, harmony?: Harmony, mode?: Mix, decimals?: number): RGBObject[]; | ||
static getHarmony(color: HSLObjectGeneric, harmony?: Harmony, mode?: Mix, decimals?: number): HSLObject[]; | ||
} | ||
export { ColorTranslator, Harmony, Mix, HEXObject, RGBObject, HSLObject, CMYKObject }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var t=function(){return t=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},t.apply(this,arguments)};function r(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))}var e,n,o,i;!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",t.CMYK="CMYK"}(e||(e={})),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,(o=exports.Mix||(exports.Mix={})).ADDITIVE="ADDITIVE",o.SUBTRACTIVE="SUBTRACTIVE",function(t){t.black="#000000",t.silver="#C0C0C0",t.gray="#808080",t.white="#FFFFFF",t.maroon="#800000",t.red="#FF0000",t.purple="#800080",t.fuchsia="#FF00FF",t.green="#008000",t.lime="#00FF00",t.olive="#808000",t.yellow="#FFFF00",t.navy="#000080",t.blue="#0000FF",t.teal="#008080",t.aqua="#00FFFF",t.orange="#FFA500",t.aliceblue="#F0F8FF",t.antiquewhite="#FAEBD7",t.aquamarine="#7FFFD4",t.azure="#F0FFFF",t.beige="#F5F5DC",t.bisque="#FFE4C4",t.blanchedalmond="#FFEBCD",t.blueviolet="#8A2BE2",t.brown="#A52A2A",t.burlywood="#DEB887",t.cadetblue="#5F9EA0",t.chartreuse="#7FFF00",t.chocolate="#D2691E",t.coral="#FF7F50",t.cornflowerblue="#6495ED",t.cornsilk="#FFF8DC",t.crimson="#DC143C",t.cyan="#00FFFF",t.darkblue="#00008B",t.darkcyan="#008B8B",t.darkgoldenrod="#B8860B",t.darkgray="#A9A9A9",t.darkgreen="#006400",t.darkgrey="#A9A9A9",t.darkkhaki="#BDB76B",t.darkmagenta="#8B008B",t.darkolivegreen="#556B2F",t.darkorange="#FF8C00",t.darkorchid="#9932CC",t.darkred="#8B0000",t.darksalmon="#E9967A",t.darkseagreen="#8FBC8F",t.darkslateblue="#483D8B",t.darkslategray="#2F4F4F",t.darkslategrey="#2F4F4F",t.darkturquoise="#00CED1",t.darkviolet="#9400D3",t.deeppink="#FF1493",t.deepskyblue="#00BFFF",t.dimgray="#696969",t.dimgrey="#696969",t.dodgerblue="#1E90FF",t.firebrick="#B22222",t.floralwhite="#FFFAF0",t.forestgreen="#228B22",t.gainsboro="#DCDCDC",t.ghostwhite="#F8F8FF",t.gold="#FFD700",t.goldenrod="#DAA520",t.greenyellow="#ADFF2F",t.grey="#808080",t.honeydew="#F0FFF0",t.hotpink="#FF69B4",t.indianred="#CD5C5C",t.indigo="#4B0082",t.ivory="#FFFFF0",t.khaki="#F0E68C",t.lavender="#E6E6FA",t.lavenderblush="#FFF0F5",t.lawngreen="#7CFC00",t.lemonchiffon="#FFFACD",t.lightblue="#ADD8E6",t.lightcoral="#F08080",t.lightcyan="#E0FFFF",t.lightgoldenrodyellow="#FAFAD2",t.lightgray="#D3D3D3",t.lightgreen="#90EE90",t.lightgrey="#D3D3D3",t.lightpink="#FFB6C1",t.lightsalmon="#FFA07A",t.lightseagreen="#20B2AA",t.lightskyblue="#87CEFA",t.lightslategray="#778899",t.lightslategrey="#778899",t.lightsteelblue="#B0C4DE",t.lightyellow="#FFFFE0",t.limegreen="#32CD32",t.linen="#FAF0E6",t.magenta="#FF00FF",t.mediumaquamarine="#66CDAA",t.mediumblue="#0000CD",t.mediumorchid="#BA55D3",t.mediumpurple="#9370DB",t.mediumseagreen="#3CB371",t.mediumslateblue="#7B68EE",t.mediumspringgreen="#00FA9A",t.mediumturquoise="#48D1CC",t.mediumvioletred="#C71585",t.midnightblue="#191970",t.mintcream="#F5FFFA",t.mistyrose="#FFE4E1",t.moccasin="#FFE4B5",t.navajowhite="#FFDEAD",t.oldlace="#FDF5E6",t.olivedrab="#6B8E23",t.orangered="#FF4500",t.orchid="#DA70D6",t.palegoldenrod="#EEE8AA",t.palegreen="#98FB98",t.paleturquoise="#AFEEEE",t.palevioletred="#DB7093",t.papayawhip="#FFEFD5",t.peachpuff="#FFDAB9",t.peru="#CD853F",t.pink="#FFC0CB",t.plum="#DDA0DD",t.powderblue="#B0E0E6",t.rosybrown="#BC8F8F",t.royalblue="#4169E1",t.saddlebrown="#8B4513",t.salmon="#FA8072",t.sandybrown="#F4A460",t.seagreen="#2E8B57",t.seashell="#FFF5EE",t.sienna="#A0522D",t.skyblue="#87CEEB",t.slateblue="#6A5ACD",t.slategray="#708090",t.slategrey="#708090",t.snow="#FFFAFA",t.springgreen="#00FF7F",t.steelblue="#4682B4",t.tan="#D2B48C",t.thistle="#D8BFD8",t.tomato="#FF6347",t.turquoise="#40E0D0",t.violet="#EE82EE",t.wheat="#F5DEB3",t.whitesmoke="#F5F5F5",t.yellowgreen="#9ACD32",t.rebeccapurple="#663399"}(i||(i={}));var a,u,c,s,d,l,h,f=Object.keys(i),p=((a={})[e.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[e.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[e.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[e.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=O(t).toString(16).toUpperCase();return 1===r.length?"0x0".concat(r):"0x".concat(r)},L=function(t){var r=O(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?O(t,6)/255:O(t,6):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={})[e.HEX]=function(t){return"#".concat(L(t.r)).concat(L(t.g)).concat(L(t.b)).concat(C(t,"a")&&L(t.a)||"")},u[e.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[e.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[e.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,6)},T=function(e,n,o){return n.reduce((function(n,i){return r(r([],n,!0),[t(t({},e),{h:o===exports.Mix.ADDITIVE?I(e.h+i):I(M(M(e.h,!1)+i,!0))})],!1)}),[t({},e)])},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(e).reduce((function(t,r){var n=r[0],o=r[1];if(n!==e.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 r;if(Object.keys(e).some((function(e){if(p[e].test(t))return r=e,!0})),!r&&~f.indexOf(t)&&(r=e.HEX),!r)throw new Error(y);return r}(t):function(t){var r,n=!1,o=x(Object.keys(t));if($[o]&&(r=$[o]),r&&r===e.RGB){var i=Object.entries(t).some((function(t){return!F.test("".concat(t[1]))})),a=Object.entries(t).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||(r=e.HEX)}if(!r||n)throw new Error(m);return r}(t)},Q=((c={})[e.HEX]=function(t){var r=(~f.indexOf(t)?i[t]:t).match(p.HEX),e={r:R(r[1]||r[5]),g:R(r[2]||r[6]),b:R(r[3]||r[7])},n=r[4]||r[8];return void 0!==n&&(e.a=R(n)/255),e},c[e.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[e.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[e.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={})[e.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[e.RGB]=function(t){return this.HEX(t)},s[e.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[e.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={})[e.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[e.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[e.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[e.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,n,o){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=o?s.l/(n+1):(100-s.l)/(n+1),l=Array(n).fill(null).map((function(r,e){return t(t({},s),{l:s.l+d*(e+1)*(1-2*+o)})}));switch(i){case e.HEX:default:return l.map((function(r){var e=E(r.h,r.s,r.l);return c&&(e.a=r.a),a?c?j.HEX(t(t({},e),{a:O(255*e.a,6)})):j.HEX(e):c?J.HEXA(e):J.HEX(e)}));case e.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 e.HSL:return l.map((function(r){return a?j.HSL(r):c?J.HSLA(t(t({},E(r.h,r.s,r.l)),{a:r.a})):J.HSL(E(r.h,r.s,r.l))}))}},Z=((l={buildHarmony:function(t,r,n){var o=q(t),i=z(t,o),a=B(i.r,i.g,i.b,i.a),u="string"==typeof t&&C(i,"a")||"string"!=typeof t&&C(t,"a"),c="string"==typeof t;switch(o){case e.HEX:default:return u?this.HEXA(a,r,n,c):this.HEX(a,r,n,c);case e.HSL:return u?this.HSLA(a,r,n,c):this.HSL(a,r,n,c);case e.RGB:return u?this.RGBA(a,r,n,c):this.RGB(a,r,n,c)}}})[e.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(r,e,n,o){return e(r,n).map((function(r){return o?j.HEX(t(t({},E(r.h,r.s,r.l)),{a:255*Y(r.a)})):J.HEXA(t(t({},E(r.h,r.s,r.l)),{a:Y(r.a)}))}))},l[e.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(r,e,n,o){return e(r,n).map((function(r){return o?j.RGB(t(t({},E(r.h,r.s,r.l)),{a:Y(r.a)})):J.RGBA(t(t({},E(r.h,r.s,r.l)),{a:Y(r.a)}))}))},l[e.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(r,e,n,o){return e(r,n).map((function(r){return o?j.HSL(t(t({},r),{a:Y(r.a)})):J.HSLA(t(t({},E(r.h,r.s,r.l)),{a:Y(r.a)}))}))},l),tt=((h={mix:function(r,e){var n,o,i,a,u,c,s,d,l,h,f,p,g,b,F,y=r.map((function(t){var r=q(t);return z(t,r)})),m=e===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(r){var n=e===exports.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=C(n,"a")?n.a:1,i={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)},a="g"in r?r.g:r.y,u="g"in n?n.g:n.y;return t(t({},i),e===exports.Mix.ADDITIVE?{g:Math.min(a+u*o,255)}:{y:Math.min(a+u*o,255)})}),n)}if(e===exports.Mix.ADDITIVE)n=A(y);else{var E=A(m);o=E.r,i=E.y,a=E.b,u=Math.min(o,i,a),c=Math.min(255-o,255-i,255-a),s=o-u,d=i-u,l=a-u,h=Math.min(d,l),f=s+d-h,p=d+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,(n={r:f/F+c,g:p/F+c,b:g/F+c}).a=E.a}return{r:O(n.r,2),g:O(n.g,2),b:O(n.b,2),a:X(n.a,0,1)}}})[e.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[e.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[e.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 r(t){this.rgb=z(t),this.updateHSL(),this.updateCMYK()}return r.prototype.updateRGB=function(){this.rgb=t(t({},E(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},r.prototype.updateRGBFromCMYK=function(){this.rgb=t(t({},H(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},r.prototype.updateHSL=function(){this.hsl=B(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},r.prototype.updateCMYK=function(){this.cmyk=v(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=I(t),this.updateRGBAndCMYK()},r.prototype.setS=function(t){return this.hsl.s=X(t,0,100),this.updateRGBAndCMYK()},r.prototype.setL=function(t){return this.hsl.l=X(t,0,100),this.updateRGBAndCMYK()},r.prototype.setR=function(t){return this.rgb.r=X(t,0,255),this.updateHSLAndCMYK()},r.prototype.setG=function(t){return this.rgb.g=X(t,0,255),this.updateHSLAndCMYK()},r.prototype.setB=function(t){return this.rgb.b=X(t,0,255),this.updateHSLAndCMYK()},r.prototype.setA=function(t){return this.hsl.a=this.rgb.a=X(t,0,1),this},r.prototype.setC=function(t){return this.cmyk.c=X(t,0,100),this.updateRGBAndHSL()},r.prototype.setM=function(t){return this.cmyk.m=X(t,0,100),this.updateRGBAndHSL()},r.prototype.setY=function(t){return this.cmyk.y=X(t,0,100),this.updateRGBAndHSL()},r.prototype.setK=function(t){return this.cmyk.k=X(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(r.prototype,"H",{get:function(){return O(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"S",{get:function(){return O(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"L",{get:function(){return O(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"R",{get:function(){return O(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"G",{get:function(){return O(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"B",{get:function(){return O(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"A",{get:function(){return O(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"C",{get:function(){return O(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"M",{get:function(){return O(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Y",{get:function(){return O(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"K",{get:function(){return O(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXObject",{get:function(){return J.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXAObject",{get:function(){return J.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 t(t({},this.RGBObject),{a:this.hsl.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 t(t({},this.HSLObject),{a:this.hsl.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.hsl.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 j.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.hsl.a};return j.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 j.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.hsl.a};return j.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 j.HSL(r)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLA",{get:function(){return j.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYK",{get:function(){return j.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYKA",{get:function(){return j.CMYK(t(t({},this.cmyk),{a:this.hsl.a}))},enumerable:!1,configurable:!0}),r.toHEX=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.HEX,j.HEX)},r.toHEXA=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.HEXA,j.HEX)},r.toRGB=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.RGB,j.RGB)},r.toRGBA=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.RGBA,j.RGB)},r.toHSL=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.HSL,j.HSL)},r.toHSLA=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.HSLA,j.HSL)},r.toCMYK=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.CMYK,j.CMYK)},r.toCMYKA=function(t,r){void 0===r&&(r=!0);var e=q(t);return rt(t,e,r,J.CMYKA,j.CMYK)},r.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)},r.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)},r.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)},r.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)},r.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)},r.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)},r.getMixHEX=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.HEX(t,r,e)},r.getMixHEXA=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.HEXA(t,r,e)},r.getMixRGB=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.RGB(t,r,e)},r.getMixRGBA=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.RGBA(t,r,e)},r.getMixHSL=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.HSL(t,r,e)},r.getMixHSLA=function(t,r,e){return void 0===r&&(r=exports.Mix.ADDITIVE),void 0===e&&(e=!0),tt.HSLA(t,r,e)},r.getShades=function(t,r){return W(t,r,!0)},r.getTints=function(t,r){return W(t,r,!1)},r.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)}},r}();exports.ColorTranslator=nt; | ||
"use strict";var t=function(){return t=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}var r,n,i,o;!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",t.CMYK="CMYK"}(r||(r={})),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,(i=exports.Mix||(exports.Mix={})).ADDITIVE="ADDITIVE",i.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 a,u,s,c,d,h,l,f=Object.keys(o),p={HEX:["r","g","b","a"],RGB:["r","g","b","a"],HSL:["h","s","l","a"],CMYK:["c","m","y","k","a"]},g={BGR:r.RGB,ABGR:r.RGB,HLS:r.HSL,AHLS:r.HSL,CKMY:r.CMYK,ACKMY:r.CMYK},b=((a={})[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,a[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*\)$/,a[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*\)$/,a[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*\)$/,a),m=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,y=/^(\d+(?:\.\d+)?|\.\d+)%$/,F=/^0x([a-f\d]{1,2})$/i,A=/\{(\d+)\}/g,H="The provided string color doesn't have a correct format",v="The provided color object doesn't have the proper keys or format",E=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},B=function(t){return+"".concat(t).replace(y,"$1")},M=function(t){return y.test("".concat(t))?B(t):Math.min(+t,100)},C=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},R=function(t){var e=G(t,0).toString(16).toUpperCase();return 1===e.length?"0x0".concat(e):"0x".concat(e)},D=function(t,e){return void 0===e&&(e=!1),!e&&y.test(t)?Math.min(255*B(t)/100,255):F.test(t)?(3===t.length&&(t+=t.slice(-1)),e?G(t)/255:G(t)):Math.min(+t,e?1:255)},S=function(t){return Math.min(y.test(t)?B(t)/100:+t,1)},L=function(t){return e([],t,!0).sort().join("").toUpperCase()},G=function(t,e){void 0===e&&(e=6);var r=Math.pow(10,e);return Math.round(+t*r)/r},k=function(t,e,r){return Math.max(e,Math.min(t,r))},x=function(t,e,r){return r<0&&(r+=6),r>=6&&(r-=6),G(r<1?255*((e-t)*r+t):r<3?255*e:r<4?255*((e-t)*(4-r)+t):255*t)},O=function(t,e,r){e/=100;var n=(r/=100)<=.5?r*(e+1):r+e-r*e,i=2*r-n;return{r:x(i,n,(t/=60)+2),g:x(i,n,t),b:x(i,n,t-2)}},X=function(t,e,r,n){return{r:G(255*(1-t)*(n=1-n)),g:G(255*(1-e)*n),b:G(255*(1-r)*n)}},Y=function(t,e,r){t/=255,e/=255,r/=255;var n=1-Math.max(t,e,r),i=1-n,o=i&&(i-e)/i,a=i&&(i-r)/i;return{c:G(100*(i&&(i-t)/i)),m:G(100*o),y:G(100*a),k:G(100*n)}},j=function(t,e,r,n){void 0===n&&(n=1),t/=255,e/=255,r/=255,n=Math.min(n,1);var i=Math.max(t,e,r),o=Math.min(t,e,r),a=i-o,u=0,s=0,c=(i+o)/2;if(0!==a){switch(i){case t:u=(e-r)/a%6;break;case e:u=(r-t)/a+2;break;case r:u=(t-e)/a+4}(u=G(60*u))<0&&(u+=360),s=a/(1-Math.abs(2*c-1))}return{h:u,s:G(100*s),l:G(100*c),a:n}},K=function(t,e){if(t<0&&(t+=360),t>360&&(t-=360),360===t||0===t)return t;var r=[[0,120],[120,180],[180,240],[240,360]],n=[[0,60],[60,120],[120,240],[240,360]],i=e?n:r,o=0,a=0,u=0,s=0;return(e?r:n).find((function(e,r){return t>=e[0]&&t<e[1]&&(o=e[0],a=e[1],u=i[r][0],s=i[r][1],!0)})),u+(s-u)/(a-o)*(t-o)},I=function(t,e){void 0===e&&(e=!1);var r=L(Object.keys(t));return p[g[r]].reduce((function(r,n){var i,o,a=t[n];return void 0!==a&&(e?r.push((i=G(a,0),1===(o=G(i,0).toString(16).toUpperCase()).length&&(o="0".concat(o)),o)):r.push(a)),r}),[])},T=function(t,e){return t.replace(A,(function(t,r){return"".concat(e[+r-1])}))},P=((u={})[r.HEX]=function(t){var e=I(t,!0),r=4===e.length?"#{1}{2}{3}{4}":"#{1}{2}{3}";return T(r,e)},u[r.RGB]=function(t){var e=I(t),r=4===e.length?"rgba({1},{2},{3},{4})":"rgb({1},{2},{3})";return T(r,e)},u[r.HSL]=function(t){var e=I(t),r=4===e.length?"hsla({1},{2}%,{3}%,{4})":"hsl({1},{2}%,{3}%)";return T(r,e)},u[r.CMYK]=function(t){var e=I(t),r=5===e.length?"cmyk({1}%,{2}%,{3}%,{4}%,{5})":"cmyk({1}%,{2}%,{3}%,{4}%)";return T(r,e)},u),w=function(t){if("string"==typeof t){var e=t.match(m),r=+e[1];switch(e[2]){case"rad":t=G(180*r/Math.PI);break;case"turn":t=G(360*r);break;default:t=r}}return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},N=function(t){return"string"==typeof t&&(t=y.test(t)?B(t)/100:+t),isNaN(+t)||t>1?1:G(t)},V=function(r,n,i){return n.reduce((function(n,o){return e(e([],n,!0),[t(t({},r),{h:i===exports.Mix.ADDITIVE?w(r.h+o):w(K(K(r.h,!1)+o,!0))})],!1)}),[t({},r)])},U=function(t,e){return V(t,[30,-30],e)},q=function(t,e){return V(t,[180],e)},$=function(t,e){return V(t,[150,-150],e)},_=function(t,e){return V(t,[120,-120],e)},Q=function(t,e){return V(t,[60,-120,180],e)},z=function(t,e){return V(t,[90,-90,180],e)},J=function(t){return"string"==typeof t?function(t){var e;if(Object.keys(r).some((function(r){if(b[r].test(t))return e=r,!0})),!e&&~f.indexOf(t)&&(e=r.HEX),!e)throw new Error(H);return e}(t):function(t){var e,n=!1,i=L(Object.keys(t));if(g[i]&&(e=g[i]),e&&e===r.RGB){var o=Object.entries(t).some((function(t){return!F.test("".concat(t[1]))})),a=Object.entries(t).some((function(t){return!(y.test("".concat(t[1]))||!F.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255)}));o&&a&&(n=!0),o||(e=r.HEX)}if(!e||n)throw new Error(v);return e}(t)},W=((s={})[r.HEX]=function(t){var e=(~f.indexOf(t)?o[t]:t).match(b.HEX),r={r:C(e[1]||e[5]),g:C(e[2]||e[6]),b:C(e[3]||e[7])},n=e[4]||e[8];return void 0!==n&&(r.a=C(n)/255),r},s[r.RGB]=function(t){var e=t.match(b.RGB),r=D(e[1]||e[5]),n=D(e[2]||e[6]),i=D(e[3]||e[7]),o=e[4]||e[8],a={r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255)};return void 0!==o&&(a.a=N(o)),a},s[r.HSL]=function(t){var e=t.match(b.HSL),r=w(e[1]||e[5]),n=M(e[2]||e[6]),i=M(e[3]||e[7]),o=e[4]||e[8],a=O(r,n,i);return void 0!==o&&(a.a=N(o)),a},s[r.CMYK]=function(t){var e=t.match(b.CMYK),r=S(e[1]||e[6]),n=S(e[2]||e[7]),i=S(e[3]||e[8]),o=S(e[4]||e[9]),a=e[5]||e[10],u=X(r,n,i,o);return void 0!==a&&(u.a=N(a)),u},s),Z=((c={})[r.HEX]=function(t){var e={r:D("".concat(t.r)),g:D("".concat(t.g)),b:D("".concat(t.b))};return E(t,"a")&&(e.a=Math.min(D("".concat(t.a),!0),1)),e},c[r.RGB]=function(t){return this.HEX(t)},c[r.HSL]=function(t){var e=M("".concat(t.s)),r=M("".concat(t.l)),n=O(w(t.h),e,r);return E(t,"a")&&(n.a=N(t.a)),n},c[r.CMYK]=function(t){var e=S("".concat(t.c)),r=S("".concat(t.m)),n=S("".concat(t.y)),i=S("".concat(t.k)),o=X(e,r,n,i);return E(t,"a")&&(o.a=N(t.a)),o},c),tt=function(t,e){return void 0===e&&(e=J(t)),"string"==typeof t?W[e](t):Z[e](t)},et=((d={})[r.HEX]=function(t){return{r:R(t.r),g:R(t.g),b:R(t.b)}},d.HEXA=function(t){var e=et.HEX(t);return e.a=E(t,"a")?R(255*t.a):"0xFF",e},d[r.RGB]=function(t,e){return E(t,"a")&&delete t.a,ot(t,e)},d.RGBA=function(t,e){return t.a=E(t,"a")?G(t.a):1,ot(t,e)},d[r.HSL]=function(t,e){var r=j(t.r,t.g,t.b);return delete r.a,at(r,e)},d.HSLA=function(t,e){var r=et.HSL(t,e);return r.a=E(t,"a")?G(t.a,e):1,r},d[r.CMYK]=function(t,e){return ut(Y(t.r,t.g,t.b),e)},d.CMYKA=function(t,e){var r=et.CMYK(t,e);return r.a=E(t,"a")?G(t.a,e):1,r},d),rt=function(e,n,i,o){var a=J(e),u="string"==typeof e,s=tt(e,a),c="string"==typeof e&&E(s,"a")||"string"!=typeof e&&E(e,"a"),d=j(s.r,s.g,s.b,s.a);c||delete d.a;var h=i?d.l/(n+1):(100-d.l)/(n+1),l=Array(n).fill(null).map((function(e,r){return t(t({},d),{l:d.l+h*(r+1)*(1-2*+i)})}));switch(a){case r.HEX:default:return l.map((function(e){var r=O(e.h,e.s,e.l);return c&&(r.a=e.a),u?c?P.HEX(ot(t(t({},r),{a:G(255*r.a)}),o)):P.HEX(ot(r,o)):c?et.HEXA(r):et.HEX(r)}));case r.RGB:return l.map((function(t){var e=O(t.h,t.s,t.l);return c&&(e.a=t.a),u?P.RGB(ot(e,o)):c?et.RGBA(e,o):et.RGB(e,o)}));case r.HSL:return l.map((function(e){return u?P.HSL(at(e,o)):c?et.HSLA(t(t({},O(e.h,e.s,e.l)),{a:e.a}),o):et.HSL(O(e.h,e.s,e.l),o)}))}},nt=((h={buildHarmony:function(t,e,n,i){var o=J(t),a=tt(t,o),u=j(a.r,a.g,a.b,a.a),s="string"==typeof t&&E(a,"a")||"string"!=typeof t&&E(t,"a"),c="string"==typeof t;switch(o){case r.HEX:default:return s?this.HEXA(at(u,0),e,n,c):this.HEX(at(u,0),e,n,c);case r.HSL:return s?this.HSLA(u,e,n,c,i):this.HSL(u,e,n,c,i);case r.RGB:return s?this.RGBA(u,e,n,c,i):this.RGB(u,e,n,c,i)}}})[r.HEX]=function(t,e,r,n){return e(t,r).map((function(t){return n?P.HEX(O(t.h,t.s,t.l)):et.HEX(O(t.h,t.s,t.l))}))},h.HEXA=function(e,r,n,i){return r(e,n).map((function(e){return i?P.HEX(t(t({},O(e.h,e.s,e.l)),{a:255*N(e.a)})):et.HEXA(t(t({},O(e.h,e.s,e.l)),{a:N(e.a)}))}))},h[r.RGB]=function(t,e,r,n,i){return e(t,r).map((function(t){return n?P.RGB(ot(O(t.h,t.s,t.l),i)):et.RGB(O(t.h,t.s,t.l),i)}))},h.RGBA=function(e,r,n,i,o){return r(e,n).map((function(e){return i?P.RGB(ot(t(t({},O(e.h,e.s,e.l)),{a:N(e.a)}),o)):et.RGBA(t(t({},O(e.h,e.s,e.l)),{a:N(e.a)}),o)}))},h[r.HSL]=function(t,e,r,n,i){return e(t,r).map((function(t){return n?P.HSL(at({h:t.h,s:t.s,l:t.l},i)):et.HSL(O(t.h,t.s,t.l),i)}))},h.HSLA=function(e,r,n,i,o){return r(e,n).map((function(e){return i?P.HSL(at(t(t({},e),{a:N(e.a)}),o)):et.HSLA(t(t({},O(e.h,e.s,e.l)),{a:N(e.a)}),o)}))},h),it=((l={mix:function(e,r){var n,i,o,a,u,s,c,d,h,l,f,p,g,b,m,y=e.map((function(t){var e=J(t);return tt(t,e)})),F=r===exports.Mix.SUBTRACTIVE?y.map((function(t){var e,r,n,i,o,a,u,s,c,d,h,l,f,p,g=(e=t.r,r=t.g,n=t.b,i=Math.min(e,r,n),o=Math.min(255-e,255-r,255-n),a=e-i,u=r-i,s=n-i,c=Math.min(a,u),d=a-c,h=(u+c)/2,l=(s+u-c)/2,f=Math.max(d,h,l)/Math.max(a,u,s),p=isNaN(f)||f===1/0||f<=0?1:f,{r:d/p+o,y:h/p+o,b:l/p+o});return E(t,"a")&&(g.a=t.a),g})):null;function A(e){var n=r===exports.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return e.reduce((function(e,n){var i=E(n,"a")?n.a:1,o={r:Math.min(e.r+n.r*i,255),b:Math.min(e.b+n.b*i,255),a:1-(1-i)*(1-e.a)},a="g"in e?e.g:e.y,u="g"in n?n.g:n.y;return t(t({},o),r===exports.Mix.ADDITIVE?{g:Math.min(a+u*i,255)}:{y:Math.min(a+u*i,255)})}),n)}if(r===exports.Mix.ADDITIVE)n=A(y);else{var H=A(F);i=H.r,o=H.y,a=H.b,u=Math.min(i,o,a),s=Math.min(255-i,255-o,255-a),c=i-u,d=o-u,h=a-u,l=Math.min(d,h),f=c+d-l,p=d+l,g=2*(h-l),b=Math.max(f,p,g)/Math.max(c,d,h),m=isNaN(b)||b===1/0||b<=0?1:b,(n={r:f/m+s,g:p/m+s,b:g/m+s}).a=H.a}return{r:G(n.r),g:G(n.g),b:G(n.b),a:k(n.a,0,1)}}})[r.HEX]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?P.HEX(n):et.HEX(n)},l.HEXA=function(t,e,r){var n=this.mix(t,e);return n.a=r?255*N(n.a):N(n.a),r?P.HEX(n):et.HEXA(n)},l[r.RGB]=function(t,e,r,n){var i=this.mix(t,e);return delete i.a,r?P.RGB(i):et.RGB(i,n)},l.RGBA=function(t,e,r,n){var i=this.mix(t,e);return r?P.RGB(i):et.RGBA(i,n)},l[r.HSL]=function(t,e,r,n){var i=this.mix(t,e),o=j(i.r,i.g,i.b);return delete i.a,delete o.a,r?P.HSL(o):et.HSL(i,n)},l.HSLA=function(t,e,r,n){var i=this.mix(t,e),o=j(i.r,i.g,i.b,i.a);return r?P.HSL(o):et.HSLA(i,n)},l),ot=function(e,r){return t({r:G(e.r,r),g:G(e.g,r),b:G(e.b,r)},E(e,"a")?{a:G(e.a,r)}:{})},at=function(e,r){return t({h:G(e.h,r),s:G(e.s,r),l:G(e.l,r)},E(e,"a")?{a:G(e.a,r)}:{})},ut=function(t,e){return{c:G(t.c,e),m:G(t.m,e),y:G(t.y,e),k:G(t.k,e)}},st=function(t,e,r,n,i,o){var a=i(tt(t,e),n);return r?o(a):a},ct=function(t,e,r,n,i,o,a){r<1&&(r=5);var u=function(t,e,r){var n=r-1,i=(e.r-t.r)/n,o=(e.g-t.g)/n,a=(e.b-t.b)/n,u=N(t.a),s=(N(e.a)-u)/n;return Array(r).fill(null).map((function(r,c){return 0===c?t:c===n?e:{r:G(t.r+i*c),g:G(t.g+o*c),b:G(t.b+a*c),a:G(u+s*c)}}))}(tt(t),tt(e),r);return u.map((function(t){var e=o(t,i);return n?a(e):e}))},dt=function(){function e(t,e){void 0===e&&(e=6),this.rgb=tt(t),this._decimals=e,this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=t(t({},O(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=t(t({},X(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=j(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=Y(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setDecimals=function(t){return this._decimals=t,this},e.prototype.setH=function(t){return this.hsl.h=w(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=k(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=k(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=k(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=k(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=k(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=k(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=k(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=k(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=k(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=k(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"decimals",{get:function(){return this._decimals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"H",{get:function(){return G(this.hsl.h,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return G(this.hsl.s,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return G(this.hsl.l,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return G(this.rgb.r,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return G(this.rgb.g,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return G(this.rgb.b,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return G(this.hsl.a,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return G(this.cmyk.c,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return G(this.cmyk.m,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return G(this.cmyk.y,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return G(this.cmyk.k,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return et.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return et.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return t(t({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return t(t({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKAObject",{get:function(){return t(t({},this.CMYKObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){return P.HEX({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){return P.HEX({r:this.R,g:this.G,b:this.B,a:255*this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){return P.RGB({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){return P.RGB({r:this.R,g:this.G,b:this.B,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){return P.HSL({h:this.H,s:this.S,l:this.L})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return P.HSL({h:this.H,s:this.S,l:this.L,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return P.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKA",{get:function(){return P.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A})},enumerable:!1,configurable:!0}),e.toHEX=function(t,e){void 0===e&&(e=!0);var r=J(t);return st(t,r,e,0,et.HEX,P.HEX)},e.toHEXA=function(t,e){void 0===e&&(e=!0);var r=J(t);return st(t,r,e,0,et.HEXA,P.HEX)},e.toRGB=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return st(t,n,e,r,et.RGB,P.RGB)},e.toRGBA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return st(t,n,e,r,et.RGBA,P.RGB)},e.toHSL=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return st(t,n,e,r,et.HSL,P.HSL)},e.toHSLA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return st(t,n,e,r,et.HSLA,P.HSL)},e.toCMYK=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return st(t,n,e,r,et.CMYK,P.CMYK)},e.toCMYKA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=J(t);return st(t,n,e,r,et.CMYKA,P.CMYK)},e.getBlendHEX=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),ct(t,e,r,n,i,et.HEX,P.HEX)},e.getBlendHEXA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),ct(t,e,r,n,i,et.HEXA,P.HEX)},e.getBlendRGB=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),ct(t,e,r,n,i,et.RGB,P.RGB)},e.getBlendRGBA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),ct(t,e,r,n,i,et.RGBA,P.RGB)},e.getBlendHSL=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),ct(t,e,r,n,i,et.HSL,P.HSL)},e.getBlendHSLA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),ct(t,e,r,n,i,et.HSLA,P.HSL)},e.getMixHEX=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),it.HEX(t,e,r)},e.getMixHEXA=function(t,e,r){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),it.HEXA(t,e,r)},e.getMixRGB=function(t,e,r,n){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),void 0===n&&(n=6),it.RGB(t,e,r,n)},e.getMixRGBA=function(t,e,r,n){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),void 0===n&&(n=6),it.RGBA(t,e,r,n)},e.getMixHSL=function(t,e,r,n){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),void 0===n&&(n=6),it.HSL(t,e,r,n)},e.getMixHSLA=function(t,e,r,n){return void 0===e&&(e=exports.Mix.ADDITIVE),void 0===r&&(r=!0),void 0===n&&(n=6),it.HSLA(t,e,r,n)},e.getShades=function(t,e,r){return void 0===r&&(r=6),rt(t,e,!0,r)},e.getTints=function(t,e,r){return void 0===r&&(r=6),rt(t,e,!1,r)},e.getHarmony=function(t,e,r,n){return void 0===e&&(e=exports.Harmony.COMPLEMENTARY),void 0===r&&(r=exports.Mix.ADDITIVE),void 0===n&&(n=6),function(t,e,r,n){var i;return(i={},i[exports.Harmony.ANALOGOUS]=nt.buildHarmony(e,U,n,r),i[exports.Harmony.COMPLEMENTARY]=nt.buildHarmony(e,q,n,r),i[exports.Harmony.SPLIT_COMPLEMENTARY]=nt.buildHarmony(e,$,n,r),i[exports.Harmony.TRIADIC]=nt.buildHarmony(e,_,n,r),i[exports.Harmony.TETRADIC]=nt.buildHarmony(e,Q,n,r),i[exports.Harmony.SQUARE]=nt.buildHarmony(e,z,n,r),i)[t]}(e,t,n,r)},e}();exports.ColorTranslator=dt; |
{ | ||
"name": "colortranslator", | ||
"version": "1.10.2", | ||
"version": "2.0.0", | ||
"description": "A JavaScript library, written in TypeScript, to convert among different color models", | ||
@@ -22,3 +22,3 @@ "main": "index.js", | ||
"test": "jest --verbose", | ||
"lint": "eslint src/**/*.ts", | ||
"lint": "eslint \"src/**/*.{js,ts}\" \"tests/**/*.ts\"", | ||
"clean": "./scripts/clean.sh", | ||
@@ -62,6 +62,6 @@ "finish": "./scripts/finish.sh", | ||
"devDependencies": { | ||
"@types/jest": "^29.2.4", | ||
"@types/node": "^18.11.17", | ||
"@typescript-eslint/eslint-plugin": "^5.47.0", | ||
"@typescript-eslint/parser": "^5.47.0", | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "^20.2.0", | ||
"@typescript-eslint/eslint-plugin": "^5.59.6", | ||
"@typescript-eslint/parser": "^5.59.6", | ||
"clean-webpack-plugin": "^4.0.0", | ||
@@ -71,23 +71,23 @@ "copy-webpack-plugin": "^11.0.0", | ||
"css-loader": "^6.7.3", | ||
"eslint": "^8.30.0", | ||
"eslint": "^8.40.0", | ||
"google-code-prettify": "^1.0.5", | ||
"html-webpack-plugin": "^5.5.0", | ||
"jest": "^29.3.1", | ||
"mini-css-extract-plugin": "^2.7.2", | ||
"html-webpack-plugin": "^5.5.1", | ||
"jest": "^29.5.0", | ||
"mini-css-extract-plugin": "^2.7.5", | ||
"node-sass": "^8.0.0", | ||
"plop": "^3.1.1", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^3.8.1", | ||
"plop": "^3.1.2", | ||
"rimraf": "^5.0.1", | ||
"rollup": "^3.22.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-ts": "^3.1.1", | ||
"sass-loader": "^13.2.0", | ||
"style-loader": "^3.3.1", | ||
"ts-jest": "^29.0.3", | ||
"rollup-plugin-ts": "^3.2.0", | ||
"sass-loader": "^13.2.2", | ||
"style-loader": "^3.3.2", | ||
"ts-jest": "^29.1.0", | ||
"ts-loader": "^9.4.2", | ||
"typescript": "^4.9.4", | ||
"webpack": "^5.75.0", | ||
"webpack-cli": "^5.0.1", | ||
"webpack-dev-server": "^4.11.1", | ||
"typescript": "^5.0.4", | ||
"webpack": "^5.83.1", | ||
"webpack-cli": "^5.1.1", | ||
"webpack-dev-server": "^4.15.0", | ||
"whatwg-fetch": "^3.6.2" | ||
} | ||
} |
@@ -158,2 +158,6 @@ <p align="center"> | ||
```javascript | ||
ColorTranslator(color: ColorInput, decimals?: number = 6) | ||
``` | ||
It is possible to instantiate the class using any of the previous inputs: | ||
@@ -181,15 +185,16 @@ | ||
| Public methods | Input | Description | | ||
| -------------- | --------------- | -------------------------------------------------- | | ||
| setH | 0 ≤ input ≤ 360 | Set the color hue | | ||
| setS | 0 ≤ input ≤ 100 | Set the color saturation percentage | | ||
| setL | 0 ≤ input ≤ 100 | Set the color lightness percentage | | ||
| setR | 0 ≤ input ≤ 255 | Set the red value of the color | | ||
| setG | 0 ≤ input ≤ 255 | Set the green value of the color | | ||
| setB | 0 ≤ input ≤ 255 | Set the blue value of the color | | ||
| setC | 0 ≤ input ≤ 100 | Set the CMYK cyan percentage value of the color | | ||
| setM | 0 ≤ input ≤ 100 | Set the CMYK magenta percentage value of the color | | ||
| setY | 0 ≤ input ≤ 100 | Set the CMYK yellow percentage value of the color | | ||
| setK | 0 ≤ input ≤ 100 | Set the CMYK black percentage value of the color | | ||
| setA | 0 ≤ input ≤ 1 | Set the alpha value of the color | | ||
| Public methods | Input | Description | | ||
| -------------- | --------------- | ------------------------------------------------------- | | ||
| setH | 0 ≤ input ≤ 360 | Set the color hue | | ||
| setS | 0 ≤ input ≤ 100 | Set the color saturation percentage | | ||
| setL | 0 ≤ input ≤ 100 | Set the color lightness percentage | | ||
| setR | 0 ≤ input ≤ 255 | Set the red value of the color | | ||
| setG | 0 ≤ input ≤ 255 | Set the green value of the color | | ||
| setB | 0 ≤ input ≤ 255 | Set the blue value of the color | | ||
| setC | 0 ≤ input ≤ 100 | Set the CMYK cyan percentage value of the color | | ||
| setM | 0 ≤ input ≤ 100 | Set the CMYK magenta percentage value of the color | | ||
| setY | 0 ≤ input ≤ 100 | Set the CMYK yellow percentage value of the color | | ||
| setK | 0 ≤ input ≤ 100 | Set the CMYK black percentage value of the color | | ||
| setA | 0 ≤ input ≤ 1 | Set the alpha value of the color | | ||
| setDecimals | number | Set the maximum number of decimals for the color values | | ||
@@ -256,2 +261,9 @@ ###### Class public methods examples | ||
And a property to get the maximum number of decimals for the color calculations | ||
| Property | Description | | ||
| -------- | ---------------------------------------------------------------- | | ||
| decimals | Get maximum number of decimals for the color values calculations | | ||
###### Class public properties examples | ||
@@ -262,3 +274,3 @@ | ||
```javascript | ||
const color = new ColorTranslator('#FF00FF'); | ||
const color = new ColorTranslator('#FF00FF', 2); | ||
@@ -270,2 +282,3 @@ color.R; // 255 | ||
color.HSLA; // hsla(300,100%,50%,1) | ||
color.decimals; // 2 | ||
``` | ||
@@ -281,3 +294,3 @@ | ||
The static methods to convert colors accept any of the mentioned inputs as the first parameter. The second parameter is optional and it specifies if the output should be a CSS string or an object: | ||
The static methods to convert colors accept any of the mentioned inputs as the first parameter. The second parameter is optional and it specifies if the output should be a CSS string or an object. The third parameter is also optional and it indicates the maximum number of decimals for the color values calculations (by default `6`): | ||
@@ -287,3 +300,4 @@ ```typescript | ||
color: string | object, | ||
css: boolean = true | ||
css: boolean = true, | ||
decimals: number = 6 | ||
) | ||
@@ -310,3 +324,3 @@ ``` | ||
ColorTranslator.toRGBA('hsl(50, 20%, 90%)'); // rgba(235,233,224,1) | ||
ColorTranslator.toRGBA('hsl(50, 20%, 90%)', true, 0); // rgba(235,233,224,1) | ||
@@ -321,5 +335,7 @@ ColorTranslator.toHSL('rgb(255, 0, 0)'); // hsl(0,100%,50%) | ||
ColorTranslator.toRGB({ h: 115, s: '70%', l: '45%' }); // rgb(48,195,34) | ||
ColorTranslator.toRGB({ h: 115, s: '70%', l: '45%' }, true, 0); // rgb(48,195,34) | ||
ColorTranslator.toHSLA({ r: 115, g: 200, b: 150, a: 0.5 }); // hsla(145,44%,62%,0.5) | ||
ColorTranslator.toHSLA({ r: 115, g: 200, b: 150, a: 0.5 }, true, 1); // hsla(144.7,43.6%,61.8%,0.5) | ||
ColorTranslator.toHSLA({ r: 95, g: 23, b: 12, a: Math.SQRT1_2 }, true, 4); // hsla(7.9518,77.5701%,20.9804%,0.7071) | ||
``` | ||
@@ -331,3 +347,3 @@ | ||
The static methods to create color blends accept any of the mentioned inputs as the first and second parameter, the third parameter is optional and it is the number of steps of the blending, and the fourth parameter is also optional and it specifies if the output colors should be CSS strings or objects: | ||
The static methods to create color blends accept any of the mentioned inputs as the first and second parameter, the third parameter is optional and it is the number of steps of the blending. The fourth parameter is also optional and it specifies if the output colors should be CSS strings or objects. And the fifth parameter is also optional and it indicates the maximum number of decimals for the color values calculations (by default `6`): | ||
@@ -339,3 +355,4 @@ ```typescript | ||
steps: number = 5, | ||
css: boolean = true | ||
css: boolean = true, | ||
decimals: number = 6 | ||
) | ||
@@ -391,3 +408,3 @@ ``` | ||
The static methods to get [shades or tints of a color](https://en.m.wikipedia.org/wiki/Tints_and_shades) accept any of the mentioned inputs as the first parameter, and a second parameter that specifies the number of shades or tints that should be returned. This method will return the colors in the same format that was sent as input: | ||
The static methods to get [shades or tints of a color](https://en.m.wikipedia.org/wiki/Tints_and_shades) accept any of the mentioned inputs as the first parameter. The second parameter specifies the number of shades or tints that should be returned and the third parameter is optional and it indicates the maximum number of decimals for the color values calculations (by default `6`). This method will return the colors in the same format that was sent as input: | ||
@@ -397,3 +414,4 @@ ```typescript | ||
color: string | object, | ||
shades: number | ||
shades: number, | ||
decimals: number = 6 | ||
) | ||
@@ -403,3 +421,4 @@ | ||
color: string | object, | ||
tints: number | ||
tints: number, | ||
decimals: number = 6 | ||
) | ||
@@ -432,7 +451,7 @@ ``` | ||
// [ | ||
// {r: 255, g: 43, b: 43, a: 0.5}, | ||
// {r: 255, g: 42.5, b: 42.5, a: 0.5}, | ||
// {r: 255, g: 85, b: 85, a: 0.5}, | ||
// {r: 255, g: 128, b: 128, a: 0.5}, | ||
// {r: 255, g: 127.5, b: 127.5, a: 0.5}, | ||
// {r: 255, g: 170, b: 170, a: 0.5}, | ||
// {r: 255, g: 213, b: 213, a: 0.5} | ||
// {r: 255, g: 212.5, b: 212.5, a: 0.5} | ||
// ] | ||
@@ -445,3 +464,3 @@ ``` | ||
The static methods to mix colors accept an array of any of the mentioned inputs as the first parameter. The second parameter is optional and specifies the mixing mode (by default it will be `Mix.ADDITIVE`). The third parameter is also optional and it specifies if the output should be a CSS string or an object: | ||
The static methods to mix colors accept an array of any of the mentioned inputs as the first parameter. The second parameter is optional and specifies the mixing mode (by default it will be `Mix.ADDITIVE`). The third parameter is also optional and it specifies if the output should be a CSS string or an object, and the fourth parameter is also optional and it indicates the maximum number of decimals for the color values calculations (by default `6`): | ||
@@ -454,3 +473,4 @@ > **Note:** The subtractive mix simulates the mixing of pigments, to achieve this, the rgb colors are converted to ryb color model, the addition is performed in this mode and at the end the result is converted back to rgb. The result is OK most of the time, but as this is not a real mix of pigments, sometimes the result could differ from the reality. | ||
mode: Mix = Mix.ADDITIVE, | ||
css: boolean = true | ||
css: boolean = true, | ||
decimals: number = 6 | ||
) | ||
@@ -481,3 +501,3 @@ ``` | ||
ColorTranslator.getMixHEXA(['#F00', 'rgb(0, 0, 255)'], Mix.ADDITIVE, true); | ||
ColorTranslator.getMixHEXA(['#F00', 'rgb(0, 0, 255)'], Mix.ADDITIVE, false); | ||
@@ -488,3 +508,3 @@ // { r: '0xFF', g: '0x00', b: '0xFF', a: '0xFF' } | ||
// #FF7F00 | ||
// #FF8800 | ||
``` | ||
@@ -496,3 +516,3 @@ | ||
The static method to create color harmonies accepts three parmeters, the first one could be any of the mentioned inputs, the second one is optional and it is to specify the kind of harmony (by default it will be `Harmony.COMPLEMENTARY`), and the third one is also optional and it specifies if the returned harmony is based on additive or subtractive colors (by default it will be `Mix.ADDITIVE`). This method will return the colors in the same format that was sent as input: | ||
The static method to create color harmonies accepts four parmeters, the first one could be any of the mentioned inputs, the second one is optional and it is to specify the kind of harmony (by default it will be `Harmony.COMPLEMENTARY`), the third one is also optional and it specifies if the returned harmony is based on additive or subtractive colors (by default it will be `Mix.ADDITIVE`), and the fourth parameter is also optional and it indicates the maximum number of decimals for the color values calculations (by default `6`). This method will return the colors in the same format that was sent as input: | ||
@@ -503,3 +523,4 @@ ```typescript | ||
harmony: Harmony = Harmony.COMPLEMENTARY, | ||
mode: Mix = Mix.ADDITIVE | ||
mode: Mix = Mix.ADDITIVE, | ||
decimals: number = 6 | ||
) | ||
@@ -536,11 +557,11 @@ ``` | ||
// "rgba(0,255,255,0.5)", | ||
// "rgba(0,128,255,0.5)", | ||
// "rgba(0,255,128,0.5)" | ||
// "rgba(0,127.5,255,0.5)", | ||
// "rgba(0,255,127.5,0.5)" | ||
// ] | ||
ColorTranslator.getHarmony({ r: 115, g: 200, b: 150, a: 0.5 }, Harmony.COMPLEMENTARY); | ||
ColorTranslator.getHarmony({ r: 115, g: 200, b: 150, a: 0.5 }, Harmony.COMPLEMENTARY, false, 2); | ||
// [ | ||
// {r: 115, g: 201, b: 151, a: 0.5}, | ||
// {r: 201, g: 115, b: 165, a: 0.5} | ||
// {r: 115, g: 200, b: 150, a: 0.5}, | ||
// {r: 200, g: 123.75, b: 115, a: 0.5} | ||
// ] | ||
@@ -547,0 +568,0 @@ |
@@ -1,1 +0,1 @@ | ||
var colortranslator=function(t){"use strict";var r=function(){return r=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},r.apply(this,arguments)};function e(t,r,e){if(e||2===arguments.length)for(var n,a=0,i=r.length;a<i;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return t.concat(n||Array.prototype.slice.call(r))}var n,a,i,o;!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",t.CMYK="CMYK"}(n||(n={})),t.Harmony=void 0,(a=t.Harmony||(t.Harmony={})).ANALOGOUS="ANALOGOUS",a.COMPLEMENTARY="COMPLEMENTARY",a.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",a.TRIADIC="TRIADIC",a.TETRADIC="TETRADIC",a.SQUARE="SQUARE",t.Mix=void 0,(i=t.Mix||(t.Mix={})).ADDITIVE="ADDITIVE",i.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={})[n.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[n.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[n.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[n.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,a=2*e-n;return{r:E(a,n,(t/=60)+2),g:E(a,n,t),b:E(a,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),a=1-n,i=(a-t)/a,o=(a-r)/a,u=(a-e)/a;return{c:Math.round(100*i),m:Math.round(100*o),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 a=Math.max(t,r,e),i=Math.min(t,r,e),o=a-i,u=0,c=0,s=(a+i)/2;if(0===o)u=0,c=0;else{switch(a){case t:u=(r-e)/o%6;break;case r:u=(e-t)/o+2;break;case e:u=(t-r)/o+4}(u=Math.round(60*u))<0&&(u+=360),c=o/(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]],a=r?n:e,i=0,o=0,u=0,c=0;return(r?e:n).find((function(r,e){return t>=r[0]&&t<r[1]&&(i=r[0],o=r[1],u=a[e][0],c=a[e][1],!0)})),u+(c-u)/(o-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=j(t).toString(16).toUpperCase();return 1===r.length?"0x0".concat(r):"0x".concat(r)},G=function(t){var r=j(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?j(t,6)/255:j(t,6):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={})[n.HEX]=function(t){return"#".concat(G(t.r)).concat(G(t.g)).concat(G(t.b)).concat(D(t,"a")&&G(t.a)||"")},c[n.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[n.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[n.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,6)},K=function(n,a,i){return a.reduce((function(a,o){return e(e([],a,!0),[r(r({},n),{h:i===t.Mix.ADDITIVE?x(n.h+o):x(C(C(n.h,!1)+o,!0))})],!1)}),[r({},n)])},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(n).reduce((function(t,r){var e=r[0],a=r[1];if(e!==n.HEX){var i=X(e.split(""));t[i]=a,t["A"+i]=a}return t}),{}),Q=function(t){return"string"==typeof t?function(t){var r;if(Object.keys(n).some((function(e){if(p[e].test(t))return r=e,!0})),!r&&~g.indexOf(t)&&(r=n.HEX),!r)throw new Error(m);return r}(t):function(t){var r,e=!1,a=X(Object.keys(t));if(q[a]&&(r=q[a]),r&&r===n.RGB){var i=Object.entries(t).some((function(t){return!y.test("".concat(t[1]))})),o=Object.entries(t).some((function(t){return!(F.test("".concat(t[1]))||!y.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255)}));i&&o&&(e=!0),i||(r=n.HEX)}if(!r||e)throw new Error(A);return r}(t)},_=((s={})[n.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[n.RGB]=function(t){var r=t.match(p.RGB),e=k(r[1]||r[5]),n=k(r[2]||r[6]),a=k(r[3]||r[7]),i=r[4]||r[8],o={r:Math.min(e,255),g:Math.min(n,255),b:Math.min(a,255)};return void 0!==i&&(o.a=T(i)),o},s[n.HSL]=function(t){var r=t.match(p.HSL),e=x(r[1]||r[5]),n=R(r[2]||r[6]),a=R(r[3]||r[7]),i=r[4]||r[8],o=H(e,n,a);return void 0!==i&&(o.a=T(i)),o},s[n.CMYK]=function(t){var r=t.match(p.CMYK),e=O(r[1]||r[6]),n=O(r[2]||r[7]),a=O(r[3]||r[8]),i=O(r[4]||r[9]),o=r[5]||r[10],u=v(e,n,a,i);return void 0!==o&&(u.a=T(o)),u},s),z=((d={})[n.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[n.RGB]=function(t){return this.HEX(t)},d[n.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[n.CMYK]=function(t){var r=O("".concat(t.c)),e=O("".concat(t.m)),n=O("".concat(t.y)),a=O("".concat(t.k)),i=v(r,e,n,a);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={})[n.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[n.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[n.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[n.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,a){var i=Q(t),o="string"==typeof t,u=J(t,i),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=a?s.l/(e+1):(100-s.l)/(e+1),l=Array(e).fill(null).map((function(t,e){return r(r({},s),{l:s.l+d*(e+1)*(1-2*+a)})}));switch(i){case n.HEX:default:return l.map((function(t){var e=H(t.h,t.s,t.l);return c&&(e.a=t.a),o?c?Y.HEX(r(r({},e),{a:j(255*e.a,6)})):Y.HEX(e):c?W.HEXA(e):W.HEX(e)}));case n.RGB:return l.map((function(t){var r=H(t.h,t.s,t.l);return c&&(r.a=t.a),o?Y.RGB(r):c?W.RGBA(r):W.RGB(r)}));case n.HSL:return l.map((function(t){return o?Y.HSL(t):c?W.HSLA(r(r({},H(t.h,t.s,t.l)),{a:t.a})):W.HSL(H(t.h,t.s,t.l))}))}},tt=((h={buildHarmony:function(t,r,e){var a=Q(t),i=J(t,a),o=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(a){case n.HEX:default:return u?this.HEXA(o,r,e,c):this.HEX(o,r,e,c);case n.HSL:return u?this.HSLA(o,r,e,c):this.HSL(o,r,e,c);case n.RGB:return u?this.RGBA(o,r,e,c):this.RGB(o,r,e,c)}}})[n.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,e,n,a){return e(t,n).map((function(t){return a?Y.HEX(r(r({},H(t.h,t.s,t.l)),{a:255*T(t.a)})):W.HEXA(r(r({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},h[n.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,e,n,a){return e(t,n).map((function(t){return a?Y.RGB(r(r({},H(t.h,t.s,t.l)),{a:T(t.a)})):W.RGBA(r(r({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},h[n.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,e,n,a){return e(t,n).map((function(t){return a?Y.HSL(r(r({},t),{a:T(t.a)})):W.HSLA(r(r({},H(t.h,t.s,t.l)),{a:T(t.a)}))}))},h),rt=((f={mix:function(e,n){var a,i,o,u,c,s,d,l,h,f,g,p,b,F,y,m=e.map((function(t){var r=Q(t);return J(t,r)})),A=n===t.Mix.SUBTRACTIVE?m.map((function(t){var r,e,n,a,i,o,u,c,s,d,l,h,f,g,p=(r=t.r,e=t.g,n=t.b,a=Math.min(r,e,n),i=Math.min(255-r,255-e,255-n),o=r-a,u=e-a,c=n-a,s=Math.min(o,u),d=o-s,l=(u+s)/2,h=(c+u-s)/2,f=Math.max(d,l,h)/Math.max(o,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(e){var a=n===t.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return e.reduce((function(e,a){var i=D(a,"a")?a.a:1,o={r:Math.min(e.r+a.r*i,255),b:Math.min(e.b+a.b*i,255),a:1-(1-i)*(1-e.a)},u="g"in e?e.g:e.y,c="g"in a?a.g:a.y;return r(r({},o),n===t.Mix.ADDITIVE?{g:Math.min(u+c*i,255)}:{y:Math.min(u+c*i,255)})}),a)}if(n===t.Mix.ADDITIVE)a=E(m);else{var H=E(A);i=H.r,o=H.y,u=H.b,c=Math.min(i,o,u),s=Math.min(255-i,255-o,255-u),d=i-c,l=o-c,h=u-c,f=Math.min(l,h),g=d+l-f,p=l+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,(a={r:g/y+s,g:p/y+s,b:b/y+s}).a=H.a}return{r:j(a.r,2),g:j(a.g,2),b:j(a.b,2),a:I(a.a,0,1)}}})[n.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[n.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[n.HSL]=function(t,r,e){var n=this.mix(t,r),a=M(n.r,n.g,n.b);return delete n.a,delete a.a,e?Y.HSL(a):W.HSL(n)},f.HSLA=function(t,r,e){var n=this.mix(t,r),a=M(n.r,n.g,n.b,n.a);return e?Y.HSL(a):W.HSLA(n)},f),et=function(t,r,e,n,a){var i=n(J(t,r));return e?a(i):i},nt=function(t,r,e,n,a,i){e<1&&(e=5);var o=function(t,r,e){var n=e-1,a=(r.r-t.r)/n,i=(r.g-t.g)/n,o=(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+a*s),g:j(t.g+i*s),b:j(t.b+o*s),a:j(u+c*s,2)}}))}(J(t),J(r),e);return o.map((function(t){var r=a(t);return n?i(r):r}))},at=function(){function e(t){this.rgb=J(t),this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=r(r({},H(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=r(r({},v(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=M(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=B(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setH=function(t){return this.hsl.h=x(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=I(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=I(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=I(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=I(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=I(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=I(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=I(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=I(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=I(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=I(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"H",{get:function(){return j(this.hsl.h)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return j(this.hsl.s)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return j(this.hsl.l)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return j(this.rgb.r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return j(this.rgb.g)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return j(this.rgb.b)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return j(this.hsl.a,2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return j(this.cmyk.c)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return j(this.cmyk.m)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return j(this.cmyk.y)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return j(this.cmyk.k)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return W.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return W.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return r(r({},this.RGBObject),{a:this.hsl.a})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return r(r({},this.HSLObject),{a:this.hsl.a})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKAObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K,a:this.hsl.a}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return Y.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:255*this.hsl.a};return Y.HEX(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b};return Y.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){var t=this.rgb,r={r:t.r,g:t.g,b:t.b,a:this.hsl.a};return Y.RGB(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){var t=this.hsl,r={h:t.h,s:t.s,l:t.l};return Y.HSL(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return Y.HSL(this.hsl)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return Y.CMYK(this.cmyk)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKA",{get:function(){return Y.CMYK(r(r({},this.cmyk),{a:this.hsl.a}))},enumerable:!1,configurable:!0}),e.toHEX=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.HEX,Y.HEX)},e.toHEXA=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.HEXA,Y.HEX)},e.toRGB=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.RGB,Y.RGB)},e.toRGBA=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.RGBA,Y.RGB)},e.toHSL=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.HSL,Y.HSL)},e.toHSLA=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.HSLA,Y.HSL)},e.toCMYK=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.CMYK,Y.CMYK)},e.toCMYKA=function(t,r){void 0===r&&(r=!0);var e=Q(t);return et(t,e,r,W.CMYKA,Y.CMYK)},e.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)},e.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)},e.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)},e.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)},e.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)},e.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)},e.getMixHEX=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.HEX(r,e,n)},e.getMixHEXA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.HEXA(r,e,n)},e.getMixRGB=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.RGB(r,e,n)},e.getMixRGBA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.RGBA(r,e,n)},e.getMixHSL=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.HSL(r,e,n)},e.getMixHSLA=function(r,e,n){return void 0===e&&(e=t.Mix.ADDITIVE),void 0===n&&(n=!0),rt.HSLA(r,e,n)},e.getShades=function(t,r){return Z(t,r,!0)},e.getTints=function(t,r){return Z(t,r,!1)},e.getHarmony=function(r,e,n){switch(void 0===e&&(e=t.Harmony.COMPLEMENTARY),void 0===n&&(n=t.Mix.ADDITIVE),e){case t.Harmony.ANALOGOUS:return 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)}},e}();return t.ColorTranslator=at,t}({}); | ||
var colortranslator=function(t){"use strict";var e=function(){return e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function r(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}var n,i,o,a;!function(t){t.HEX="HEX",t.RGB="RGB",t.HSL="HSL",t.CMYK="CMYK"}(n||(n={})),t.Harmony=void 0,(i=t.Harmony||(t.Harmony={})).ANALOGOUS="ANALOGOUS",i.COMPLEMENTARY="COMPLEMENTARY",i.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",i.TRIADIC="TRIADIC",i.TETRADIC="TETRADIC",i.SQUARE="SQUARE",t.Mix=void 0,(o=t.Mix||(t.Mix={})).ADDITIVE="ADDITIVE",o.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"}(a||(a={}));var u,c,s,d,h,l,f,g=Object.keys(a),p={HEX:["r","g","b","a"],RGB:["r","g","b","a"],HSL:["h","s","l","a"],CMYK:["c","m","y","k","a"]},b={BGR:n.RGB,ABGR:n.RGB,HLS:n.HSL,AHLS:n.HSL,CKMY:n.CMYK,ACKMY:n.CMYK},m=((u={})[n.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[n.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[n.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[n.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),y=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,F=/^(\d+(?:\.\d+)?|\.\d+)%$/,A=/^0x([a-f\d]{1,2})$/i,H=/\{(\d+)\}/g,v="The provided string color doesn't have a correct format",E="The provided color object doesn't have the proper keys or format",B=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},M=function(t){return+"".concat(t).replace(F,"$1")},C=function(t){return F.test("".concat(t))?M(t):Math.min(+t,100)},R=function(t){return 1===t.length&&(t+=t),parseInt(t,16)},D=function(t){var e=k(t,0).toString(16).toUpperCase();return 1===e.length?"0x0".concat(e):"0x".concat(e)},S=function(t,e){return void 0===e&&(e=!1),!e&&F.test(t)?Math.min(255*M(t)/100,255):A.test(t)?(3===t.length&&(t+=t.slice(-1)),e?k(t)/255:k(t)):Math.min(+t,e?1:255)},L=function(t){return Math.min(F.test(t)?M(t)/100:+t,1)},G=function(t){return r([],t,!0).sort().join("").toUpperCase()},k=function(t,e){void 0===e&&(e=6);var r=Math.pow(10,e);return Math.round(+t*r)/r},O=function(t,e,r){return Math.max(e,Math.min(t,r))},X=function(t,e,r){return r<0&&(r+=6),r>=6&&(r-=6),k(r<1?255*((e-t)*r+t):r<3?255*e:r<4?255*((e-t)*(4-r)+t):255*t)},Y=function(t,e,r){e/=100;var n=(r/=100)<=.5?r*(e+1):r+e-r*e,i=2*r-n;return{r:X(i,n,(t/=60)+2),g:X(i,n,t),b:X(i,n,t-2)}},j=function(t,e,r,n){return{r:k(255*(1-t)*(n=1-n)),g:k(255*(1-e)*n),b:k(255*(1-r)*n)}},K=function(t,e,r){t/=255,e/=255,r/=255;var n=1-Math.max(t,e,r),i=1-n,o=i&&(i-e)/i,a=i&&(i-r)/i;return{c:k(100*(i&&(i-t)/i)),m:k(100*o),y:k(100*a),k:k(100*n)}},I=function(t,e,r,n){void 0===n&&(n=1),t/=255,e/=255,r/=255,n=Math.min(n,1);var i=Math.max(t,e,r),o=Math.min(t,e,r),a=i-o,u=0,c=0,s=(i+o)/2;if(0!==a){switch(i){case t:u=(e-r)/a%6;break;case e:u=(r-t)/a+2;break;case r:u=(t-e)/a+4}(u=k(60*u))<0&&(u+=360),c=a/(1-Math.abs(2*s-1))}return{h:u,s:k(100*c),l:k(100*s),a:n}},T=function(t,e){if(t<0&&(t+=360),t>360&&(t-=360),360===t||0===t)return t;var r=[[0,120],[120,180],[180,240],[240,360]],n=[[0,60],[60,120],[120,240],[240,360]],i=e?n:r,o=0,a=0,u=0,c=0;return(e?r:n).find((function(e,r){return t>=e[0]&&t<e[1]&&(o=e[0],a=e[1],u=i[r][0],c=i[r][1],!0)})),u+(c-u)/(a-o)*(t-o)},x=function(t,e){void 0===e&&(e=!1);var r=G(Object.keys(t));return p[b[r]].reduce((function(r,n){var i,o,a=t[n];return void 0!==a&&(e?r.push((i=k(a,0),1===(o=k(i,0).toString(16).toUpperCase()).length&&(o="0".concat(o)),o)):r.push(a)),r}),[])},P=function(t,e){return t.replace(H,(function(t,r){return"".concat(e[+r-1])}))},w=((c={})[n.HEX]=function(t){var e=x(t,!0),r=4===e.length?"#{1}{2}{3}{4}":"#{1}{2}{3}";return P(r,e)},c[n.RGB]=function(t){var e=x(t),r=4===e.length?"rgba({1},{2},{3},{4})":"rgb({1},{2},{3})";return P(r,e)},c[n.HSL]=function(t){var e=x(t),r=4===e.length?"hsla({1},{2}%,{3}%,{4})":"hsl({1},{2}%,{3}%)";return P(r,e)},c[n.CMYK]=function(t){var e=x(t),r=5===e.length?"cmyk({1}%,{2}%,{3}%,{4}%,{5})":"cmyk({1}%,{2}%,{3}%,{4}%)";return P(r,e)},c),N=function(t){if("string"==typeof t){var e=t.match(y),r=+e[1];switch(e[2]){case"rad":t=k(180*r/Math.PI);break;case"turn":t=k(360*r);break;default:t=r}}return(t>360||t<0)&&(t-=360*Math.floor(t/360)),t},V=function(t){return"string"==typeof t&&(t=F.test(t)?M(t)/100:+t),isNaN(+t)||t>1?1:k(t)},U=function(n,i,o){return i.reduce((function(i,a){return r(r([],i,!0),[e(e({},n),{h:o===t.Mix.ADDITIVE?N(n.h+a):N(T(T(n.h,!1)+a,!0))})],!1)}),[e({},n)])},q=function(t,e){return U(t,[30,-30],e)},$=function(t,e){return U(t,[180],e)},_=function(t,e){return U(t,[150,-150],e)},Q=function(t,e){return U(t,[120,-120],e)},z=function(t,e){return U(t,[60,-120,180],e)},J=function(t,e){return U(t,[90,-90,180],e)},W=function(t){return"string"==typeof t?function(t){var e;if(Object.keys(n).some((function(r){if(m[r].test(t))return e=r,!0})),!e&&~g.indexOf(t)&&(e=n.HEX),!e)throw new Error(v);return e}(t):function(t){var e,r=!1,i=G(Object.keys(t));if(b[i]&&(e=b[i]),e&&e===n.RGB){var o=Object.entries(t).some((function(t){return!A.test("".concat(t[1]))})),a=Object.entries(t).some((function(t){return!(F.test("".concat(t[1]))||!A.test("".concat(t[1]))&&!isNaN(+t[1])&&+t[1]<=255)}));o&&a&&(r=!0),o||(e=n.HEX)}if(!e||r)throw new Error(E);return e}(t)},Z=((s={})[n.HEX]=function(t){var e=(~g.indexOf(t)?a[t]:t).match(m.HEX),r={r:R(e[1]||e[5]),g:R(e[2]||e[6]),b:R(e[3]||e[7])},n=e[4]||e[8];return void 0!==n&&(r.a=R(n)/255),r},s[n.RGB]=function(t){var e=t.match(m.RGB),r=S(e[1]||e[5]),n=S(e[2]||e[6]),i=S(e[3]||e[7]),o=e[4]||e[8],a={r:Math.min(r,255),g:Math.min(n,255),b:Math.min(i,255)};return void 0!==o&&(a.a=V(o)),a},s[n.HSL]=function(t){var e=t.match(m.HSL),r=N(e[1]||e[5]),n=C(e[2]||e[6]),i=C(e[3]||e[7]),o=e[4]||e[8],a=Y(r,n,i);return void 0!==o&&(a.a=V(o)),a},s[n.CMYK]=function(t){var e=t.match(m.CMYK),r=L(e[1]||e[6]),n=L(e[2]||e[7]),i=L(e[3]||e[8]),o=L(e[4]||e[9]),a=e[5]||e[10],u=j(r,n,i,o);return void 0!==a&&(u.a=V(a)),u},s),tt=((d={})[n.HEX]=function(t){var e={r:S("".concat(t.r)),g:S("".concat(t.g)),b:S("".concat(t.b))};return B(t,"a")&&(e.a=Math.min(S("".concat(t.a),!0),1)),e},d[n.RGB]=function(t){return this.HEX(t)},d[n.HSL]=function(t){var e=C("".concat(t.s)),r=C("".concat(t.l)),n=Y(N(t.h),e,r);return B(t,"a")&&(n.a=V(t.a)),n},d[n.CMYK]=function(t){var e=L("".concat(t.c)),r=L("".concat(t.m)),n=L("".concat(t.y)),i=L("".concat(t.k)),o=j(e,r,n,i);return B(t,"a")&&(o.a=V(t.a)),o},d),et=function(t,e){return void 0===e&&(e=W(t)),"string"==typeof t?Z[e](t):tt[e](t)},rt=((h={})[n.HEX]=function(t){return{r:D(t.r),g:D(t.g),b:D(t.b)}},h.HEXA=function(t){var e=rt.HEX(t);return e.a=B(t,"a")?D(255*t.a):"0xFF",e},h[n.RGB]=function(t,e){return B(t,"a")&&delete t.a,at(t,e)},h.RGBA=function(t,e){return t.a=B(t,"a")?k(t.a):1,at(t,e)},h[n.HSL]=function(t,e){var r=I(t.r,t.g,t.b);return delete r.a,ut(r,e)},h.HSLA=function(t,e){var r=rt.HSL(t,e);return r.a=B(t,"a")?k(t.a,e):1,r},h[n.CMYK]=function(t,e){return ct(K(t.r,t.g,t.b),e)},h.CMYKA=function(t,e){var r=rt.CMYK(t,e);return r.a=B(t,"a")?k(t.a,e):1,r},h),nt=function(t,r,i,o){var a=W(t),u="string"==typeof t,c=et(t,a),s="string"==typeof t&&B(c,"a")||"string"!=typeof t&&B(t,"a"),d=I(c.r,c.g,c.b,c.a);s||delete d.a;var h=i?d.l/(r+1):(100-d.l)/(r+1),l=Array(r).fill(null).map((function(t,r){return e(e({},d),{l:d.l+h*(r+1)*(1-2*+i)})}));switch(a){case n.HEX:default:return l.map((function(t){var r=Y(t.h,t.s,t.l);return s&&(r.a=t.a),u?s?w.HEX(at(e(e({},r),{a:k(255*r.a)}),o)):w.HEX(at(r,o)):s?rt.HEXA(r):rt.HEX(r)}));case n.RGB:return l.map((function(t){var e=Y(t.h,t.s,t.l);return s&&(e.a=t.a),u?w.RGB(at(e,o)):s?rt.RGBA(e,o):rt.RGB(e,o)}));case n.HSL:return l.map((function(t){return u?w.HSL(ut(t,o)):s?rt.HSLA(e(e({},Y(t.h,t.s,t.l)),{a:t.a}),o):rt.HSL(Y(t.h,t.s,t.l),o)}))}},it=((l={buildHarmony:function(t,e,r,i){var o=W(t),a=et(t,o),u=I(a.r,a.g,a.b,a.a),c="string"==typeof t&&B(a,"a")||"string"!=typeof t&&B(t,"a"),s="string"==typeof t;switch(o){case n.HEX:default:return c?this.HEXA(ut(u,0),e,r,s):this.HEX(ut(u,0),e,r,s);case n.HSL:return c?this.HSLA(u,e,r,s,i):this.HSL(u,e,r,s,i);case n.RGB:return c?this.RGBA(u,e,r,s,i):this.RGB(u,e,r,s,i)}}})[n.HEX]=function(t,e,r,n){return e(t,r).map((function(t){return n?w.HEX(Y(t.h,t.s,t.l)):rt.HEX(Y(t.h,t.s,t.l))}))},l.HEXA=function(t,r,n,i){return r(t,n).map((function(t){return i?w.HEX(e(e({},Y(t.h,t.s,t.l)),{a:255*V(t.a)})):rt.HEXA(e(e({},Y(t.h,t.s,t.l)),{a:V(t.a)}))}))},l[n.RGB]=function(t,e,r,n,i){return e(t,r).map((function(t){return n?w.RGB(at(Y(t.h,t.s,t.l),i)):rt.RGB(Y(t.h,t.s,t.l),i)}))},l.RGBA=function(t,r,n,i,o){return r(t,n).map((function(t){return i?w.RGB(at(e(e({},Y(t.h,t.s,t.l)),{a:V(t.a)}),o)):rt.RGBA(e(e({},Y(t.h,t.s,t.l)),{a:V(t.a)}),o)}))},l[n.HSL]=function(t,e,r,n,i){return e(t,r).map((function(t){return n?w.HSL(ut({h:t.h,s:t.s,l:t.l},i)):rt.HSL(Y(t.h,t.s,t.l),i)}))},l.HSLA=function(t,r,n,i,o){return r(t,n).map((function(t){return i?w.HSL(ut(e(e({},t),{a:V(t.a)}),o)):rt.HSLA(e(e({},Y(t.h,t.s,t.l)),{a:V(t.a)}),o)}))},l),ot=((f={mix:function(r,n){var i,o,a,u,c,s,d,h,l,f,g,p,b,m,y,F=r.map((function(t){var e=W(t);return et(t,e)})),A=n===t.Mix.SUBTRACTIVE?F.map((function(t){var e,r,n,i,o,a,u,c,s,d,h,l,f,g,p=(e=t.r,r=t.g,n=t.b,i=Math.min(e,r,n),o=Math.min(255-e,255-r,255-n),a=e-i,u=r-i,c=n-i,s=Math.min(a,u),d=a-s,h=(u+s)/2,l=(c+u-s)/2,f=Math.max(d,h,l)/Math.max(a,u,c),g=isNaN(f)||f===1/0||f<=0?1:f,{r:d/g+o,y:h/g+o,b:l/g+o});return B(t,"a")&&(p.a=t.a),p})):null;function H(r){var i=n===t.Mix.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return r.reduce((function(r,i){var o=B(i,"a")?i.a:1,a={r:Math.min(r.r+i.r*o,255),b:Math.min(r.b+i.b*o,255),a:1-(1-o)*(1-r.a)},u="g"in r?r.g:r.y,c="g"in i?i.g:i.y;return e(e({},a),n===t.Mix.ADDITIVE?{g:Math.min(u+c*o,255)}:{y:Math.min(u+c*o,255)})}),i)}if(n===t.Mix.ADDITIVE)i=H(F);else{var v=H(A);o=v.r,a=v.y,u=v.b,c=Math.min(o,a,u),s=Math.min(255-o,255-a,255-u),d=o-c,h=a-c,l=u-c,f=Math.min(h,l),g=d+h-f,p=h+f,b=2*(l-f),m=Math.max(g,p,b)/Math.max(d,h,l),y=isNaN(m)||m===1/0||m<=0?1:m,(i={r:g/y+s,g:p/y+s,b:b/y+s}).a=v.a}return{r:k(i.r),g:k(i.g),b:k(i.b),a:O(i.a,0,1)}}})[n.HEX]=function(t,e,r){var n=this.mix(t,e);return delete n.a,r?w.HEX(n):rt.HEX(n)},f.HEXA=function(t,e,r){var n=this.mix(t,e);return n.a=r?255*V(n.a):V(n.a),r?w.HEX(n):rt.HEXA(n)},f[n.RGB]=function(t,e,r,n){var i=this.mix(t,e);return delete i.a,r?w.RGB(i):rt.RGB(i,n)},f.RGBA=function(t,e,r,n){var i=this.mix(t,e);return r?w.RGB(i):rt.RGBA(i,n)},f[n.HSL]=function(t,e,r,n){var i=this.mix(t,e),o=I(i.r,i.g,i.b);return delete i.a,delete o.a,r?w.HSL(o):rt.HSL(i,n)},f.HSLA=function(t,e,r,n){var i=this.mix(t,e),o=I(i.r,i.g,i.b,i.a);return r?w.HSL(o):rt.HSLA(i,n)},f),at=function(t,r){return e({r:k(t.r,r),g:k(t.g,r),b:k(t.b,r)},B(t,"a")?{a:k(t.a,r)}:{})},ut=function(t,r){return e({h:k(t.h,r),s:k(t.s,r),l:k(t.l,r)},B(t,"a")?{a:k(t.a,r)}:{})},ct=function(t,e){return{c:k(t.c,e),m:k(t.m,e),y:k(t.y,e),k:k(t.k,e)}},st=function(t,e,r,n,i,o){var a=i(et(t,e),n);return r?o(a):a},dt=function(t,e,r,n,i,o,a){r<1&&(r=5);var u=function(t,e,r){var n=r-1,i=(e.r-t.r)/n,o=(e.g-t.g)/n,a=(e.b-t.b)/n,u=V(t.a),c=(V(e.a)-u)/n;return Array(r).fill(null).map((function(r,s){return 0===s?t:s===n?e:{r:k(t.r+i*s),g:k(t.g+o*s),b:k(t.b+a*s),a:k(u+c*s)}}))}(et(t),et(e),r);return u.map((function(t){var e=o(t,i);return n?a(e):e}))},ht=function(){function r(t,e){void 0===e&&(e=6),this.rgb=et(t),this._decimals=e,this.updateHSL(),this.updateCMYK()}return r.prototype.updateRGB=function(){this.rgb=e(e({},Y(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},r.prototype.updateRGBFromCMYK=function(){this.rgb=e(e({},j(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=K(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.setDecimals=function(t){return this._decimals=t,this},r.prototype.setH=function(t){return this.hsl.h=N(t),this.updateRGBAndCMYK()},r.prototype.setS=function(t){return this.hsl.s=O(t,0,100),this.updateRGBAndCMYK()},r.prototype.setL=function(t){return this.hsl.l=O(t,0,100),this.updateRGBAndCMYK()},r.prototype.setR=function(t){return this.rgb.r=O(t,0,255),this.updateHSLAndCMYK()},r.prototype.setG=function(t){return this.rgb.g=O(t,0,255),this.updateHSLAndCMYK()},r.prototype.setB=function(t){return this.rgb.b=O(t,0,255),this.updateHSLAndCMYK()},r.prototype.setA=function(t){return this.hsl.a=this.rgb.a=O(t,0,1),this},r.prototype.setC=function(t){return this.cmyk.c=O(t,0,100),this.updateRGBAndHSL()},r.prototype.setM=function(t){return this.cmyk.m=O(t,0,100),this.updateRGBAndHSL()},r.prototype.setY=function(t){return this.cmyk.y=O(t,0,100),this.updateRGBAndHSL()},r.prototype.setK=function(t){return this.cmyk.k=O(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(r.prototype,"decimals",{get:function(){return this._decimals},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"H",{get:function(){return k(this.hsl.h,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"S",{get:function(){return k(this.hsl.s,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"L",{get:function(){return k(this.hsl.l,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"R",{get:function(){return k(this.rgb.r,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"G",{get:function(){return k(this.rgb.g,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"B",{get:function(){return k(this.rgb.b,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"A",{get:function(){return k(this.hsl.a,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"C",{get:function(){return k(this.cmyk.c,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"M",{get:function(){return k(this.cmyk.m,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Y",{get:function(){return k(this.cmyk.y,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"K",{get:function(){return k(this.cmyk.k,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXObject",{get:function(){return rt.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXAObject",{get:function(){return rt.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 e(e({},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 e(e({},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 e(e({},this.CMYKObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEX",{get:function(){return w.HEX({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HEXA",{get:function(){return w.HEX({r:this.R,g:this.G,b:this.B,a:255*this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGB",{get:function(){return w.RGB({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RGBA",{get:function(){return w.RGB({r:this.R,g:this.G,b:this.B,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSL",{get:function(){return w.HSL({h:this.H,s:this.S,l:this.L})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"HSLA",{get:function(){return w.HSL({h:this.H,s:this.S,l:this.L,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYK",{get:function(){return w.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"CMYKA",{get:function(){return w.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A})},enumerable:!1,configurable:!0}),r.toHEX=function(t,e){void 0===e&&(e=!0);var r=W(t);return st(t,r,e,0,rt.HEX,w.HEX)},r.toHEXA=function(t,e){void 0===e&&(e=!0);var r=W(t);return st(t,r,e,0,rt.HEXA,w.HEX)},r.toRGB=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=W(t);return st(t,n,e,r,rt.RGB,w.RGB)},r.toRGBA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=W(t);return st(t,n,e,r,rt.RGBA,w.RGB)},r.toHSL=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=W(t);return st(t,n,e,r,rt.HSL,w.HSL)},r.toHSLA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=W(t);return st(t,n,e,r,rt.HSLA,w.HSL)},r.toCMYK=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=W(t);return st(t,n,e,r,rt.CMYK,w.CMYK)},r.toCMYKA=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=6);var n=W(t);return st(t,n,e,r,rt.CMYKA,w.CMYK)},r.getBlendHEX=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),dt(t,e,r,n,i,rt.HEX,w.HEX)},r.getBlendHEXA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),dt(t,e,r,n,i,rt.HEXA,w.HEX)},r.getBlendRGB=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),dt(t,e,r,n,i,rt.RGB,w.RGB)},r.getBlendRGBA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),dt(t,e,r,n,i,rt.RGBA,w.RGB)},r.getBlendHSL=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),dt(t,e,r,n,i,rt.HSL,w.HSL)},r.getBlendHSLA=function(t,e,r,n,i){return void 0===r&&(r=5),void 0===n&&(n=!0),void 0===i&&(i=6),dt(t,e,r,n,i,rt.HSLA,w.HSL)},r.getMixHEX=function(e,r,n){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===n&&(n=!0),ot.HEX(e,r,n)},r.getMixHEXA=function(e,r,n){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===n&&(n=!0),ot.HEXA(e,r,n)},r.getMixRGB=function(e,r,n,i){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===n&&(n=!0),void 0===i&&(i=6),ot.RGB(e,r,n,i)},r.getMixRGBA=function(e,r,n,i){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===n&&(n=!0),void 0===i&&(i=6),ot.RGBA(e,r,n,i)},r.getMixHSL=function(e,r,n,i){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===n&&(n=!0),void 0===i&&(i=6),ot.HSL(e,r,n,i)},r.getMixHSLA=function(e,r,n,i){return void 0===r&&(r=t.Mix.ADDITIVE),void 0===n&&(n=!0),void 0===i&&(i=6),ot.HSLA(e,r,n,i)},r.getShades=function(t,e,r){return void 0===r&&(r=6),nt(t,e,!0,r)},r.getTints=function(t,e,r){return void 0===r&&(r=6),nt(t,e,!1,r)},r.getHarmony=function(e,r,n,i){return void 0===r&&(r=t.Harmony.COMPLEMENTARY),void 0===n&&(n=t.Mix.ADDITIVE),void 0===i&&(i=6),function(e,r,n,i){var o;return(o={},o[t.Harmony.ANALOGOUS]=it.buildHarmony(r,q,i,n),o[t.Harmony.COMPLEMENTARY]=it.buildHarmony(r,$,i,n),o[t.Harmony.SPLIT_COMPLEMENTARY]=it.buildHarmony(r,_,i,n),o[t.Harmony.TRIADIC]=it.buildHarmony(r,Q,i,n),o[t.Harmony.TETRADIC]=it.buildHarmony(r,z,i,n),o[t.Harmony.SQUARE]=it.buildHarmony(r,J,i,n),o)[e]}(r,e,i,n)},r}();return t.ColorTranslator=ht,t}({}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
124103
466
609