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

@ctrl/tinycolor

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ctrl/tinycolor - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

2

bundles/tinycolor.umd.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.tinycolor=e()}(this,function(){"use strict";var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function e(t,e){(function(t){return"string"==typeof t&&-1!==t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!==t.indexOf("%")}(t);return t=360===e?t:Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(String(t*e),10)/100),Math.abs(t-e)<1e-6?1:t=360===e?(t<0?t%e+e:t%e)/parseFloat(String(e)):t%e/parseFloat(String(e))}function r(t){return Math.min(1,Math.max(0,t))}function n(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function a(t){return t<=1?100*+t+"%":t}function o(t){return 1===t.length?"0"+t:""+t}function i(t,r,n){t=e(t,255),r=e(r,255),n=e(n,255);var a=Math.max(t,r,n),o=Math.min(t,r,n),i=0,s=0,h=(a+o)/2;if(a===o)i=s=0;else{var u=a-o;switch(s=h>.5?u/(2-a-o):u/(a+o),a){case t:i=(r-n)/u+(r<n?6:0);break;case r:i=(n-t)/u+2;break;case n:i=(t-r)/u+4}i/=6}return{h:i,s:s,l:h}}function s(t,r,n){t=e(t,255),r=e(r,255),n=e(n,255);var a=Math.max(t,r,n),o=Math.min(t,r,n),i=0,s=a,h=a-o,u=0===a?0:h/a;if(a===o)i=0;else{switch(a){case t:i=(r-n)/h+(r<n?6:0);break;case r:i=(n-t)/h+2;break;case n:i=(t-r)/h+4}i/=6}return{h:i,s:u,v:s}}function h(t,e,r,n){var a=[o(Math.round(t).toString(16)),o(Math.round(e).toString(16)),o(Math.round(r).toString(16))];return n&&a[0].charAt(0)===a[0].charAt(1)&&a[1].charAt(0)===a[1].charAt(1)&&a[2].charAt(0)===a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function u(t,e,r,n){return[o(f(n)),o(Math.round(t).toString(16)),o(Math.round(e).toString(16)),o(Math.round(r).toString(16))].join("")}function f(t){return Math.round(255*parseFloat(t)).toString(16)}function l(t){return d(t)/255}function d(t){return parseInt(t,16)}function g(t){var r,o,i,s={r:0,g:0,b:0},h=1,u=null,f=null,l=null,d=!1,g=!1;return"string"==typeof t&&(t=v(t)),"object"==typeof t&&(y(t.r)&&y(t.g)&&y(t.b)?(r=t.r,o=t.g,i=t.b,s={r:255*e(r,255),g:255*e(o,255),b:255*e(i,255)},d=!0,g="%"===String(t.r).substr(-1)?"prgb":"rgb"):y(t.h)&&y(t.s)&&y(t.v)?(u=a(t.s),f=a(t.v),s=function(t,r,n){t=6*e(t,360),r=e(r,100),n=e(n,100);var a=Math.floor(t),o=t-a,i=n*(1-r),s=n*(1-o*r),h=n*(1-(1-o)*r),u=a%6;return{r:255*[n,s,i,i,h,n][u],g:255*[h,n,n,s,i,i][u],b:255*[i,i,h,n,n,s][u]}}(t.h,u,f),d=!0,g="hsv"):y(t.h)&&y(t.s)&&y(t.l)&&(u=a(t.s),l=a(t.l),s=function(t,r,n){var a,o,i;function s(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=e(t,360),r=e(r,100),n=e(n,100),0===r)a=o=i=n;else{var h=n<.5?n*(1+r):n+r-n*r,u=2*n-h;a=s(u,h,t+1/3),o=s(u,h,t),i=s(u,h,t-1/3)}return{r:255*a,g:255*o,b:255*i}}(t.h,u,l),d=!0,g="hsl"),t.hasOwnProperty("a")&&(h=t.a)),h=n(h),{ok:d,format:t.format||g,r:Math.min(255,Math.max(s.r,0)),g:Math.min(255,Math.max(s.g,0)),b:Math.min(255,Math.max(s.b,0)),a:h}}var c="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",b="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",p="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",m={CSS_UNIT:new RegExp(c),rgb:new RegExp("rgb"+b),rgba:new RegExp("rgba"+p),hsl:new RegExp("hsl"+b),hsla:new RegExp("hsla"+p),hsv:new RegExp("hsv"+b),hsva:new RegExp("hsva"+p),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function v(e){if(0===(e=e.trim().toLowerCase()).length)return!1;var r=!1;if(t[e])e=t[e],r=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var n=m.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=m.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=m.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=m.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=m.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=m.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=m.hex8.exec(e))?{r:d(n[1]),g:d(n[2]),b:d(n[3]),a:l(n[4]),format:r?"name":"hex8"}:(n=m.hex6.exec(e))?{r:d(n[1]),g:d(n[2]),b:d(n[3]),format:r?"name":"hex"}:(n=m.hex4.exec(e))?{r:d(n[1]+n[1]),g:d(n[2]+n[2]),b:d(n[3]+n[3]),a:l(n[4]+n[4]),format:r?"name":"hex8"}:!!(n=m.hex3.exec(e))&&{r:d(n[1]+n[1]),g:d(n[2]+n[2]),b:d(n[3]+n[3]),format:r?"name":"hex"}}function y(t){return!!m.CSS_UNIT.exec(String(t))}var w=function(){function a(t,e){if(void 0===t&&(t=""),void 0===e&&(e={}),t instanceof a)return t;this.originalInput=t;var r=g(t);this.originalInput=t,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=e.format||r.format,this.gradientType=e.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return a.prototype.isDark=function(){return this.getBrightness()<128},a.prototype.isLight=function(){return!this.isDark()},a.prototype.getBrightness=function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},a.prototype.getLuminance=function(){var t=this.toRgb(),e=t.r/255,r=t.g/255,n=t.b/255;return.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},a.prototype.setAlpha=function(t){return this.a=n(t),this.roundA=Math.round(100*this.a)/100,this},a.prototype.toHsv=function(){var t=s(this.r,this.g,this.b);return{h:360*t.h,s:t.s,v:t.v,a:this.a}},a.prototype.toHsvString=function(){var t=s(this.r,this.g,this.b),e=Math.round(360*t.h),r=Math.round(100*t.s),n=Math.round(100*t.v);return 1===this.a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this.roundA+")"},a.prototype.toHsl=function(){var t=i(this.r,this.g,this.b);return{h:360*t.h,s:t.s,l:t.l,a:this.a}},a.prototype.toHslString=function(){var t=i(this.r,this.g,this.b),e=Math.round(360*t.h),r=Math.round(100*t.s),n=Math.round(100*t.l);return 1===this.a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this.roundA+")"},a.prototype.toHex=function(t){return void 0===t&&(t=!1),h(this.r,this.g,this.b,t)},a.prototype.toHexString=function(t){return void 0===t&&(t=!1),"#"+this.toHex(t)},a.prototype.toHex8=function(t){return void 0===t&&(t=!1),function(t,e,r,n,a){var i=[o(Math.round(t).toString(16)),o(Math.round(e).toString(16)),o(Math.round(r).toString(16)),o(f(n))];return a&&i[0].charAt(0)===i[0].charAt(1)&&i[1].charAt(0)===i[1].charAt(1)&&i[2].charAt(0)===i[2].charAt(1)&&i[3].charAt(0)===i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}(this.r,this.g,this.b,this.a,t)},a.prototype.toHex8String=function(t){return void 0===t&&(t=!1),"#"+this.toHex8(t)},a.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},a.prototype.toRgbString=function(){var t=Math.round(this.r),e=Math.round(this.g),r=Math.round(this.b);return 1===this.a?"rgb("+t+", "+e+", "+r+")":"rgba("+t+", "+e+", "+r+", "+this.roundA+")"},a.prototype.toPercentageRgb=function(){var t=function(t){return Math.round(100*e(t,255))+"%"};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},a.prototype.toPercentageRgbString=function(){var t=function(t){return Math.round(100*e(t,255))};return 1===this.a?"rgb("+t(this.r)+"%, "+t(this.g)+"%, "+t(this.b)+"%)":"rgba("+t(this.r)+"%, "+t(this.g)+"%, "+t(this.b)+"%, "+this.roundA+")"},a.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+h(this.r,this.g,this.b,!1),r=0,n=Object.keys(t);r<n.length;r++){var a=n[r];if(t[a]===e)return a}return!1},a.prototype.toString=function(t){var e=!!t;t=t||this.format;var r=!1,n=this.a<1&&this.a>=0;return e||!n||!t.startsWith("hex")&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this.a?this.toName():this.toRgbString()},a.prototype.clone=function(){return new a(this.toString())},a.prototype.lighten=function(t){void 0===t&&(t=10);var e=this.toHsl();return e.l+=t/100,e.l=r(e.l),new a(e)},a.prototype.brighten=function(t){void 0===t&&(t=10);var e=this.toRgb();return e.r=Math.max(0,Math.min(255,e.r-Math.round(-t/100*255))),e.g=Math.max(0,Math.min(255,e.g-Math.round(-t/100*255))),e.b=Math.max(0,Math.min(255,e.b-Math.round(-t/100*255))),new a(e)},a.prototype.darken=function(t){void 0===t&&(t=10);var e=this.toHsl();return e.l-=t/100,e.l=r(e.l),new a(e)},a.prototype.tint=function(t){return void 0===t&&(t=10),this.mix("white",t)},a.prototype.shade=function(t){return void 0===t&&(t=10),this.mix("black",t)},a.prototype.desaturate=function(t){void 0===t&&(t=10);var e=this.toHsl();return e.s-=t/100,e.s=r(e.s),new a(e)},a.prototype.saturate=function(t){void 0===t&&(t=10);var e=this.toHsl();return e.s+=t/100,e.s=r(e.s),new a(e)},a.prototype.greyscale=function(){return this.desaturate(100)},a.prototype.spin=function(t){var e=this.toHsl(),r=(e.h+t)%360;return e.h=r<0?360+r:r,new a(e)},a.prototype.mix=function(t,e){void 0===e&&(e=50);var r=this.toRgb(),n=new a(t).toRgb(),o=e/100;return new a({r:(n.r-r.r)*o+r.r,g:(n.g-r.g)*o+r.g,b:(n.b-r.b)*o+r.b,a:(n.a-r.a)*o+r.a})},a.prototype.analogous=function(t,e){void 0===t&&(t=6),void 0===e&&(e=30);var r=this.toHsl(),n=360/e,o=[this];for(r.h=(r.h-(n*t>>1)+720)%360;--t;)r.h=(r.h+n)%360,o.push(new a(r));return o},a.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new a(t)},a.prototype.monochromatic=function(t){void 0===t&&(t=6);for(var e=this.toHsv(),r=e.h,n=e.s,o=e.v,i=[],s=1/t;t--;)i.push(new a({h:r,s:n,v:o})),o=(o+s)%1;return i},a.prototype.splitcomplement=function(){var t=this.toHsl(),e=t.h;return[this,new a({h:(e+72)%360,s:t.s,l:t.l}),new a({h:(e+216)%360,s:t.s,l:t.l})]},a.prototype.triad=function(){return this.polyad(3)},a.prototype.tetrad=function(){return this.polyad(4)},a.prototype.polyad=function(t){for(var e=this.toHsl(),r=e.h,n=[this],o=360/t,i=1;i<t;i++)n.push(new a({h:(r+i*o)%360,s:e.s,l:e.l}));return n},a.prototype.equals=function(t){return this.toRgbString()===new a(t).toRgbString()},a}();function M(t){t>=334&&t<=360&&(t-=360);for(var e=0,r=k;e<r.length;e++){var n=A(r[e]);if(n.hueRange&&t>=n.hueRange[0]&&t<=n.hueRange[1])return n}throw Error("Color not found")}function x(t,e){if(void 0===e)return Math.floor(t[0]+Math.random()*(t[1]+1-t[0]));var r=t[1]||1,n=t[0]||0,a=(e=(9301*e+49297)%233280)/233280;return Math.floor(n+a*(r-n))}function A(t){var e=t.lowerBounds[0][0],r=t.lowerBounds[t.lowerBounds.length-1][0],n=t.lowerBounds[t.lowerBounds.length-1][1],a=t.lowerBounds[0][1];return{name:t.name,hueRange:t.hueRange,lowerBounds:t.lowerBounds,saturationRange:[e,r],brightnessRange:[n,a]}}var k=[{name:"monochrome",hueRange:null,lowerBounds:[[0,0],[100,0]]},{name:"red",hueRange:[-26,18],lowerBounds:[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]},{name:"orange",hueRange:[19,46],lowerBounds:[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]},{name:"yellow",hueRange:[47,62],lowerBounds:[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]},{name:"green",hueRange:[63,178],lowerBounds:[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]},{name:"blue",hueRange:[179,257],lowerBounds:[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]},{name:"purple",hueRange:[258,282],lowerBounds:[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]},{name:"pink",hueRange:[283,334],lowerBounds:[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]]}];function R(t,e){var r=new w(t),n=new w(e);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)}var S=function(t,e){return void 0===t&&(t=""),void 0===e&&(e={}),new w(t,e)};return S.TinyColor=w,S.readability=R,S.mostReadable=function t(e,r,n){void 0===n&&(n={includeFallbackColors:!1,level:"AA",size:"small"});for(var a=null,o=0,i=n.includeFallbackColors,s=n.level,h=n.size,u=0,f=r;u<f.length;u++){var l=f[u],d=R(e,l);d>o&&(o=d,a=new w(l))}return function(t,e,r){void 0===r&&(r={level:"AA",size:"small"});var n=R(t,e);switch((r.level||"AA")+(r.size||"small")){case"AAsmall":case"AAAlarge":return n>=4.5;case"AAlarge":return n>=3;case"AAAsmall":return n>=7}return!1}(e,a,{level:s,size:h})||!i?a:(n.includeFallbackColors=!1,t(e,["#fff","#000"],n))},S.random=function t(e){if(void 0===e&&(e={}),void 0!==e.count&&null!==e.count){var r=e.count,n=[];for(e.count=void 0;r>n.length;)e.count=null,e.seed&&(e.seed+=1),n.push(t(e));return e.count=r,n}var a=function(t,e){var r=x(function(t){var e=parseInt(t,10);if(!Number.isNaN(e)&&e<360&&e>0)return[e,e];if("string"==typeof t){var r=k.find(function(e){return e.name===t});if(r){var n=A(r);if(n.hueRange)return n.hueRange}var a=new w(t);if(a.isValid){var o=a.toHsv().h;return[o,o]}}return[0,360]}(t),e);return r<0&&(r=360+r),r}(e.hue,e.seed),o=function(t,e){if("monochrome"===e.hue)return 0;if("random"===e.luminosity)return x([0,100],e.seed);var r=M(t).saturationRange,n=r[0],a=r[1];switch(e.luminosity){case"bright":n=55;break;case"dark":n=a-10;break;case"light":a=55}return x([n,a],e.seed)}(a,e),i={h:a,s:o,v:function(t,e,r){var n=function(t,e){for(var r=M(t).lowerBounds,n=0;n<r.length-1;n++){var a=r[n][0],o=r[n][1],i=r[n+1][0],s=r[n+1][1];if(e>=a&&e<=i){var h=(s-o)/(i-a),u=o-h*a;return h*e+u}}return 0}(t,e),a=100;switch(r.luminosity){case"dark":a=n+20;break;case"light":n=(a+n)/2;break;case"random":n=0,a=100}return x([n,a],r.seed)}(a,o,e)};return void 0!==e.alpha&&(i.a=e.alpha),new w(i)},S.names=t,S.fromRatio=function(t,e){var r={r:a(t.r),g:a(t.g),b:a(t.b)};return void 0!==t.a&&(r.a=+t.a),new w(r,e)},S.legacyRandom=function(){return new w({r:Math.random(),g:Math.random(),b:Math.random()})},S.toMsFilter=function(t,e){var r=new w(t),n="#"+u(r.r,r.g,r.b,r.a),a=n,o=r.gradientType?"GradientType = 1, ":"";if(e){var i=new w(e);a="#"+u(i.r,i.g,i.b,i.a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+n+",endColorstr="+a+")"},S.inputToRGB=g,S.stringInputToObject=v,S.isValidCSSUnit=y,S});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).tinycolor=e()}(this,function(){"use strict";var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function e(t,e){(function(t){return"string"==typeof t&&-1!==t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!==t.indexOf("%")}(t);return t=360===e?t:Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(String(t*e),10)/100),Math.abs(t-e)<1e-6?1:t=360===e?(t<0?t%e+e:t%e)/parseFloat(String(e)):t%e/parseFloat(String(e))}function r(t){return Math.min(1,Math.max(0,t))}function n(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function a(t){return t<=1?100*Number(t)+"%":t}function o(t){return 1===t.length?"0"+t:String(t)}function i(t,r,n){t=e(t,255),r=e(r,255),n=e(n,255);var a=Math.max(t,r,n),o=Math.min(t,r,n),i=0,s=0,h=(a+o)/2;if(a===o)s=0,i=0;else{var u=a-o;switch(s=h>.5?u/(2-a-o):u/(a+o),a){case t:i=(r-n)/u+(r<n?6:0);break;case r:i=(n-t)/u+2;break;case n:i=(t-r)/u+4}i/=6}return{h:i,s:s,l:h}}function s(t,r,n){t=e(t,255),r=e(r,255),n=e(n,255);var a=Math.max(t,r,n),o=Math.min(t,r,n),i=0,s=a,h=a-o,u=0===a?0:h/a;if(a===o)i=0;else{switch(a){case t:i=(r-n)/h+(r<n?6:0);break;case r:i=(n-t)/h+2;break;case n:i=(t-r)/h+4}i/=6}return{h:i,s:u,v:s}}function h(t,e,r,n){var a=[o(Math.round(t).toString(16)),o(Math.round(e).toString(16)),o(Math.round(r).toString(16))];return n&&a[0].charAt(0)===a[0].charAt(1)&&a[1].charAt(0)===a[1].charAt(1)&&a[2].charAt(0)===a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function u(t,e,r,n){return[o(f(n)),o(Math.round(t).toString(16)),o(Math.round(e).toString(16)),o(Math.round(r).toString(16))].join("")}function f(t){return Math.round(255*parseFloat(t)).toString(16)}function l(t){return d(t)/255}function d(t){return parseInt(t,16)}function g(t){var r,o,i,s={r:0,g:0,b:0},h=1,u=null,f=null,l=null,d=!1,g=!1;return"string"==typeof t&&(t=v(t)),"object"==typeof t&&(y(t.r)&&y(t.g)&&y(t.b)?(r=t.r,o=t.g,i=t.b,s={r:255*e(r,255),g:255*e(o,255),b:255*e(i,255)},d=!0,g="%"===String(t.r).substr(-1)?"prgb":"rgb"):y(t.h)&&y(t.s)&&y(t.v)?(u=a(t.s),f=a(t.v),s=function(t,r,n){t=6*e(t,360),r=e(r,100),n=e(n,100);var a=Math.floor(t),o=t-a,i=n*(1-r),s=n*(1-o*r),h=n*(1-(1-o)*r),u=a%6;return{r:255*[n,s,i,i,h,n][u],g:255*[h,n,n,s,i,i][u],b:255*[i,i,h,n,n,s][u]}}(t.h,u,f),d=!0,g="hsv"):y(t.h)&&y(t.s)&&y(t.l)&&(u=a(t.s),l=a(t.l),s=function(t,r,n){var a,o,i;function s(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*r*(e-t):r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=e(t,360),r=e(r,100),n=e(n,100),0===r)o=n,i=n,a=n;else{var h=n<.5?n*(1+r):n+r-n*r,u=2*n-h;a=s(u,h,t+1/3),o=s(u,h,t),i=s(u,h,t-1/3)}return{r:255*a,g:255*o,b:255*i}}(t.h,u,l),d=!0,g="hsl"),Object.prototype.hasOwnProperty.call(t,"a")&&(h=t.a)),h=n(h),{ok:d,format:t.format||g,r:Math.min(255,Math.max(s.r,0)),g:Math.min(255,Math.max(s.g,0)),b:Math.min(255,Math.max(s.b,0)),a:h}}var c="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",b="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",p="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",m={CSS_UNIT:new RegExp(c),rgb:new RegExp("rgb"+b),rgba:new RegExp("rgba"+p),hsl:new RegExp("hsl"+b),hsla:new RegExp("hsla"+p),hsv:new RegExp("hsv"+b),hsva:new RegExp("hsva"+p),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function v(e){if(0===(e=e.trim().toLowerCase()).length)return!1;var r=!1;if(t[e])e=t[e],r=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var n=m.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=m.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=m.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=m.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=m.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=m.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=m.hex8.exec(e))?{r:d(n[1]),g:d(n[2]),b:d(n[3]),a:l(n[4]),format:r?"name":"hex8"}:(n=m.hex6.exec(e))?{r:d(n[1]),g:d(n[2]),b:d(n[3]),format:r?"name":"hex"}:(n=m.hex4.exec(e))?{r:d(n[1]+n[1]),g:d(n[2]+n[2]),b:d(n[3]+n[3]),a:l(n[4]+n[4]),format:r?"name":"hex8"}:!!(n=m.hex3.exec(e))&&{r:d(n[1]+n[1]),g:d(n[2]+n[2]),b:d(n[3]+n[3]),format:r?"name":"hex"}}function y(t){return Boolean(m.CSS_UNIT.exec(String(t)))}var w=function(){function a(t,e){if(void 0===t&&(t=""),void 0===e&&(e={}),t instanceof a)return t;this.originalInput=t;var r=g(t);this.originalInput=t,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=e.format||r.format,this.gradientType=e.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return a.prototype.isDark=function(){return this.getBrightness()<128},a.prototype.isLight=function(){return!this.isDark()},a.prototype.getBrightness=function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},a.prototype.getLuminance=function(){var t=this.toRgb(),e=t.r/255,r=t.g/255,n=t.b/255;return.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},a.prototype.getAlpha=function(){return this.a},a.prototype.setAlpha=function(t){return this.a=n(t),this.roundA=Math.round(100*this.a)/100,this},a.prototype.toHsv=function(){var t=s(this.r,this.g,this.b);return{h:360*t.h,s:t.s,v:t.v,a:this.a}},a.prototype.toHsvString=function(){var t=s(this.r,this.g,this.b),e=Math.round(360*t.h),r=Math.round(100*t.s),n=Math.round(100*t.v);return 1===this.a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this.roundA+")"},a.prototype.toHsl=function(){var t=i(this.r,this.g,this.b);return{h:360*t.h,s:t.s,l:t.l,a:this.a}},a.prototype.toHslString=function(){var t=i(this.r,this.g,this.b),e=Math.round(360*t.h),r=Math.round(100*t.s),n=Math.round(100*t.l);return 1===this.a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this.roundA+")"},a.prototype.toHex=function(t){return void 0===t&&(t=!1),h(this.r,this.g,this.b,t)},a.prototype.toHexString=function(t){return void 0===t&&(t=!1),"#"+this.toHex(t)},a.prototype.toHex8=function(t){return void 0===t&&(t=!1),function(t,e,r,n,a){var i=[o(Math.round(t).toString(16)),o(Math.round(e).toString(16)),o(Math.round(r).toString(16)),o(f(n))];return a&&i[0].charAt(0)===i[0].charAt(1)&&i[1].charAt(0)===i[1].charAt(1)&&i[2].charAt(0)===i[2].charAt(1)&&i[3].charAt(0)===i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}(this.r,this.g,this.b,this.a,t)},a.prototype.toHex8String=function(t){return void 0===t&&(t=!1),"#"+this.toHex8(t)},a.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},a.prototype.toRgbString=function(){var t=Math.round(this.r),e=Math.round(this.g),r=Math.round(this.b);return 1===this.a?"rgb("+t+", "+e+", "+r+")":"rgba("+t+", "+e+", "+r+", "+this.roundA+")"},a.prototype.toPercentageRgb=function(){var t=function(t){return Math.round(100*e(t,255))+"%"};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},a.prototype.toPercentageRgbString=function(){var t=function(t){return Math.round(100*e(t,255))};return 1===this.a?"rgb("+t(this.r)+"%, "+t(this.g)+"%, "+t(this.b)+"%)":"rgba("+t(this.r)+"%, "+t(this.g)+"%, "+t(this.b)+"%, "+this.roundA+")"},a.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+h(this.r,this.g,this.b,!1),r=0,n=Object.keys(t);r<n.length;r++){var a=n[r];if(t[a]===e)return a}return!1},a.prototype.toString=function(t){var e=Boolean(t);t=t||this.format;var r=!1,n=this.a<1&&this.a>=0;return e||!n||!t.startsWith("hex")&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this.a?this.toName():this.toRgbString()},a.prototype.clone=function(){return new a(this.toString())},a.prototype.lighten=function(t){void 0===t&&(t=10);var e=this.toHsl();return e.l+=t/100,e.l=r(e.l),new a(e)},a.prototype.brighten=function(t){void 0===t&&(t=10);var e=this.toRgb();return e.r=Math.max(0,Math.min(255,e.r-Math.round(-t/100*255))),e.g=Math.max(0,Math.min(255,e.g-Math.round(-t/100*255))),e.b=Math.max(0,Math.min(255,e.b-Math.round(-t/100*255))),new a(e)},a.prototype.darken=function(t){void 0===t&&(t=10);var e=this.toHsl();return e.l-=t/100,e.l=r(e.l),new a(e)},a.prototype.tint=function(t){return void 0===t&&(t=10),this.mix("white",t)},a.prototype.shade=function(t){return void 0===t&&(t=10),this.mix("black",t)},a.prototype.desaturate=function(t){void 0===t&&(t=10);var e=this.toHsl();return e.s-=t/100,e.s=r(e.s),new a(e)},a.prototype.saturate=function(t){void 0===t&&(t=10);var e=this.toHsl();return e.s+=t/100,e.s=r(e.s),new a(e)},a.prototype.greyscale=function(){return this.desaturate(100)},a.prototype.spin=function(t){var e=this.toHsl(),r=(e.h+t)%360;return e.h=r<0?360+r:r,new a(e)},a.prototype.mix=function(t,e){void 0===e&&(e=50);var r=this.toRgb(),n=new a(t).toRgb(),o=e/100;return new a({r:(n.r-r.r)*o+r.r,g:(n.g-r.g)*o+r.g,b:(n.b-r.b)*o+r.b,a:(n.a-r.a)*o+r.a})},a.prototype.analogous=function(t,e){void 0===t&&(t=6),void 0===e&&(e=30);var r=this.toHsl(),n=360/e,o=[this];for(r.h=(r.h-(n*t>>1)+720)%360;--t;)r.h=(r.h+n)%360,o.push(new a(r));return o},a.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new a(t)},a.prototype.monochromatic=function(t){void 0===t&&(t=6);for(var e=this.toHsv(),r=e.h,n=e.s,o=e.v,i=[],s=1/t;t--;)i.push(new a({h:r,s:n,v:o})),o=(o+s)%1;return i},a.prototype.splitcomplement=function(){var t=this.toHsl(),e=t.h;return[this,new a({h:(e+72)%360,s:t.s,l:t.l}),new a({h:(e+216)%360,s:t.s,l:t.l})]},a.prototype.triad=function(){return this.polyad(3)},a.prototype.tetrad=function(){return this.polyad(4)},a.prototype.polyad=function(t){for(var e=this.toHsl(),r=e.h,n=[this],o=360/t,i=1;i<t;i++)n.push(new a({h:(r+i*o)%360,s:e.s,l:e.l}));return n},a.prototype.equals=function(t){return this.toRgbString()===new a(t).toRgbString()},a}();function M(t){t>=334&&t<=360&&(t-=360);for(var e=0,r=k;e<r.length;e++){var n=A(r[e]);if(n.hueRange&&t>=n.hueRange[0]&&t<=n.hueRange[1])return n}throw Error("Color not found")}function x(t,e){if(void 0===e)return Math.floor(t[0]+Math.random()*(t[1]+1-t[0]));var r=t[1]||1,n=t[0]||0,a=(e=(9301*e+49297)%233280)/233280;return Math.floor(n+a*(r-n))}function A(t){var e=t.lowerBounds[0][0],r=t.lowerBounds[t.lowerBounds.length-1][0],n=t.lowerBounds[t.lowerBounds.length-1][1],a=t.lowerBounds[0][1];return{name:t.name,hueRange:t.hueRange,lowerBounds:t.lowerBounds,saturationRange:[e,r],brightnessRange:[n,a]}}var k=[{name:"monochrome",hueRange:null,lowerBounds:[[0,0],[100,0]]},{name:"red",hueRange:[-26,18],lowerBounds:[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]},{name:"orange",hueRange:[19,46],lowerBounds:[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]},{name:"yellow",hueRange:[47,62],lowerBounds:[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]},{name:"green",hueRange:[63,178],lowerBounds:[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]},{name:"blue",hueRange:[179,257],lowerBounds:[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]},{name:"purple",hueRange:[258,282],lowerBounds:[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]},{name:"pink",hueRange:[283,334],lowerBounds:[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]]}];function R(t,e){var r=new w(t),n=new w(e);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)}var S=function(t,e){return void 0===t&&(t=""),void 0===e&&(e={}),new w(t,e)};return S.TinyColor=w,S.readability=R,S.mostReadable=function t(e,r,n){void 0===n&&(n={includeFallbackColors:!1,level:"AA",size:"small"});for(var a=null,o=0,i=n.includeFallbackColors,s=n.level,h=n.size,u=0,f=r;u<f.length;u++){var l=f[u],d=R(e,l);d>o&&(o=d,a=new w(l))}return function(t,e,r){void 0===r&&(r={level:"AA",size:"small"});var n=R(t,e);switch((r.level||"AA")+(r.size||"small")){case"AAsmall":case"AAAlarge":return n>=4.5;case"AAlarge":return n>=3;case"AAAsmall":return n>=7;default:return!1}}(e,a,{level:s,size:h})||!i?a:(n.includeFallbackColors=!1,t(e,["#fff","#000"],n))},S.random=function t(e){if(void 0===e&&(e={}),void 0!==e.count&&null!==e.count){var r=e.count,n=[];for(e.count=void 0;r>n.length;)e.count=null,e.seed&&(e.seed+=1),n.push(t(e));return e.count=r,n}var a=function(t,e){var r=x(function(t){var e=parseInt(t,10);if(!Number.isNaN(e)&&e<360&&e>0)return[e,e];if("string"==typeof t){var r=k.find(function(e){return e.name===t});if(r){var n=A(r);if(n.hueRange)return n.hueRange}var a=new w(t);if(a.isValid){var o=a.toHsv().h;return[o,o]}}return[0,360]}(t),e);return r<0&&(r=360+r),r}(e.hue,e.seed),o=function(t,e){if("monochrome"===e.hue)return 0;if("random"===e.luminosity)return x([0,100],e.seed);var r=M(t).saturationRange,n=r[0],a=r[1];switch(e.luminosity){case"bright":n=55;break;case"dark":n=a-10;break;case"light":a=55}return x([n,a],e.seed)}(a,e),i={h:a,s:o,v:function(t,e,r){var n=function(t,e){for(var r=M(t).lowerBounds,n=0;n<r.length-1;n++){var a=r[n][0],o=r[n][1],i=r[n+1][0],s=r[n+1][1];if(e>=a&&e<=i){var h=(s-o)/(i-a),u=o-h*a;return h*e+u}}return 0}(t,e),a=100;switch(r.luminosity){case"dark":a=n+20;break;case"light":n=(a+n)/2;break;case"random":n=0,a=100}return x([n,a],r.seed)}(a,o,e)};return void 0!==e.alpha&&(i.a=e.alpha),new w(i)},S.names=t,S.fromRatio=function(t,e){var r={r:a(t.r),g:a(t.g),b:a(t.b)};return void 0!==t.a&&(r.a=Number(t.a)),new w(r,e)},S.legacyRandom=function(){return new w({r:Math.random(),g:Math.random(),b:Math.random()})},S.toMsFilter=function(t,e){var r=new w(t),n="#"+u(r.r,r.g,r.b,r.a),a=n,o=r.gradientType?"GradientType = 1, ":"";if(e){var i=new w(e);a="#"+u(i.r,i.g,i.b,i.a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+n+",endColorstr="+a+")"},S.inputToRGB=g,S.stringInputToObject=v,S.isValidCSSUnit=y,S});
//# sourceMappingURL=tinycolor.umd.min.js.map

@@ -22,3 +22,4 @@ "use strict";

if (max === min) {
h = s = 0;
s = 0;
h = 0;
}

@@ -30,10 +31,12 @@ else {

case r:
h = (g - b) / d + (g < b ? 6 : 0);
h = ((g - b) / d) + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
h = ((b - r) / d) + 2;
break;
case b:
h = (r - g) / d + 4;
h = ((r - g) / d) + 4;
break;
default:
break;
}

@@ -53,8 +56,10 @@ h /= 6;

function hue2rgb(p, q, t) {
if (t < 0)
if (t < 0) {
t += 1;
if (t > 1)
}
if (t > 1) {
t -= 1;
}
if (t < 1 / 6) {
return p + (q - p) * 6 * t;
return p + ((q - p) * (6 * t));
}

@@ -65,3 +70,3 @@ if (t < 1 / 2) {

if (t < 2 / 3) {
return p + (q - p) * (2 / 3 - t) * 6;
return p + ((q - p) * ((2 / 3) - t) * 6);
}

@@ -71,10 +76,12 @@ return p;

if (s === 0) {
r = g = b = l;
g = l;
b = l;
r = l;
}
else {
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
var q = l < 0.5 ? (l * (1 + s)) : (l + s - (l * s));
var p = (2 * l) - q;
r = hue2rgb(p, q, h + (1 / 3));
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3);
b = hue2rgb(p, q, h - (1 / 3));
}

@@ -100,10 +107,12 @@ return { r: r * 255, g: g * 255, b: b * 255 };

case r:
h = (g - b) / d + (g < b ? 6 : 0);
h = ((g - b) / d) + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
h = ((b - r) / d) + 2;
break;
case b:
h = (r - g) / d + 4;
h = ((r - g) / d) + 4;
break;
default:
break;
}

@@ -122,4 +131,4 @@ h /= 6;

var p = v * (1 - s);
var q = v * (1 - f * s);
var t = v * (1 - (1 - f) * s);
var q = v * (1 - (f * s));
var t = v * (1 - ((1 - f) * s));
var mod = i % 6;

@@ -126,0 +135,0 @@ var r = [v, q, p, p, t, v][mod];

@@ -19,3 +19,4 @@ import { bound01, pad2 } from './util';

if (max === min) {
h = s = 0;
s = 0;
h = 0;
}

@@ -27,10 +28,12 @@ else {

case r:
h = (g - b) / d + (g < b ? 6 : 0);
h = ((g - b) / d) + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
h = ((b - r) / d) + 2;
break;
case b:
h = (r - g) / d + 4;
h = ((r - g) / d) + 4;
break;
default:
break;
}

@@ -49,8 +52,10 @@ h /= 6;

function hue2rgb(p, q, t) {
if (t < 0)
if (t < 0) {
t += 1;
if (t > 1)
}
if (t > 1) {
t -= 1;
}
if (t < 1 / 6) {
return p + (q - p) * 6 * t;
return p + ((q - p) * (6 * t));
}

@@ -61,3 +66,3 @@ if (t < 1 / 2) {

if (t < 2 / 3) {
return p + (q - p) * (2 / 3 - t) * 6;
return p + ((q - p) * ((2 / 3) - t) * 6);
}

@@ -67,10 +72,12 @@ return p;

if (s === 0) {
r = g = b = l;
g = l;
b = l;
r = l;
}
else {
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
var q = l < 0.5 ? (l * (1 + s)) : (l + s - (l * s));
var p = (2 * l) - q;
r = hue2rgb(p, q, h + (1 / 3));
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3);
b = hue2rgb(p, q, h - (1 / 3));
}

@@ -95,10 +102,12 @@ return { r: r * 255, g: g * 255, b: b * 255 };

case r:
h = (g - b) / d + (g < b ? 6 : 0);
h = ((g - b) / d) + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
h = ((b - r) / d) + 2;
break;
case b:
h = (r - g) / d + 4;
h = ((r - g) / d) + 4;
break;
default:
break;
}

@@ -116,4 +125,4 @@ h /= 6;

var p = v * (1 - s);
var q = v * (1 - f * s);
var t = v * (1 - (1 - f) * s);
var q = v * (1 - (f * s));
var t = v * (1 - ((1 - f) * s));
var mod = i % 6;

@@ -120,0 +129,0 @@ var r = [v, q, p, p, t, v][mod];

@@ -35,3 +35,3 @@ import { convertHexToDecimal, hslToRgb, hsvToRgb, parseIntFromHex, rgbToRgb } from './conversion';

}
if (color.hasOwnProperty('a')) {
if (Object.prototype.hasOwnProperty.call(color, 'a')) {
a = color.a;

@@ -146,3 +146,3 @@ }

export function isValidCSSUnit(color) {
return !!matchers.CSS_UNIT.exec(String(color));
return Boolean(matchers.CSS_UNIT.exec(String(color)));
}

@@ -10,3 +10,3 @@ import { TinyColor } from './index';

if (ratio.a !== undefined) {
newColor.a = +ratio.a;
newColor.a = Number(ratio.a);
}

@@ -13,0 +13,0 @@ return new TinyColor(newColor, opts);

@@ -41,3 +41,3 @@ import { rgbaToHex, rgbToHex, rgbToHsl, rgbToHsv } from './conversion';

var rgb = this.toRgb();
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
return ((rgb.r * 299) + (rgb.g * 587) + (rgb.b * 114)) / 1000;
};

@@ -70,4 +70,7 @@ TinyColor.prototype.getLuminance = function () {

}
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
};
TinyColor.prototype.getAlpha = function () {
return this.a;
};
TinyColor.prototype.setAlpha = function (alpha) {

@@ -131,3 +134,3 @@ this.a = boundAlpha(alpha);

TinyColor.prototype.toPercentageRgb = function () {
var fmt = function (x) { return Math.round(bound01(x, 255) * 100) + '%'; };
var fmt = function (x) { return Math.round(bound01(x, 255) * 100) + "%"; };
return {

@@ -142,5 +145,5 @@ r: fmt(this.r),

var rnd = function (x) { return Math.round(bound01(x, 255) * 100); };
return this.a === 1
? "rgb(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%)"
: "rgba(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%, " + this.roundA + ")";
return this.a === 1 ?
"rgb(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%)" :
"rgba(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%, " + this.roundA + ")";
};

@@ -164,3 +167,3 @@ TinyColor.prototype.toName = function () {

TinyColor.prototype.toString = function (format) {
var formatSet = !!format;
var formatSet = Boolean(format);
format = format || this.format;

@@ -267,6 +270,6 @@ var formattedString = false;

var rgba = {
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a,
r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
a: ((rgb2.a - rgb1.a) * p) + rgb1.a,
};

@@ -327,3 +330,3 @@ return new TinyColor(rgba);

for (var i = 1; i < n; i++) {
result.push(new TinyColor({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
result.push(new TinyColor({ h: (h + (i * increment)) % 360, s: hsl.s, l: hsl.l }));
}

@@ -330,0 +333,0 @@ return result;

@@ -55,2 +55,4 @@ import { TinyColor } from './index';

break;
default:
break;
}

@@ -73,2 +75,4 @@ return randomWithin([sMin, sMax], options.seed);

break;
default:
break;
}

@@ -86,4 +90,4 @@ return randomWithin([bMin, bMax], options.seed);

var m = (v2 - v1) / (s2 - s1);
var b = v1 - m * s1;
return m * S + b;
var b = v1 - (m * s1);
return (m * S) + b;
}

@@ -129,11 +133,9 @@ }

if (seed === undefined) {
return Math.floor(range[0] + Math.random() * (range[1] + 1 - range[0]));
return Math.floor(range[0] + (Math.random() * (range[1] + 1 - range[0])));
}
else {
var max = range[1] || 1;
var min = range[0] || 0;
seed = (seed * 9301 + 49297) % 233280;
var rnd = seed / 233280.0;
return Math.floor(min + rnd * (max - min));
}
var max = range[1] || 1;
var min = range[0] || 0;
seed = ((seed * 9301) + 49297) % 233280;
var rnd = seed / 233280.0;
return Math.floor(min + (rnd * (max - min)));
}

@@ -140,0 +142,0 @@ function defineColor(bound) {

@@ -19,4 +19,5 @@ import { TinyColor } from './index';

return readabilityLevel >= 7;
default:
return false;
}
return false;
}

@@ -27,5 +28,3 @@ export function mostReadable(baseColor, colorList, args) {

var bestScore = 0;
var includeFallbackColors = args.includeFallbackColors;
var level = args.level;
var size = args.size;
var includeFallbackColors = args.includeFallbackColors, level = args.level, size = args.size;
for (var _i = 0, colorList_1 = colorList; _i < colorList_1.length; _i++) {

@@ -42,6 +41,4 @@ var color = colorList_1[_i];

}
else {
args.includeFallbackColors = false;
return mostReadable(baseColor, ['#fff', '#000'], args);
}
args.includeFallbackColors = false;
return mostReadable(baseColor, ['#fff', '#000'], args);
}

@@ -14,3 +14,3 @@ export function bound01(n, max) {

if (max === 360) {
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
}

@@ -40,3 +40,3 @@ else {

if (n <= 1) {
return +n * 100 + '%';
return Number(n) * 100 + "%";
}

@@ -46,3 +46,3 @@ return n;

export function pad2(c) {
return c.length === 1 ? '0' + c : '' + c;
return c.length === 1 ? '0' + c : String(c);
}

@@ -37,3 +37,3 @@ "use strict";

}
if (color.hasOwnProperty('a')) {
if (Object.prototype.hasOwnProperty.call(color, 'a')) {
a = color.a;

@@ -150,4 +150,4 @@ }

function isValidCSSUnit(color) {
return !!matchers.CSS_UNIT.exec(String(color));
return Boolean(matchers.CSS_UNIT.exec(String(color)));
}
exports.isValidCSSUnit = isValidCSSUnit;

@@ -12,3 +12,3 @@ "use strict";

if (ratio.a !== undefined) {
newColor.a = +ratio.a;
newColor.a = Number(ratio.a);
}

@@ -15,0 +15,0 @@ return new index_1.TinyColor(newColor, opts);

@@ -23,2 +23,3 @@ import { HSL, HSLA, HSV, HSVA, RGB, RGBA } from './interfaces';

getLuminance(): number;
getAlpha(): number;
setAlpha(alpha?: string | number): TinyColor;

@@ -25,0 +26,0 @@ toHsv(): {

@@ -43,3 +43,3 @@ "use strict";

var rgb = this.toRgb();
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
return ((rgb.r * 299) + (rgb.g * 587) + (rgb.b * 114)) / 1000;
};

@@ -72,4 +72,7 @@ TinyColor.prototype.getLuminance = function () {

}
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
};
TinyColor.prototype.getAlpha = function () {
return this.a;
};
TinyColor.prototype.setAlpha = function (alpha) {

@@ -133,3 +136,3 @@ this.a = util_1.boundAlpha(alpha);

TinyColor.prototype.toPercentageRgb = function () {
var fmt = function (x) { return Math.round(util_1.bound01(x, 255) * 100) + '%'; };
var fmt = function (x) { return Math.round(util_1.bound01(x, 255) * 100) + "%"; };
return {

@@ -144,5 +147,5 @@ r: fmt(this.r),

var rnd = function (x) { return Math.round(util_1.bound01(x, 255) * 100); };
return this.a === 1
? "rgb(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%)"
: "rgba(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%, " + this.roundA + ")";
return this.a === 1 ?
"rgb(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%)" :
"rgba(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%, " + this.roundA + ")";
};

@@ -166,3 +169,3 @@ TinyColor.prototype.toName = function () {

TinyColor.prototype.toString = function (format) {
var formatSet = !!format;
var formatSet = Boolean(format);
format = format || this.format;

@@ -269,6 +272,6 @@ var formattedString = false;

var rgba = {
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a,
r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
a: ((rgb2.a - rgb1.a) * p) + rgb1.a,
};

@@ -329,3 +332,3 @@ return new TinyColor(rgba);

for (var i = 1; i < n; i++) {
result.push(new TinyColor({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
result.push(new TinyColor({ h: (h + (i * increment)) % 360, s: hsl.s, l: hsl.l }));
}

@@ -332,0 +335,0 @@ return result;

{
"name": "@ctrl/tinycolor",
"version": "2.2.1",
"version": "2.3.0",
"description": "Fast, small color manipulation and conversion for JavaScript",

@@ -28,4 +28,4 @@ "author": "Scott Cooper <scttcper@gmail.com>",

"start:demo": "serve demo/public",
"lint": "tslint -p tsconfig.json -t stylish 'src/**/*.ts' 'test/**/*.ts'",
"lint:fix": "tslint -p tsconfig.json -t stylish --fix 'src/**/*.ts' 'test/**/*.ts'",
"lint": "eslint src/**/*.ts test/**/*.ts",
"lint:fix": "eslint --fix src/**/*.ts test/**/*.ts",
"prebuild": "rimraf dist",

@@ -37,32 +37,32 @@ "build": "npm run build-es6; npm run build-cmjs; ts-node build",

"test": "jest",
"test:ci": "jest --ci --runInBand --reporters=default --reporters=jest-junit --coverage",
"test:watch": "jest --watch",
"test:prod": "npm run test -- --coverage --no-cache",
"commit": "git-cz",
"travis-deploy-once": "travis-deploy-once",
"semantic-release": "cd dist && semantic-release"
},
"devDependencies": {
"@types/fs-extra": "5.0.4",
"@types/jest": "23.3.2",
"@types/node": "10.11.0",
"commitizen": "2.10.1",
"cz-conventional-changelog": "2.1.0",
"fs-extra": "7.0.0",
"jest": "23.6.0",
"npm-run-all": "4.1.3",
"rimraf": "2.6.2",
"rollup": "0.66.2",
"@types/fs-extra": "5.0.5",
"@types/jest": "24.0.9",
"@types/node": "11.10.4",
"@typescript-eslint/eslint-plugin": "1.4.2",
"@typescript-eslint/parser": "1.4.2",
"eslint": "5.15.0",
"eslint-config-prettier": "4.1.0",
"eslint-config-xo-space": "0.21.0",
"eslint-config-xo-typescript": "0.8.0",
"eslint-plugin-import": "2.16.0",
"fs-extra": "7.0.1",
"jest": "24.1.0",
"jest-junit": "6.3.0",
"npm-run-all": "4.1.5",
"rimraf": "2.6.3",
"rollup": "1.4.0",
"rollup-plugin-sourcemaps": "0.4.2",
"rollup-plugin-terser": "3.0.0",
"rollup-plugin-typescript2": "0.17.0",
"rollup-plugin-uglify": "6.0.0",
"semantic-release": "15.9.16",
"travis-deploy-once": "5.0.8",
"ts-jest": "23.10.1",
"ts-node": "7.0.1",
"tslint": "5.11.0",
"tslint-config-prettier": "1.15.0",
"tslint-config-standard": "8.0.1",
"typedoc": "0.12.0",
"typescript": "3.0.3"
"rollup-plugin-terser": "4.0.4",
"rollup-plugin-typescript2": "0.19.3",
"rollup-plugin-uglify": "6.0.2",
"semantic-release": "15.13.3",
"ts-jest": "24.0.0",
"ts-node": "8.0.2",
"typedoc": "0.14.2",
"typescript": "3.3.3333"
},

@@ -72,24 +72,2 @@ "release": {

},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"jest": {
"testURL": "http://localhost",
"transform": {
".ts": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"js"
],
"collectCoverage": true
},
"engines": {

@@ -96,0 +74,0 @@ "node": ">=8.0.0"

@@ -58,2 +58,4 @@ "use strict";

break;
default:
break;
}

@@ -76,2 +78,4 @@ return randomWithin([sMin, sMax], options.seed);

break;
default:
break;
}

@@ -89,4 +93,4 @@ return randomWithin([bMin, bMax], options.seed);

var m = (v2 - v1) / (s2 - s1);
var b = v1 - m * s1;
return m * S + b;
var b = v1 - (m * s1);
return (m * S) + b;
}

@@ -132,11 +136,9 @@ }

if (seed === undefined) {
return Math.floor(range[0] + Math.random() * (range[1] + 1 - range[0]));
return Math.floor(range[0] + (Math.random() * (range[1] + 1 - range[0])));
}
else {
var max = range[1] || 1;
var min = range[0] || 0;
seed = (seed * 9301 + 49297) % 233280;
var rnd = seed / 233280.0;
return Math.floor(min + rnd * (max - min));
}
var max = range[1] || 1;
var min = range[0] || 0;
seed = ((seed * 9301) + 49297) % 233280;
var rnd = seed / 233280.0;
return Math.floor(min + (rnd * (max - min)));
}

@@ -143,0 +145,0 @@ function defineColor(bound) {

@@ -22,4 +22,5 @@ "use strict";

return readabilityLevel >= 7;
default:
return false;
}
return false;
}

@@ -31,5 +32,3 @@ exports.isReadable = isReadable;

var bestScore = 0;
var includeFallbackColors = args.includeFallbackColors;
var level = args.level;
var size = args.size;
var includeFallbackColors = args.includeFallbackColors, level = args.level, size = args.size;
for (var _i = 0, colorList_1 = colorList; _i < colorList_1.length; _i++) {

@@ -46,7 +45,5 @@ var color = colorList_1[_i];

}
else {
args.includeFallbackColors = false;
return mostReadable(baseColor, ['#fff', '#000'], args);
}
args.includeFallbackColors = false;
return mostReadable(baseColor, ['#fff', '#000'], args);
}
exports.mostReadable = mostReadable;

@@ -16,3 +16,3 @@ "use strict";

if (max === 360) {
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
}

@@ -47,3 +47,3 @@ else {

if (n <= 1) {
return +n * 100 + '%';
return Number(n) * 100 + "%";
}

@@ -54,4 +54,4 @@ return n;

function pad2(c) {
return c.length === 1 ? '0' + c : '' + c;
return c.length === 1 ? '0' + c : String(c);
}
exports.pad2 = pad2;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc