Comparing version 0.2.4 to 1.0.0
@@ -10,2 +10,8 @@ # Changelog | ||
## [1.0.0] - 2019-10-17 | ||
### Updated | ||
- Update dependencies. | ||
## [0.2.2] - 2018-06-11 | ||
@@ -52,3 +58,4 @@ | ||
[Unreleased]: https://github.com/archco/moo-color/compare/v0.2.2...HEAD | ||
[Unreleased]: https://github.com/archco/moo-color/compare/v1.0.0...HEAD | ||
[1.0.0]: https://github.com/archco/moo-color/compare/v0.2.2...v1.0.0 | ||
[0.2.2]: https://github.com/archco/moo-color/compare/v0.2.0...v0.2.2 | ||
@@ -55,0 +62,0 @@ [0.2.0]: https://github.com/archco/moo-color/compare/v0.1.3...v0.2.0 |
@@ -721,4 +721,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
ColorFormatter.prototype.toRgb = function (mode) { | ||
var _a; | ||
if (mode === void 0) { mode = 'default'; } | ||
var _a; | ||
var color = this.getColorAs('rgb'); | ||
@@ -1039,3 +1039,3 @@ var _b = color.values.map(function (x) { return Math.round(x); }), r = _b[0], g = _b[1], b = _b[2]; | ||
return extendStatics(d, b); | ||
} | ||
}; | ||
return function (d, b) { | ||
@@ -1085,5 +1085,5 @@ extendStatics(d, b); | ||
MooColor.random = function (_a) { | ||
var _b = _a === void 0 ? {} : _a, hue = _b.hue, white = _b.white, black = _b.black; | ||
var _c; | ||
_c = [hue, white, black].map(function (x, i) { | ||
var _b; | ||
var _c = _a === void 0 ? {} : _a, hue = _c.hue, white = _c.white, black = _c.black; | ||
_b = [hue, white, black].map(function (x, i) { | ||
if (typeof x === 'number') { | ||
@@ -1099,3 +1099,3 @@ return x; | ||
} | ||
}), hue = _c[0], white = _c[1], black = _c[2]; | ||
}), hue = _b[0], white = _b[1], black = _b[2]; | ||
return new MooColor({ | ||
@@ -1102,0 +1102,0 @@ model: 'hwb', |
@@ -1,29 +0,29 @@ | ||
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.MooColor=r():t.MooColor=r()}(this,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s="./src/moo-color.ts")}({"./node_modules/color-name/index.js": | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.MooColor=e():t.MooColor=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s="./src/moo-color.ts")}({"./node_modules/color-name/index.js": | ||
/*!******************************************!*\ | ||
!*** ./node_modules/color-name/index.js ***! | ||
\******************************************/ | ||
/*! no static exports found */function(t,r,e){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},"./src/color-converter.ts": | ||
/*! no static exports found */function(t,e,r){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},"./src/color-converter.ts": | ||
/*!********************************!*\ | ||
!*** ./src/color-converter.ts ***! | ||
\********************************/ | ||
/*! exports provided: hslToRgb, rgbToHsl, hwbToRgb, rgbToHwb, cmykToRgb, rgbToCmyk, hsvToRgb, rgbToHsv, hsvToHwb, hwbToHsv, rgbToHex, hexToRgb, resolveHwb */function(t,r,e){"use strict";e.r(r),e.d(r,"hslToRgb",function(){return o}),e.d(r,"rgbToHsl",function(){return a}),e.d(r,"hwbToRgb",function(){return u}),e.d(r,"rgbToHwb",function(){return s}),e.d(r,"cmykToRgb",function(){return c}),e.d(r,"rgbToCmyk",function(){return i}),e.d(r,"hsvToRgb",function(){return l}),e.d(r,"rgbToHsv",function(){return h}),e.d(r,"hsvToHwb",function(){return p}),e.d(r,"hwbToHsv",function(){return f}),e.d(r,"rgbToHex",function(){return d}),e.d(r,"hexToRgb",function(){return b}),e.d(r,"resolveHwb",function(){return m});var n=e(/*! ./util/util */"./src/util/util.ts");function o(t,r,e){t/=60,r/=100,e/=100;var n,o,a,u=(1-Math.abs(2*e-1))*r,s=u*(1-Math.abs(t%2-1)),c=e-u/2;switch(Math.floor(t)){case 0:n=u,o=s,a=0;break;case 1:n=s,o=u,a=0;break;case 2:n=0,o=u,a=s;break;case 3:n=0,o=s,a=u;break;case 4:n=s,o=0,a=u;break;case 5:n=u,o=0,a=s}return[n,o,a].map(function(t){return 255*(t+c)})}function a(t,r,e){t/=255,r/=255,e/=255;var n,o=Math.max(t,r,e),a=Math.min(t,r,e),u=o-a;return n=(o+a)/2,[0===u?0:o===t?(r-e)/u%6*60:o===r?60*((e-t)/u+2):60*((t-r)/u+4),100*(0===u?0:u/(1-Math.abs(2*n-1))),100*n]}function u(t,r,e){var n=f(t,r,e);return l(n[0],n[1],n[2])}function s(t,r,e){var n=h(t,r,e);return p(n[0],n[1],n[2])}function c(t,r,e,n){return[255*(1-(t/=100))*(1-(n/=100)),255*(1-(r/=100))*(1-n),255*(1-(e/=100))*(1-n)]}function i(t,r,e){t/=255,r/=255,e/=255;var n=1-Math.max(t,r,e);return[(1-t-n)/(1-n),(1-r-n)/(1-n),(1-e-n)/(1-n),n].map(function(t){return 100*t})}function l(t,r,e){var n,o,a,u=t/60,s=(e/=100)*(r/=100),c=s*(1-Math.abs(u%2-1)),i=e-s;switch(Math.floor(u)){case 0:n=s,o=c,a=0;break;case 1:n=c,o=s,a=0;break;case 2:n=0,o=s,a=c;break;case 3:n=0,o=c,a=s;break;case 4:n=c,o=0,a=s;break;case 5:n=s,o=0,a=c}return[n,o,a].map(function(t){return 255*(t+i)})}function h(t,r,e){t/=255,r/=255,e/=255;var n=Math.max(t,r,e),o=n-Math.min(t,r,e);return[0===o?0:n===t?(r-e)/o%6*60:n===r?60*((e-t)/o+2):60*((t-r)/o+4),100*(0===n?0:o/n),100*n]}function p(t,r,e){return[t,100*((1-(r/=100))*(e/=100)),100*(1-e)]}function f(t,r,e){var n;return t=(n=m(t,r,e))[0],r=n[1],e=n[2],[t,100*(1-(r/=100)/(1-(e/=100))),100*(1-e)]}function d(t,r,e,o,a){var u=[t,r,e];"number"==typeof o&&u.push(Math.round(255*o));var s=u.map(function(t){return Object(n.padStart)(t.toString(16),2,"0")}).join("");return a?function(t){var r=!0,e=t.match(/.{2}/g);return e.forEach(function(t){t.match(/(.)\1+/)||(r=!1)}),r?e.map(function(t){return t.substring(1)}).join(""):t}(s):s}function b(t){return t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,function(t,r,e,n,o){return r+r+e+e+n+n+(o=void 0===o?"":o)+o}).match(/.{2}/g).map(function(t,r){return 3!==r?parseInt(t,16):parseInt(t,16)/255})}function m(t,r,e){var n=r+e;return n>100&&(r=100*Number((r/n).toFixed(4)),e=100*Number((e/n).toFixed(4))),[t,r,e]}},"./src/color-formatter.ts": | ||
/*! exports provided: hslToRgb, rgbToHsl, hwbToRgb, rgbToHwb, cmykToRgb, rgbToCmyk, hsvToRgb, rgbToHsv, hsvToHwb, hwbToHsv, rgbToHex, hexToRgb, resolveHwb */function(t,e,r){"use strict";r.r(e),r.d(e,"hslToRgb",(function(){return o})),r.d(e,"rgbToHsl",(function(){return a})),r.d(e,"hwbToRgb",(function(){return u})),r.d(e,"rgbToHwb",(function(){return s})),r.d(e,"cmykToRgb",(function(){return c})),r.d(e,"rgbToCmyk",(function(){return i})),r.d(e,"hsvToRgb",(function(){return l})),r.d(e,"rgbToHsv",(function(){return h})),r.d(e,"hsvToHwb",(function(){return p})),r.d(e,"hwbToHsv",(function(){return f})),r.d(e,"rgbToHex",(function(){return d})),r.d(e,"hexToRgb",(function(){return b})),r.d(e,"resolveHwb",(function(){return m}));var n=r(/*! ./util/util */"./src/util/util.ts");function o(t,e,r){t/=60,e/=100,r/=100;var n,o,a,u=(1-Math.abs(2*r-1))*e,s=u*(1-Math.abs(t%2-1)),c=r-u/2;switch(Math.floor(t)){case 0:n=u,o=s,a=0;break;case 1:n=s,o=u,a=0;break;case 2:n=0,o=u,a=s;break;case 3:n=0,o=s,a=u;break;case 4:n=s,o=0,a=u;break;case 5:n=u,o=0,a=s}return[n,o,a].map((function(t){return 255*(t+c)}))}function a(t,e,r){t/=255,e/=255,r/=255;var n,o=Math.max(t,e,r),a=Math.min(t,e,r),u=o-a;return n=(o+a)/2,[0===u?0:o===t?(e-r)/u%6*60:o===e?60*((r-t)/u+2):60*((t-e)/u+4),100*(0===u?0:u/(1-Math.abs(2*n-1))),100*n]}function u(t,e,r){var n=f(t,e,r);return l(n[0],n[1],n[2])}function s(t,e,r){var n=h(t,e,r);return p(n[0],n[1],n[2])}function c(t,e,r,n){return[255*(1-(t/=100))*(1-(n/=100)),255*(1-(e/=100))*(1-n),255*(1-(r/=100))*(1-n)]}function i(t,e,r){t/=255,e/=255,r/=255;var n=1-Math.max(t,e,r);return[(1-t-n)/(1-n),(1-e-n)/(1-n),(1-r-n)/(1-n),n].map((function(t){return 100*t}))}function l(t,e,r){var n,o,a,u=t/60,s=(r/=100)*(e/=100),c=s*(1-Math.abs(u%2-1)),i=r-s;switch(Math.floor(u)){case 0:n=s,o=c,a=0;break;case 1:n=c,o=s,a=0;break;case 2:n=0,o=s,a=c;break;case 3:n=0,o=c,a=s;break;case 4:n=c,o=0,a=s;break;case 5:n=s,o=0,a=c}return[n,o,a].map((function(t){return 255*(t+i)}))}function h(t,e,r){t/=255,e/=255,r/=255;var n=Math.max(t,e,r),o=n-Math.min(t,e,r);return[0===o?0:n===t?(e-r)/o%6*60:n===e?60*((r-t)/o+2):60*((t-e)/o+4),100*(0===n?0:o/n),100*n]}function p(t,e,r){return[t,100*((1-(e/=100))*(r/=100)),100*(1-r)]}function f(t,e,r){var n;return t=(n=m(t,e,r))[0],e=n[1],r=n[2],[t,100*(1-(e/=100)/(1-(r/=100))),100*(1-r)]}function d(t,e,r,o,a){var u=[t,e,r];"number"==typeof o&&u.push(Math.round(255*o));var s=u.map((function(t){return Object(n.padStart)(t.toString(16),2,"0")})).join("");return a?function(t){var e=!0,r=t.match(/.{2}/g);return r.forEach((function(t){t.match(/(.)\1+/)||(e=!1)})),e?r.map((function(t){return t.substring(1)})).join(""):t}(s):s}function b(t){return t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,(function(t,e,r,n,o){return e+e+r+r+n+n+(o=void 0===o?"":o)+o})).match(/.{2}/g).map((function(t,e){return 3!==e?parseInt(t,16):parseInt(t,16)/255}))}function m(t,e,r){var n=e+r;return n>100&&(e=100*Number((e/n).toFixed(4)),r=100*Number((r/n).toFixed(4))),[t,e,r]}},"./src/color-formatter.ts": | ||
/*!********************************!*\ | ||
!*** ./src/color-formatter.ts ***! | ||
\********************************/ | ||
/*! exports provided: ColorFormatter, default */function(t,r,e){"use strict";e.r(r),e.d(r,"ColorFormatter",function(){return u});var n=e(/*! ./color-converter */"./src/color-converter.ts"),o=e(/*! ./color-names */"./src/color-names.ts"),a=e(/*! ./util/util */"./src/util/util.ts"),u=function(){function t(){this.resolveHwb=n.resolveHwb}return t.prototype.setColor=function(t){return t.alpha=Object(a.resolveAlpha)(t.alpha),this.color=t,this},t.prototype.getColor=function(){return this.color},t.prototype.getColorAs=function(t){return this.color.model===t?this.color:this.convert(this.color,t)},t.prototype.getModel=function(){return this.color?this.color.model:void 0},t.prototype.changeModel=function(t){return this.color.model===t?this:this.setColor(this.convert(this.color,t))},t.prototype.getAlpha=function(){return this.color.alpha},t.prototype.setAlpha=function(t){return this.color.alpha=t,this},t.prototype.convert=function(t,r){var e;switch(t.model){case"rgb":e=this.convertFromRgb(t.values,r);break;case"hwb":e=this.convertFromHwb(t.values,r);break;case"hsl":e=this.convertFromHsl(t.values,r);break;case"hsv":e=this.convertFromHsv(t.values,r);break;case"cmyk":e=this.convertFromCmyk(t.values,r)}if(!e.length)throw new Error("Converting Error!");return{model:r,values:e,alpha:t.alpha}},t.prototype.toString=function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];switch(t=t||this.color.model){case"hex":return this.toHex.apply(this,r);case"hwb":return this.toHwb();case"hsl":return this.toHsl();case"hsv":return this.toHsv();case"cmyk":return this.toCmyk();default:return this.toRgb.apply(this,r)}},t.prototype.toHex=function(t){void 0===t&&(t="full");var r=this.getColorAs("rgb"),e=r.values.map(function(t){return Math.round(t)}),u=e[0],s=e[1],c=e[2],i=1===r.alpha?null:r.alpha;switch(t){case"name":return function(){for(var t="",r=0,e=Object.keys(o.default);r<e.length;r++){var l=e[r];if(Object(a.arrayIsEqual)(o.default[l],[u,s,c])){t=l;break}}return null===i&&""!==t?t:"#"+n.rgbToHex(u,s,c,i,!0)}();case"short":return"#"+n.rgbToHex(u,s,c,i,!0);case"full":default:return"#"+n.rgbToHex(u,s,c,i)}},t.prototype.toRgb=function(t){var r;void 0===t&&(t="default");var e=this.getColorAs("rgb"),n=e.values.map(function(t){return Math.round(t)}),o=n[0],a=n[1],u=n[2];return"percent"===t&&(o=(r=[o,a,u].map(function(t){return t/255*100+"%"}))[0],a=r[1],u=r[2]),1===e.alpha?"rgb("+o+", "+a+", "+u+")":"rgba("+o+", "+a+", "+u+", "+e.alpha+")"},t.prototype.toHwb=function(){var t=this.getColorAs("hwb"),r=t.values.map(function(t){return Object(a.decimal)(t,2)});return"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+(1===t.alpha?"":", "+t.alpha)+")"},t.prototype.toHsl=function(){var t=this.getColorAs("hsl"),r=t.values.map(function(t){return Object(a.decimal)(t,2)}),e=r[0],n=r[1],o=r[2];return 1===t.alpha?"hsl("+e+", "+n+"%, "+o+"%)":"hsla("+e+", "+n+"%, "+o+"%, "+t.alpha+")"},t.prototype.toHsv=function(){var t=this.getColorAs("hsv"),r=t.values.map(function(t){return Object(a.decimal)(t,2)}),e=r[0],n=r[1],o=r[2];return 1===t.alpha?"hsv("+e+", "+n+"%, "+o+"%)":"hsva("+e+", "+n+"%, "+o+"%, "+t.alpha+")"},t.prototype.toCmyk=function(){var t=this.getColorAs("cmyk"),r=t.values.map(function(t){return Object(a.decimal)(t,2)});return"cmyk("+r[0]+"%, "+r[1]+"%, "+r[2]+"%, "+r[3]+"%"+(1===t.alpha?"":", "+t.alpha)+")"},t.prototype.convertFromRgb=function(t,r){var e=t[0],o=t[1],a=t[2];switch(r){case"rgb":return[e,o,a];case"hwb":return n.rgbToHwb(e,o,a);case"hsl":return n.rgbToHsl(e,o,a);case"hsv":return n.rgbToHsv(e,o,a);case"cmyk":return n.rgbToCmyk(e,o,a)}},t.prototype.convertFromHwb=function(t,r){var e=t[0],o=t[1],a=t[2],u=n.hwbToRgb(e,o,a),s=u[0],c=u[1],i=u[2];switch(r){case"rgb":return[s,c,i];case"hwb":return[e,o,a];case"hsl":return n.rgbToHsl(s,c,i);case"hsv":return n.hwbToHsv(e,o,a);case"cmyk":return n.rgbToCmyk(s,c,i)}},t.prototype.convertFromHsl=function(t,r){var e=t[0],o=t[1],a=t[2],u=n.hslToRgb(e,o,a),s=u[0],c=u[1],i=u[2];switch(r){case"rgb":return[s,c,i];case"hwb":return n.rgbToHwb(s,c,i);case"hsl":return[e,o,a];case"hsv":return n.rgbToHsv(s,c,i);case"cmyk":return n.rgbToCmyk(s,c,i)}},t.prototype.convertFromHsv=function(t,r){var e=t[0],o=t[1],a=t[2],u=n.hsvToRgb(e,o,a),s=u[0],c=u[1],i=u[2];switch(r){case"rgb":return[s,c,i];case"hwb":return n.hsvToHwb(e,o,a);case"hsl":return n.rgbToHsl(s,c,i);case"hsv":return[e,o,a];case"cmyk":return n.rgbToCmyk(s,c,i)}},t.prototype.convertFromCmyk=function(t,r){var e=t[0],o=t[1],a=t[2],u=t[3],s=n.cmykToRgb(e,o,a,u),c=s[0],i=s[1],l=s[2];switch(r){case"rgb":return[c,i,l];case"hwb":return n.rgbToHwb(c,i,l);case"hsl":return n.rgbToHsl(c,i,l);case"hsv":return n.rgbToHsv(c,i,l);case"cmyk":return[e,o,a,u]}},t}();r.default=u},"./src/color-names.ts": | ||
/*! exports provided: ColorFormatter, default */function(t,e,r){"use strict";r.r(e),r.d(e,"ColorFormatter",(function(){return u}));var n=r(/*! ./color-converter */"./src/color-converter.ts"),o=r(/*! ./color-names */"./src/color-names.ts"),a=r(/*! ./util/util */"./src/util/util.ts"),u=function(){function t(){this.resolveHwb=n.resolveHwb}return t.prototype.setColor=function(t){return t.alpha=Object(a.resolveAlpha)(t.alpha),this.color=t,this},t.prototype.getColor=function(){return this.color},t.prototype.getColorAs=function(t){return this.color.model===t?this.color:this.convert(this.color,t)},t.prototype.getModel=function(){return this.color?this.color.model:void 0},t.prototype.changeModel=function(t){return this.color.model===t?this:this.setColor(this.convert(this.color,t))},t.prototype.getAlpha=function(){return this.color.alpha},t.prototype.setAlpha=function(t){return this.color.alpha=t,this},t.prototype.convert=function(t,e){var r;switch(t.model){case"rgb":r=this.convertFromRgb(t.values,e);break;case"hwb":r=this.convertFromHwb(t.values,e);break;case"hsl":r=this.convertFromHsl(t.values,e);break;case"hsv":r=this.convertFromHsv(t.values,e);break;case"cmyk":r=this.convertFromCmyk(t.values,e)}if(!r.length)throw new Error("Converting Error!");return{model:e,values:r,alpha:t.alpha}},t.prototype.toString=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];switch(t=t||this.color.model){case"hex":return this.toHex.apply(this,e);case"hwb":return this.toHwb();case"hsl":return this.toHsl();case"hsv":return this.toHsv();case"cmyk":return this.toCmyk();default:return this.toRgb.apply(this,e)}},t.prototype.toHex=function(t){void 0===t&&(t="full");var e=this.getColorAs("rgb"),r=e.values.map((function(t){return Math.round(t)})),u=r[0],s=r[1],c=r[2],i=1===e.alpha?null:e.alpha;switch(t){case"name":return function(){for(var t="",e=0,r=Object.keys(o.default);e<r.length;e++){var l=r[e];if(Object(a.arrayIsEqual)(o.default[l],[u,s,c])){t=l;break}}return null===i&&""!==t?t:"#"+n.rgbToHex(u,s,c,i,!0)}();case"short":return"#"+n.rgbToHex(u,s,c,i,!0);case"full":default:return"#"+n.rgbToHex(u,s,c,i)}},t.prototype.toRgb=function(t){var e;void 0===t&&(t="default");var r=this.getColorAs("rgb"),n=r.values.map((function(t){return Math.round(t)})),o=n[0],a=n[1],u=n[2];return"percent"===t&&(e=[o,a,u].map((function(t){return t/255*100+"%"})),o=e[0],a=e[1],u=e[2]),1===r.alpha?"rgb("+o+", "+a+", "+u+")":"rgba("+o+", "+a+", "+u+", "+r.alpha+")"},t.prototype.toHwb=function(){var t=this.getColorAs("hwb"),e=t.values.map((function(t){return Object(a.decimal)(t,2)}));return"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+(1===t.alpha?"":", "+t.alpha)+")"},t.prototype.toHsl=function(){var t=this.getColorAs("hsl"),e=t.values.map((function(t){return Object(a.decimal)(t,2)})),r=e[0],n=e[1],o=e[2];return 1===t.alpha?"hsl("+r+", "+n+"%, "+o+"%)":"hsla("+r+", "+n+"%, "+o+"%, "+t.alpha+")"},t.prototype.toHsv=function(){var t=this.getColorAs("hsv"),e=t.values.map((function(t){return Object(a.decimal)(t,2)})),r=e[0],n=e[1],o=e[2];return 1===t.alpha?"hsv("+r+", "+n+"%, "+o+"%)":"hsva("+r+", "+n+"%, "+o+"%, "+t.alpha+")"},t.prototype.toCmyk=function(){var t=this.getColorAs("cmyk"),e=t.values.map((function(t){return Object(a.decimal)(t,2)}));return"cmyk("+e[0]+"%, "+e[1]+"%, "+e[2]+"%, "+e[3]+"%"+(1===t.alpha?"":", "+t.alpha)+")"},t.prototype.convertFromRgb=function(t,e){var r=t[0],o=t[1],a=t[2];switch(e){case"rgb":return[r,o,a];case"hwb":return n.rgbToHwb(r,o,a);case"hsl":return n.rgbToHsl(r,o,a);case"hsv":return n.rgbToHsv(r,o,a);case"cmyk":return n.rgbToCmyk(r,o,a)}},t.prototype.convertFromHwb=function(t,e){var r=t[0],o=t[1],a=t[2],u=n.hwbToRgb(r,o,a),s=u[0],c=u[1],i=u[2];switch(e){case"rgb":return[s,c,i];case"hwb":return[r,o,a];case"hsl":return n.rgbToHsl(s,c,i);case"hsv":return n.hwbToHsv(r,o,a);case"cmyk":return n.rgbToCmyk(s,c,i)}},t.prototype.convertFromHsl=function(t,e){var r=t[0],o=t[1],a=t[2],u=n.hslToRgb(r,o,a),s=u[0],c=u[1],i=u[2];switch(e){case"rgb":return[s,c,i];case"hwb":return n.rgbToHwb(s,c,i);case"hsl":return[r,o,a];case"hsv":return n.rgbToHsv(s,c,i);case"cmyk":return n.rgbToCmyk(s,c,i)}},t.prototype.convertFromHsv=function(t,e){var r=t[0],o=t[1],a=t[2],u=n.hsvToRgb(r,o,a),s=u[0],c=u[1],i=u[2];switch(e){case"rgb":return[s,c,i];case"hwb":return n.hsvToHwb(r,o,a);case"hsl":return n.rgbToHsl(s,c,i);case"hsv":return[r,o,a];case"cmyk":return n.rgbToCmyk(s,c,i)}},t.prototype.convertFromCmyk=function(t,e){var r=t[0],o=t[1],a=t[2],u=t[3],s=n.cmykToRgb(r,o,a,u),c=s[0],i=s[1],l=s[2];switch(e){case"rgb":return[c,i,l];case"hwb":return n.rgbToHwb(c,i,l);case"hsl":return n.rgbToHsl(c,i,l);case"hsv":return n.rgbToHsv(c,i,l);case"cmyk":return[r,o,a,u]}},t}();e.default=u},"./src/color-names.ts": | ||
/*!****************************!*\ | ||
!*** ./src/color-names.ts ***! | ||
\****************************/ | ||
/*! exports provided: default */function(t,r,e){"use strict";e.r(r);var n=e(/*! color-name */"./node_modules/color-name/index.js");r.default=n},"./src/input-parser.ts": | ||
/*! exports provided: default */function(t,e,r){"use strict";r.r(e);var n=r(/*! color-name */"./node_modules/color-name/index.js");e.default=n},"./src/input-parser.ts": | ||
/*!*****************************!*\ | ||
!*** ./src/input-parser.ts ***! | ||
\*****************************/ | ||
/*! exports provided: default */function(t,r,e){"use strict";e.r(r),e.d(r,"default",function(){return u});var n=e(/*! ./color-converter */"./src/color-converter.ts"),o=e(/*! ./color-names */"./src/color-names.ts"),a=e(/*! ./util/util */"./src/util/util.ts");function u(t){if(t in o.default)return{model:"rgb",values:o.default[t],alpha:1};if("transparent"===t)return{model:"rgb",values:[0,0,0],alpha:0};switch(t.substr(0,3).toLowerCase()){case"hwb":return function(t){var r=/^hwba?\s*\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i;if(r.test(t)){var e=t.match(r),o=e[1],u=e[2],s=e[3],c=e[4];return{model:"hwb",values:Object(n.resolveHwb)(Object(a.degree)(o),Object(a.clamp)(parseFloat(u),0,100),Object(a.clamp)(parseFloat(s),0,100)),alpha:Object(a.resolveAlpha)(c)}}return null}(t);case"hsl":return function(t){var r=/^hsla?\s*\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i;if(r.test(t)){var e=t.match(r),n=e[1],o=e[2],u=e[3],s=e[4];return{model:"hsl",values:[Object(a.degree)(n),Object(a.clamp)(parseFloat(o),0,100),Object(a.clamp)(parseFloat(u),0,100)],alpha:Object(a.resolveAlpha)(s)}}return null}(t);case"hsv":return function(t){var r=/^hsva?\s*\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i;if(r.test(t)){var e=t.match(r),n=e[1],o=e[2],u=e[3],s=e[4];return{model:"hsv",values:[Object(a.degree)(n),Object(a.clamp)(parseFloat(o),0,100),Object(a.clamp)(parseFloat(u),0,100)],alpha:Object(a.resolveAlpha)(s)}}return null}(t);case"cmy":return function(t){var r=/^cmyk\s*\(\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i;if(r.test(t)){var e=t.match(r),n=e[1],o=e[2],u=e[3],s=e[4],c=e[5];return{model:"cmyk",values:[Object(a.clamp)(parseFloat(n),0,100),Object(a.clamp)(parseFloat(o),0,100),Object(a.clamp)(parseFloat(u),0,100),Object(a.clamp)(parseFloat(s),0,100)],alpha:Object(a.resolveAlpha)(c)}}return null}(t);default:return function(t){var r,e,n=/^#?([a-f0-9]{6})([a-f0-9]{2})?$/i,o=/^#?([a-f0-9]{3})([a-f0-9]{1})?$/i,u=/^rgba?\s*\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,s=/^rgba?\s*\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,c=function(t){return Math.round(parseInt(t,16)/255*100)/100};if(n.test(t)){var i=t.match(n),l=i[1],h=i[2];r=l.match(/.{2}/g).map(function(t){return parseInt(t,16)}),e=h?c(h):1}else if(o.test(t)){var p=t.match(o),l=p[1],h=p[2];r=l.match(/.{1}/g).map(function(t){return parseInt(t+t,16)}),e=h?c(h):1}else if(u.test(t)){var f=t.match(u),d=f[1],b=f[2],m=f[3],h=f[4];r=[d,b,m].map(function(t){return parseInt(t,0)}),e=Object(a.resolveAlpha)(h)}else{if(!s.test(t))return null;var g=t.match(s),d=g[1],b=g[2],m=g[3],h=g[4];r=[d,b,m].map(function(t){return Math.round(2.55*parseFloat(t))}),e=Object(a.resolveAlpha)(h)}return{model:"rgb",values:r.map(function(t){return Object(a.clamp)(t,0,255)}),alpha:Object(a.clamp)(e,0,1)}}(t)}}},"./src/moo-color.ts": | ||
/*! exports provided: default */function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return u}));var n=r(/*! ./color-converter */"./src/color-converter.ts"),o=r(/*! ./color-names */"./src/color-names.ts"),a=r(/*! ./util/util */"./src/util/util.ts");function u(t){if(t in o.default)return{model:"rgb",values:o.default[t],alpha:1};if("transparent"===t)return{model:"rgb",values:[0,0,0],alpha:0};switch(t.substr(0,3).toLowerCase()){case"hwb":return function(t){var e=/^hwba?\s*\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i;if(e.test(t)){var r=t.match(e),o=r[1],u=r[2],s=r[3],c=r[4];return{model:"hwb",values:Object(n.resolveHwb)(Object(a.degree)(o),Object(a.clamp)(parseFloat(u),0,100),Object(a.clamp)(parseFloat(s),0,100)),alpha:Object(a.resolveAlpha)(c)}}return null}(t);case"hsl":return function(t){var e=/^hsla?\s*\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i;if(e.test(t)){var r=t.match(e),n=r[1],o=r[2],u=r[3],s=r[4];return{model:"hsl",values:[Object(a.degree)(n),Object(a.clamp)(parseFloat(o),0,100),Object(a.clamp)(parseFloat(u),0,100)],alpha:Object(a.resolveAlpha)(s)}}return null}(t);case"hsv":return function(t){var e=/^hsva?\s*\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i;if(e.test(t)){var r=t.match(e),n=r[1],o=r[2],u=r[3],s=r[4];return{model:"hsv",values:[Object(a.degree)(n),Object(a.clamp)(parseFloat(o),0,100),Object(a.clamp)(parseFloat(u),0,100)],alpha:Object(a.resolveAlpha)(s)}}return null}(t);case"cmy":return function(t){var e=/^cmyk\s*\(\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i;if(e.test(t)){var r=t.match(e),n=r[1],o=r[2],u=r[3],s=r[4],c=r[5];return{model:"cmyk",values:[Object(a.clamp)(parseFloat(n),0,100),Object(a.clamp)(parseFloat(o),0,100),Object(a.clamp)(parseFloat(u),0,100),Object(a.clamp)(parseFloat(s),0,100)],alpha:Object(a.resolveAlpha)(c)}}return null}(t);default:return function(t){var e,r,n=/^#?([a-f0-9]{6})([a-f0-9]{2})?$/i,o=/^#?([a-f0-9]{3})([a-f0-9]{1})?$/i,u=/^rgba?\s*\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,s=/^rgba?\s*\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,c=function(t){return Math.round(parseInt(t,16)/255*100)/100};if(n.test(t)){var i=t.match(n),l=i[1],h=i[2];e=l.match(/.{2}/g).map((function(t){return parseInt(t,16)})),r=h?c(h):1}else if(o.test(t)){var p=t.match(o);l=p[1],h=p[2];e=l.match(/.{1}/g).map((function(t){return parseInt(t+t,16)})),r=h?c(h):1}else if(u.test(t)){var f=t.match(u),d=f[1],b=f[2],m=f[3];h=f[4];e=[d,b,m].map((function(t){return parseInt(t,0)})),r=Object(a.resolveAlpha)(h)}else{if(!s.test(t))return null;var g=t.match(s);d=g[1],b=g[2],m=g[3],h=g[4];e=[d,b,m].map((function(t){return Math.round(2.55*parseFloat(t))})),r=Object(a.resolveAlpha)(h)}return{model:"rgb",values:e.map((function(t){return Object(a.clamp)(t,0,255)})),alpha:Object(a.clamp)(r,0,1)}}(t)}}},"./src/moo-color.ts": | ||
/*!**************************!*\ | ||
!*** ./src/moo-color.ts ***! | ||
\**************************/ | ||
/*! exports provided: ColorFormatter, MooColor, default */function(t,r,e){"use strict";e.r(r),e.d(r,"MooColor",function(){return c});var n=e(/*! ./color-converter */"./src/color-converter.ts"),o=e(/*! ./color-formatter */"./src/color-formatter.ts");e.d(r,"ColorFormatter",function(){return o.default});var a=e(/*! ./input-parser */"./src/input-parser.ts"),u=e(/*! ./util/util */"./src/util/util.ts"),s=function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),c=function(t){function r(r){var e=t.call(this)||this;return"object"==typeof r&&null!==r?e.setColor(r):"string"!=typeof r&&void 0!==r||(r=r||"#000",e.setColorByParser(r)),e}return s(r,t),r.mix=function(t,e,n){void 0===n&&(n=50);var o=t instanceof r?t:new r(t);return(e instanceof r?e:new r(e)).mix(o,n)},r.random=function(t){var e,o=void 0===t?{}:t,a=o.hue,s=o.white,c=o.black;return a=(e=[a,s,c].map(function(t,r){if("number"==typeof t)return t;if(Array.isArray(t)){var e=0===r?0:2;return Object(u.getRandom)(Math.min.apply(Math,t),Math.max.apply(Math,t),e)}return 0===r?Object(u.getRandom)(0,360):Object(u.getRandom)(0,100,2)}))[0],s=e[1],c=e[2],new r({model:"hwb",values:Object(n.resolveHwb)(Object(u.degree)(a),Object(u.clamp)(s,0,100),Object(u.clamp)(c,0,100)),alpha:1})},r.prototype.setColorByParser=function(t){var r=Object(a.default)(t);if(!r)throw new Error("parsing error!");return this.setColor(r)},r.prototype.clone=function(){return new r(this.color)},Object.defineProperty(r.prototype,"brightness",{get:function(){var t=this.getColorAs("rgb").values;return(299*t[0]+587*t[1]+114*t[2])/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isLight",{get:function(){return this.brightness>=128},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isDark",{get:function(){return this.brightness<128},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"luminance",{get:function(){var t=this.getColorAs("rgb").values.map(function(t){return t/255});return.2126*t[0]+.7152*t[1]+.0722*t[2]},enumerable:!0,configurable:!0}),r.prototype.contrastRatioWith=function(t){return(Math.max(this.luminance,t.luminance)+.05)/(Math.min(this.luminance,t.luminance)+.05)},r.prototype.isContrastEnough=function(t){return this.contrastRatioWith(t)>=4.5},r.prototype.lighten=function(t){return this.manipulate("hsl",function(r,e,n){return[r,e,n=Object(u.clamp)(n+t,0,100)]})},r.prototype.darken=function(t){return this.manipulate("hsl",function(r,e,n){return[r,e,n=Object(u.clamp)(n-t,0,100)]})},r.prototype.saturate=function(t){return this.manipulate("hsl",function(r,e,n){return[r,e=Object(u.clamp)(e+t,0,100),n]})},r.prototype.desaturate=function(t){return this.manipulate("hsl",function(r,e,n){return[r,e=Object(u.clamp)(e-t,0,100),n]})},r.prototype.grayscale=function(){return this.manipulate("hsl",function(t,r,e){return[t,0,e]})},r.prototype.whiten=function(t){var r=this;return this.manipulate("hwb",function(e,n,o){return r.resolveHwb(e,Object(u.clamp)(n+t,0,100),o)})},r.prototype.blacken=function(t){var r=this;return this.manipulate("hwb",function(e,n,o){return r.resolveHwb(e,n,Object(u.clamp)(o+t,0,100))})},r.prototype.rotate=function(t){return this.manipulate("hsl",function(r,e,n){return[Object(u.degree)(r+t),e,n]})},r.prototype.mix=function(t,e){void 0===e&&(e=50),e/=100;var n=this.getModel(),o=this.getColorAs("rgb"),a=t.getColorAs("rgb");return new r({model:"rgb",values:o.values.map(function(t,r){return t+(a.values[r]-t)*e}),alpha:o.alpha+(a.alpha-o.alpha)*e}).changeModel(n)},r.prototype.complement=function(){return this.manipulate("hsl",function(t,r,e){return[Object(u.degree)(t+180),r,e]})},r.prototype.invert=function(t){void 0===t&&(t=100),t/=100;return this.manipulate("rgb",function(r,e,n){return[r,e,n].map(function(r){return function(t){return Math.round(Math.abs(t))}(255*t-r)})})},r.prototype.manipulate=function(t,r){var e=this.color.model,n=this.getColorAs(t);return n.values=r.apply(void 0,n.values),this.setColor(n).changeModel(e)},r}(o.default);r.default=c},"./src/util/util.ts": | ||
/*! exports provided: ColorFormatter, MooColor, default */function(t,e,r){"use strict";r.r(e),r.d(e,"MooColor",(function(){return i}));var n=r(/*! ./color-converter */"./src/color-converter.ts"),o=r(/*! ./color-formatter */"./src/color-formatter.ts");r.d(e,"ColorFormatter",(function(){return o.default}));var a,u=r(/*! ./input-parser */"./src/input-parser.ts"),s=r(/*! ./util/util */"./src/util/util.ts"),c=(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=function(t){function e(e){var r=t.call(this)||this;return"object"==typeof e&&null!==e?r.setColor(e):"string"!=typeof e&&void 0!==e||(e=e||"#000",r.setColorByParser(e)),r}return c(e,t),e.mix=function(t,r,n){void 0===n&&(n=50);var o=t instanceof e?t:new e(t);return(r instanceof e?r:new e(r)).mix(o,n)},e.random=function(t){var r,o=void 0===t?{}:t,a=o.hue,u=o.white,c=o.black;return r=[a,u,c].map((function(t,e){if("number"==typeof t)return t;if(Array.isArray(t)){var r=0===e?0:2;return Object(s.getRandom)(Math.min.apply(Math,t),Math.max.apply(Math,t),r)}return 0===e?Object(s.getRandom)(0,360):Object(s.getRandom)(0,100,2)})),a=r[0],u=r[1],c=r[2],new e({model:"hwb",values:Object(n.resolveHwb)(Object(s.degree)(a),Object(s.clamp)(u,0,100),Object(s.clamp)(c,0,100)),alpha:1})},e.prototype.setColorByParser=function(t){var e=Object(u.default)(t);if(!e)throw new Error("parsing error!");return this.setColor(e)},e.prototype.clone=function(){return new e(this.color)},Object.defineProperty(e.prototype,"brightness",{get:function(){var t=this.getColorAs("rgb").values;return(299*t[0]+587*t[1]+114*t[2])/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLight",{get:function(){return this.brightness>=128},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDark",{get:function(){return this.brightness<128},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"luminance",{get:function(){var t=this.getColorAs("rgb").values.map((function(t){return t/255}));return.2126*t[0]+.7152*t[1]+.0722*t[2]},enumerable:!0,configurable:!0}),e.prototype.contrastRatioWith=function(t){return(Math.max(this.luminance,t.luminance)+.05)/(Math.min(this.luminance,t.luminance)+.05)},e.prototype.isContrastEnough=function(t){return this.contrastRatioWith(t)>=4.5},e.prototype.lighten=function(t){return this.manipulate("hsl",(function(e,r,n){return[e,r,n=Object(s.clamp)(n+t,0,100)]}))},e.prototype.darken=function(t){return this.manipulate("hsl",(function(e,r,n){return[e,r,n=Object(s.clamp)(n-t,0,100)]}))},e.prototype.saturate=function(t){return this.manipulate("hsl",(function(e,r,n){return[e,r=Object(s.clamp)(r+t,0,100),n]}))},e.prototype.desaturate=function(t){return this.manipulate("hsl",(function(e,r,n){return[e,r=Object(s.clamp)(r-t,0,100),n]}))},e.prototype.grayscale=function(){return this.manipulate("hsl",(function(t,e,r){return[t,0,r]}))},e.prototype.whiten=function(t){var e=this;return this.manipulate("hwb",(function(r,n,o){return e.resolveHwb(r,Object(s.clamp)(n+t,0,100),o)}))},e.prototype.blacken=function(t){var e=this;return this.manipulate("hwb",(function(r,n,o){return e.resolveHwb(r,n,Object(s.clamp)(o+t,0,100))}))},e.prototype.rotate=function(t){return this.manipulate("hsl",(function(e,r,n){return[Object(s.degree)(e+t),r,n]}))},e.prototype.mix=function(t,r){void 0===r&&(r=50),r/=100;var n=this.getModel(),o=this.getColorAs("rgb"),a=t.getColorAs("rgb");return new e({model:"rgb",values:o.values.map((function(t,e){return t+(a.values[e]-t)*r})),alpha:o.alpha+(a.alpha-o.alpha)*r}).changeModel(n)},e.prototype.complement=function(){return this.manipulate("hsl",(function(t,e,r){return[Object(s.degree)(t+180),e,r]}))},e.prototype.invert=function(t){void 0===t&&(t=100),t/=100;return this.manipulate("rgb",(function(e,r,n){return[e,r,n].map((function(e){return function(t){return Math.round(Math.abs(t))}(255*t-e)}))}))},e.prototype.manipulate=function(t,e){var r=this.color.model,n=this.getColorAs(t);return n.values=e.apply(void 0,n.values),this.setColor(n).changeModel(r)},e}(o.default);e.default=i},"./src/util/util.ts": | ||
/*!**************************!*\ | ||
!*** ./src/util/util.ts ***! | ||
\**************************/ | ||
/*! exports provided: padStart, padEnd, clamp, degree, resolveAlpha, decimal, getRandom, arrayIsEqual */function(t,r,e){"use strict";function n(t,r,e){var n=r-t.length;return n>0?""+a(e,n)+t:t}function o(t,r,e){var n=r-t.length;return n>0?""+t+a(e,n):t}function a(t,r){for(;t.length<r;)t+=t;return t.substring(0,r)}function u(t,r,e){return Math.min(Math.max(r,t),e)}function s(t){return((t="string"==typeof t?parseFloat(t):t)%360+360)%360}function c(t){return t="string"==typeof t?parseFloat(t):t,u(isNaN(t)?1:t,0,1)}function i(t,r){var e=Math.pow(10,r);return Math.round(t*e)/e}function l(t,r,e){return void 0===e&&(e=0),i(Math.random()*(r-t)+t,e)}function h(t,r){return t.length===r.length&&t.every(function(t,e){return Array.isArray(t)?h(t,r[e]):t===r[e]})}e.r(r),e.d(r,"padStart",function(){return n}),e.d(r,"padEnd",function(){return o}),e.d(r,"clamp",function(){return u}),e.d(r,"degree",function(){return s}),e.d(r,"resolveAlpha",function(){return c}),e.d(r,"decimal",function(){return i}),e.d(r,"getRandom",function(){return l}),e.d(r,"arrayIsEqual",function(){return h})}})}); | ||
/*! exports provided: padStart, padEnd, clamp, degree, resolveAlpha, decimal, getRandom, arrayIsEqual */function(t,e,r){"use strict";function n(t,e,r){var n=e-t.length;return n>0?""+a(r,n)+t:t}function o(t,e,r){var n=e-t.length;return n>0?""+t+a(r,n):t}function a(t,e){for(;t.length<e;)t+=t;return t.substring(0,e)}function u(t,e,r){return Math.min(Math.max(e,t),r)}function s(t){return((t="string"==typeof t?parseFloat(t):t)%360+360)%360}function c(t){return t="string"==typeof t?parseFloat(t):t,u(isNaN(t)?1:t,0,1)}function i(t,e){var r=Math.pow(10,e);return Math.round(t*r)/r}function l(t,e,r){return void 0===r&&(r=0),i(Math.random()*(e-t)+t,r)}function h(t,e){return t.length===e.length&&t.every((function(t,r){return Array.isArray(t)?h(t,e[r]):t===e[r]}))}r.r(e),r.d(e,"padStart",(function(){return n})),r.d(e,"padEnd",(function(){return o})),r.d(e,"clamp",(function(){return u})),r.d(e,"degree",(function(){return s})),r.d(e,"resolveAlpha",(function(){return c})),r.d(e,"decimal",(function(){return i})),r.d(e,"getRandom",(function(){return l})),r.d(e,"arrayIsEqual",(function(){return h}))}})})); |
{ | ||
"name": "moo-color", | ||
"version": "0.2.4", | ||
"version": "1.0.0", | ||
"description": "The simple javascript library that provides convenient methods for color parsing and manipulation.", | ||
@@ -30,21 +30,22 @@ "main": "dist/moo-color.js", | ||
"dependencies": { | ||
"color-name": "^1.1.3" | ||
"color-name": "^1.1.4" | ||
}, | ||
"devDependencies": { | ||
"@types/color-name": "^1.1.0", | ||
"@types/jest": "^23.3.1", | ||
"jest": "^23.5.0", | ||
"@types/color-name": "^1.1.1", | ||
"@types/jest": "^24.0.19", | ||
"@typescript-eslint/eslint-plugin": "^2.4.0", | ||
"@typescript-eslint/parser": "^2.4.0", | ||
"eslint": "^6.5.1", | ||
"jest": "^24.9.0", | ||
"source-map-loader": "^0.2.4", | ||
"ts-jest": "^23.1.3", | ||
"ts-loader": "^4.5.0", | ||
"typescript": "^3.0.1", | ||
"webpack": "^4.16.5", | ||
"webpack-cli": "^3.1.0", | ||
"webpack-merge": "^4.1.4", | ||
"webpack-notifier": "^1.6.0" | ||
"ts-jest": "^24.1.0", | ||
"ts-loader": "^6.2.0", | ||
"typescript": "^3.6.4", | ||
"webpack": "^4.41.2", | ||
"webpack-cli": "^3.3.9", | ||
"webpack-merge": "^4.2.2", | ||
"webpack-notifier": "^1.8.0" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"preset": "ts-jest", | ||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
@@ -51,0 +52,0 @@ "moduleFileExtensions": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
228563
37
3410
0
14
Updatedcolor-name@^1.1.4