Socket
Socket
Sign inDemoInstall

onecolor

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onecolor - npm Package Compare versions

Comparing version 2.2.7 to 2.2.8

text.html

17

lib/color.js

@@ -215,12 +215,11 @@ /*global define*/

module.exports = ONECOLOR;
} else if (typeof define === 'function' && !undef(define.amd)) {
define([], function () {
return ONECOLOR;
});
} else if (!undef(jQuery) && undef(jQuery.color)) {
jQuery.color = ONECOLOR;
} else {
// Browser
if (typeof define === 'function' && !undef(define.amd)) {
define([], function () {
return ONECOLOR;
});
} else {
one = window.one || {};
one.color = ONECOLOR;
}
one = window.one || {};
one.color = ONECOLOR;
}

@@ -215,12 +215,11 @@ /*global define*/

module.exports = ONECOLOR;
} else if (typeof define === 'function' && !undef(define.amd)) {
define([], function () {
return ONECOLOR;
});
} else if (!undef(jQuery) && undef(jQuery.color)) {
jQuery.color = ONECOLOR;
} else {
// Browser
if (typeof define === 'function' && !undef(define.amd)) {
define([], function () {
return ONECOLOR;
});
} else {
one = window.one || {};
one.color = ONECOLOR;
}
one = window.one || {};
one.color = ONECOLOR;
}

@@ -227,0 +226,0 @@

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

(function(a,b,c,d,e,f,g){function n(d){if(Object.prototype.toString.apply(d)==="[object Array]")return d.length===4?new n.RGB(d[0]/255,d[1]/255,d[2]/255,d[3]/255):new n[d[0]](d.slice(1,d.length));if(typeof d=="string"){var e=d.toLowerCase();i[e]&&(d="#"+i[e]);var f=d.match(m);if(f){var g=f[1].toUpperCase(),h=j(f[8])?f[8]:b(f[8]),k=g[0]==="H",l=f[3]?100:k?360:255,o=f[5]||k?100:255,p=f[7]||k?100:255;if(j(n[g]))throw new Error("one.color."+g+" is not installed.");return new n[g](b(f[2])/l,b(f[4])/o,b(f[6])/p,h)}d.length<6&&(d=d.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var q=d.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(q)return new n.RGB(c(q[1],16)/255,c(q[2],16)/255,c(q[3],16)/255)}else{if(typeof d=="object"&&d.isColor)return d;if(!a(d))return new n.RGB((d&255)/255,((d&65280)>>8)/255,((d&16711680)>>16)/255)}return!1}function o(a,b,c){function k(a,b){var c={};c[b.toLowerCase()]=new d("return this.rgb()."+b.toLowerCase()+"();"),n[b].propertyNames.forEach(function(a,e){c[a]=new d("value","isDelta","return this."+b.toLowerCase()+"()."+a+"(value, isDelta);")});for(var e in c)c.hasOwnProperty(e)&&n[a].prototype[e]===undefined&&(n[a].prototype[e]=c[e])}n[a]=new d(b.join(","),"if (Object.prototype.toString.apply("+b[0]+") === '[object Array]') {"+b.map(function(a,c){return a+"="+b[0]+"["+c+"];"}).reverse().join("")+"}"+"if ("+b.filter(function(a){return a!=="alpha"}).map(function(a){return"isNaN("+a+")"}).join("||")+"){"+'throw new Error("['+a+']: Invalid color: ("+'+b.join('+","+')+'+")");}'+b.map(function(a){return a==="hue"?"this._hue=hue<0?hue-Math.floor(hue):hue%1":a==="alpha"?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+a+"="+a+"<0?0:("+a+">1?1:"+a+")"}).join(";")+";"),n[a].propertyNames=b;var f=n[a].prototype;["valueOf","hex","css","cssa"].forEach(function(b){f[b]=f[b]||(a==="RGB"?f.hex:new d("return this.rgb()."+b+"();"))}),f.isColor=!0,f.equals=function(c,d){j(d)&&(d=1e-10),c=c[a.toLowerCase()]();for(var f=0;f<b.length;f+=1)if(e.abs(this["_"+b[f]]-c["_"+b[f]])>d)return!1;return!0},f.toJSON=new d("return ['"+a+"', "+b.map(function(a){return"this._"+a},this).join(", ")+"];");for(var g in c)if(c.hasOwnProperty(g)){var i=g.match(/^from(.*)$/);i?n[i[1].toUpperCase()].prototype[a.toLowerCase()]=c[g]:f[g]=c[g]}f[a.toLowerCase()]=function(){return this},f.toString=new d('return "[one.color.'+a+':"+'+b.map(function(a,c){return'" '+b[c]+'="+this._'+a}).join("+")+'+"]";'),b.forEach(function(a,c){f[a]=new d("value","isDelta","if (typeof value === 'undefined') {return this._"+a+";"+"}"+"if (isDelta) {"+"return new this.constructor("+b.map(function(b,c){return"this._"+b+(a===b?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+b.map(function(b,c){return a===b?"value":"this._"+b}).join(", ")+");")}),h.forEach(function(b){k(a,b),k(b,a)}),h.push(a)}function p(){var a=this.rgb(),b=a._red*.3+a._green*.59+a._blue*.11;return new n.RGB(b,b,b,this._alpha)}var h=[],i={},j=function(a){return typeof a=="undefined"},k=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,l=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,m=new RegExp("^(rgb|hsl|hsv)a?\\("+k.source+","+k.source+","+k.source+"(?:,"+l.source+")?"+"\\)$","i");n.installMethod=function(a,b){h.forEach(function(c){n[c].prototype[a]=b})},o("RGB",["red","green","blue","alpha"],{hex:function(){var a=(f(255*this._red)*65536+f(255*this._green)*256+f(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-a.length)+a},css:function(){return"rgb("+f(255*this._red)+","+f(255*this._green)+","+f(255*this._blue)+")"},cssa:function(){return"rgba("+f(255*this._red)+","+f(255*this._green)+","+f(255*this._blue)+","+this._alpha+")"}}),typeof module!="undefined"?module.exports=n:typeof define=="function"&&!j(define.amd)?define([],function(){return n}):(one=window.one||{},one.color=n),i={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgrey:"a9a9a9",darkgreen:"006400",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:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",grey:"808080",green:"008000",greenyellow:"adff2f",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",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",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:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"f00",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:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},o("HSV",["hue","saturation","value","alpha"],{rgb:function(){var a=this._hue,b=this._saturation,c=this._value,d=g(5,e.floor(a*6)),f=a*6-d,h=c*(1-b),i=c*(1-f*b),j=c*(1-(1-f)*b),k,l,m;switch(d){case 0:k=c,l=j,m=h;break;case 1:k=i,l=c,m=h;break;case 2:k=h,l=c,m=j;break;case 3:k=h,l=i,m=c;break;case 4:k=j,l=h,m=c;break;case 5:k=c,l=h,m=i}return new n.RGB(k,l,m,this._alpha)},hsl:function(){var a=(2-this._saturation)*this._value,b=this._saturation*this._value,c=a<=1?a:2-a,d;return c<1e-9?d=0:d=b/c,new n.HSL(this._hue,d,a/2,this._alpha)},fromRgb:function(){var a=this._red,b=this._green,c=this._blue,d=e.max(a,b,c),f=g(a,b,c),h=d-f,i,j=d===0?0:h/d,k=d;if(h===0)i=0;else switch(d){case a:i=(b-c)/h/6+(b<c?1:0);break;case b:i=(c-a)/h/6+1/3;break;case c:i=(a-b)/h/6+2/3}return new n.HSV(i,j,k,this._alpha)}}),o("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var a=this._lightness*2,b=this._saturation*(a<=1?a:2-a),c;return a+b<1e-9?c=0:c=2*b/(a+b),new n.HSV(this._hue,c,(a+b)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}}),o("CMYK",["cyan","magenta","yellow","black","alpha"],{rgb:function(){return new n.RGB(1-this._cyan*(1-this._black)-this._black,1-this._magenta*(1-this._black)-this._black,1-this._yellow*(1-this._black)-this._black,this._alpha)},fromRgb:function(){var a=this._red,b=this._green,c=this._blue,d=1-a,e=1-b,f=1-c,h=1;return a||b||c?(h=g(d,g(e,f)),d=(d-h)/(1-h),e=(e-h)/(1-h),f=(f-h)/(1-h)):h=1,new n.CMYK(d,e,f,h,this._alpha)}}),n.installMethod("clearer",function(b){return this.alpha(a(b)?-0.1:-b,!0)}),n.installMethod("darken",function(b){return this.lightness(a(b)?-0.1:-b,!0)}),n.installMethod("desaturate",function(b){return this.saturation(a(b)?-0.1:-b,!0)}),n.installMethod("greyscale",p),n.installMethod("grayscale",p),n.installMethod("lighten",function(b){return this.lightness(a(b)?.1:b,!0)}),n.installMethod("mix",function(b,c){b=n(b).rgb(),c=1-(a(c)?.5:c);var d=c*2-1,e=this._alpha-b._alpha,f=((d*e===-1?d:(d+e)/(1+d*e))+1)/2,g=1-f,h=this.rgb();return new n.RGB(h._red*f+b._red*g,h._green*f+b._green*g,h._blue*f+b._blue*g,h._alpha*c+b._alpha*(1-c))}),n.installMethod("negate",function(){var a=this.rgb();return new n.RGB(1-a._red,1-a._green,1-a._blue,this._alpha)}),n.installMethod("opaquer",function(b){return this.alpha(a(b)?.1:b,!0)}),n.installMethod("rotate",function(a){return this.hue((a||0)/360,!0)}),n.installMethod("saturate",function(b){return this.saturation(a(b)?.1:b,!0)}),n.installMethod("toAlpha",function(a){var b=this.rgb(),c=n(a).rgb(),d=1e-10,e=new n.RGB(0,0,0,b._alpha),f=["_red","_green","_blue"];return f.forEach(function(a){b[a]<d?e[a]=b[a]:b[a]>c[a]?e[a]=(b[a]-c[a])/(1-c[a]):b[a]>c[a]?e[a]=(c[a]-b[a])/c[a]:e[a]=0}),e._red>e._green?e._red>e._blue?b._alpha=e._red:b._alpha=e._blue:e._green>e._blue?b._alpha=e._green:b._alpha=e._blue,b._alpha<d?b:(f.forEach(function(a){b[a]=(b[a]-c[a])/b._alpha+c[a]}),b._alpha*=e._alpha,b)})})(isNaN,parseFloat,parseInt,Function,Math,Math.round,Math.min)
(function(a,b,c,d,e,f,g){function n(d){if(Object.prototype.toString.apply(d)==="[object Array]")return d.length===4?new n.RGB(d[0]/255,d[1]/255,d[2]/255,d[3]/255):new n[d[0]](d.slice(1,d.length));if(typeof d=="string"){var e=d.toLowerCase();i[e]&&(d="#"+i[e]);var f=d.match(m);if(f){var g=f[1].toUpperCase(),h=j(f[8])?f[8]:b(f[8]),k=g[0]==="H",l=f[3]?100:k?360:255,o=f[5]||k?100:255,p=f[7]||k?100:255;if(j(n[g]))throw new Error("one.color."+g+" is not installed.");return new n[g](b(f[2])/l,b(f[4])/o,b(f[6])/p,h)}d.length<6&&(d=d.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var q=d.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(q)return new n.RGB(c(q[1],16)/255,c(q[2],16)/255,c(q[3],16)/255)}else{if(typeof d=="object"&&d.isColor)return d;if(!a(d))return new n.RGB((d&255)/255,((d&65280)>>8)/255,((d&16711680)>>16)/255)}return!1}function o(a,b,c){function k(a,b){var c={};c[b.toLowerCase()]=new d("return this.rgb()."+b.toLowerCase()+"();"),n[b].propertyNames.forEach(function(a,e){c[a]=new d("value","isDelta","return this."+b.toLowerCase()+"()."+a+"(value, isDelta);")});for(var e in c)c.hasOwnProperty(e)&&n[a].prototype[e]===undefined&&(n[a].prototype[e]=c[e])}n[a]=new d(b.join(","),"if (Object.prototype.toString.apply("+b[0]+") === '[object Array]') {"+b.map(function(a,c){return a+"="+b[0]+"["+c+"];"}).reverse().join("")+"}"+"if ("+b.filter(function(a){return a!=="alpha"}).map(function(a){return"isNaN("+a+")"}).join("||")+"){"+'throw new Error("['+a+']: Invalid color: ("+'+b.join('+","+')+'+")");}'+b.map(function(a){return a==="hue"?"this._hue=hue<0?hue-Math.floor(hue):hue%1":a==="alpha"?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+a+"="+a+"<0?0:("+a+">1?1:"+a+")"}).join(";")+";"),n[a].propertyNames=b;var f=n[a].prototype;["valueOf","hex","css","cssa"].forEach(function(b){f[b]=f[b]||(a==="RGB"?f.hex:new d("return this.rgb()."+b+"();"))}),f.isColor=!0,f.equals=function(c,d){j(d)&&(d=1e-10),c=c[a.toLowerCase()]();for(var f=0;f<b.length;f+=1)if(e.abs(this["_"+b[f]]-c["_"+b[f]])>d)return!1;return!0},f.toJSON=new d("return ['"+a+"', "+b.map(function(a){return"this._"+a},this).join(", ")+"];");for(var g in c)if(c.hasOwnProperty(g)){var i=g.match(/^from(.*)$/);i?n[i[1].toUpperCase()].prototype[a.toLowerCase()]=c[g]:f[g]=c[g]}f[a.toLowerCase()]=function(){return this},f.toString=new d('return "[one.color.'+a+':"+'+b.map(function(a,c){return'" '+b[c]+'="+this._'+a}).join("+")+'+"]";'),b.forEach(function(a,c){f[a]=new d("value","isDelta","if (typeof value === 'undefined') {return this._"+a+";"+"}"+"if (isDelta) {"+"return new this.constructor("+b.map(function(b,c){return"this._"+b+(a===b?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+b.map(function(b,c){return a===b?"value":"this._"+b}).join(", ")+");")}),h.forEach(function(b){k(a,b),k(b,a)}),h.push(a)}function p(){var a=this.rgb(),b=a._red*.3+a._green*.59+a._blue*.11;return new n.RGB(b,b,b,this._alpha)}var h=[],i={},j=function(a){return typeof a=="undefined"},k=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,l=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,m=new RegExp("^(rgb|hsl|hsv)a?\\("+k.source+","+k.source+","+k.source+"(?:,"+l.source+")?"+"\\)$","i");n.installMethod=function(a,b){h.forEach(function(c){n[c].prototype[a]=b})},o("RGB",["red","green","blue","alpha"],{hex:function(){var a=(f(255*this._red)*65536+f(255*this._green)*256+f(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-a.length)+a},css:function(){return"rgb("+f(255*this._red)+","+f(255*this._green)+","+f(255*this._blue)+")"},cssa:function(){return"rgba("+f(255*this._red)+","+f(255*this._green)+","+f(255*this._blue)+","+this._alpha+")"}}),typeof module!="undefined"?module.exports=n:typeof define=="function"&&!j(define.amd)?define([],function(){return n}):!j(jQuery)&&j(jQuery.color)?jQuery.color=n:(one=window.one||{},one.color=n),i={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgrey:"a9a9a9",darkgreen:"006400",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:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",grey:"808080",green:"008000",greenyellow:"adff2f",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",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",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:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"f00",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:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},o("HSV",["hue","saturation","value","alpha"],{rgb:function(){var a=this._hue,b=this._saturation,c=this._value,d=g(5,e.floor(a*6)),f=a*6-d,h=c*(1-b),i=c*(1-f*b),j=c*(1-(1-f)*b),k,l,m;switch(d){case 0:k=c,l=j,m=h;break;case 1:k=i,l=c,m=h;break;case 2:k=h,l=c,m=j;break;case 3:k=h,l=i,m=c;break;case 4:k=j,l=h,m=c;break;case 5:k=c,l=h,m=i}return new n.RGB(k,l,m,this._alpha)},hsl:function(){var a=(2-this._saturation)*this._value,b=this._saturation*this._value,c=a<=1?a:2-a,d;return c<1e-9?d=0:d=b/c,new n.HSL(this._hue,d,a/2,this._alpha)},fromRgb:function(){var a=this._red,b=this._green,c=this._blue,d=e.max(a,b,c),f=g(a,b,c),h=d-f,i,j=d===0?0:h/d,k=d;if(h===0)i=0;else switch(d){case a:i=(b-c)/h/6+(b<c?1:0);break;case b:i=(c-a)/h/6+1/3;break;case c:i=(a-b)/h/6+2/3}return new n.HSV(i,j,k,this._alpha)}}),o("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var a=this._lightness*2,b=this._saturation*(a<=1?a:2-a),c;return a+b<1e-9?c=0:c=2*b/(a+b),new n.HSV(this._hue,c,(a+b)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}}),o("CMYK",["cyan","magenta","yellow","black","alpha"],{rgb:function(){return new n.RGB(1-this._cyan*(1-this._black)-this._black,1-this._magenta*(1-this._black)-this._black,1-this._yellow*(1-this._black)-this._black,this._alpha)},fromRgb:function(){var a=this._red,b=this._green,c=this._blue,d=1-a,e=1-b,f=1-c,h=1;return a||b||c?(h=g(d,g(e,f)),d=(d-h)/(1-h),e=(e-h)/(1-h),f=(f-h)/(1-h)):h=1,new n.CMYK(d,e,f,h,this._alpha)}}),n.installMethod("clearer",function(b){return this.alpha(a(b)?-0.1:-b,!0)}),n.installMethod("darken",function(b){return this.lightness(a(b)?-0.1:-b,!0)}),n.installMethod("desaturate",function(b){return this.saturation(a(b)?-0.1:-b,!0)}),n.installMethod("greyscale",p),n.installMethod("grayscale",p),n.installMethod("lighten",function(b){return this.lightness(a(b)?.1:b,!0)}),n.installMethod("mix",function(b,c){b=n(b).rgb(),c=1-(a(c)?.5:c);var d=c*2-1,e=this._alpha-b._alpha,f=((d*e===-1?d:(d+e)/(1+d*e))+1)/2,g=1-f,h=this.rgb();return new n.RGB(h._red*f+b._red*g,h._green*f+b._green*g,h._blue*f+b._blue*g,h._alpha*c+b._alpha*(1-c))}),n.installMethod("negate",function(){var a=this.rgb();return new n.RGB(1-a._red,1-a._green,1-a._blue,this._alpha)}),n.installMethod("opaquer",function(b){return this.alpha(a(b)?.1:b,!0)}),n.installMethod("rotate",function(a){return this.hue((a||0)/360,!0)}),n.installMethod("saturate",function(b){return this.saturation(a(b)?.1:b,!0)}),n.installMethod("toAlpha",function(a){var b=this.rgb(),c=n(a).rgb(),d=1e-10,e=new n.RGB(0,0,0,b._alpha),f=["_red","_green","_blue"];return f.forEach(function(a){b[a]<d?e[a]=b[a]:b[a]>c[a]?e[a]=(b[a]-c[a])/(1-c[a]):b[a]>c[a]?e[a]=(c[a]-b[a])/c[a]:e[a]=0}),e._red>e._green?e._red>e._blue?b._alpha=e._red:b._alpha=e._blue:e._green>e._blue?b._alpha=e._green:b._alpha=e._blue,b._alpha<d?b:(f.forEach(function(a){b[a]=(b[a]-c[a])/b._alpha+c[a]}),b._alpha*=e._alpha,b)})})(isNaN,parseFloat,parseInt,Function,Math,Math.round,Math.min)

@@ -215,12 +215,11 @@ /*global define*/

module.exports = ONECOLOR;
} else if (typeof define === 'function' && !undef(define.amd)) {
define([], function () {
return ONECOLOR;
});
} else if (!undef(jQuery) && undef(jQuery.color)) {
jQuery.color = ONECOLOR;
} else {
// Browser
if (typeof define === 'function' && !undef(define.amd)) {
define([], function () {
return ONECOLOR;
});
} else {
one = window.one || {};
one.color = ONECOLOR;
}
one = window.one || {};
one.color = ONECOLOR;
}

@@ -227,0 +226,0 @@

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

(function(a,b,c,d,e,f){function m(c){if(Object.prototype.toString.apply(c)==="[object Array]")return c.length===4?new m.RGB(c[0]/255,c[1]/255,c[2]/255,c[3]/255):new m[c[0]](c.slice(1,c.length));if(typeof c=="string"){var d=c.toLowerCase();h[d]&&(c="#"+h[d]);var e=c.match(l);if(e){var f=e[1].toUpperCase(),g=i(e[8])?e[8]:a(e[8]),j=f[0]==="H",k=e[3]?100:j?360:255,n=e[5]||j?100:255,o=e[7]||j?100:255;if(i(m[f]))throw new Error("one.color."+f+" is not installed.");return new m[f](a(e[2])/k,a(e[4])/n,a(e[6])/o,g)}c.length<6&&(c=c.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var p=c.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(p)return new m.RGB(b(p[1],16)/255,b(p[2],16)/255,b(p[3],16)/255)}else{if(typeof c=="object"&&c.isColor)return c;if(!isNaN(c))return new m.RGB((c&255)/255,((c&65280)>>8)/255,((c&16711680)>>16)/255)}return!1}function n(a,b,e){function k(a,b){var d={};d[b.toLowerCase()]=new c("return this.rgb()."+b.toLowerCase()+"();"),m[b].propertyNames.forEach(function(a,e){d[a]=new c("value","isDelta","return this."+b.toLowerCase()+"()."+a+"(value, isDelta);")});for(var e in d)d.hasOwnProperty(e)&&m[a].prototype[e]===undefined&&(m[a].prototype[e]=d[e])}m[a]=new c(b.join(","),"if (Object.prototype.toString.apply("+b[0]+") === '[object Array]') {"+b.map(function(a,c){return a+"="+b[0]+"["+c+"];"}).reverse().join("")+"}"+"if ("+b.filter(function(a){return a!=="alpha"}).map(function(a){return"isNaN("+a+")"}).join("||")+"){"+'throw new Error("['+a+']: Invalid color: ("+'+b.join('+","+')+'+")");}'+b.map(function(a){return a==="hue"?"this._hue=hue<0?hue-Math.floor(hue):hue%1":a==="alpha"?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+a+"="+a+"<0?0:("+a+">1?1:"+a+")"}).join(";")+";"),m[a].propertyNames=b;var f=m[a].prototype;["valueOf","hex","css","cssa"].forEach(function(b){f[b]=f[b]||(a==="RGB"?f.hex:new c("return this.rgb()."+b+"();"))}),f.isColor=!0,f.equals=function(c,e){i(e)&&(e=1e-10),c=c[a.toLowerCase()]();for(var f=0;f<b.length;f+=1)if(d.abs(this["_"+b[f]]-c["_"+b[f]])>e)return!1;return!0},f.toJSON=new c("return ['"+a+"', "+b.map(function(a){return"this._"+a},this).join(", ")+"];");for(var h in e)if(e.hasOwnProperty(h)){var j=h.match(/^from(.*)$/);j?m[j[1].toUpperCase()].prototype[a.toLowerCase()]=e[h]:f[h]=e[h]}f[a.toLowerCase()]=function(){return this},f.toString=new c('return "[one.color.'+a+':"+'+b.map(function(a,c){return'" '+b[c]+'="+this._'+a}).join("+")+'+"]";'),b.forEach(function(a,d){f[a]=new c("value","isDelta","if (typeof value === 'undefined') {return this._"+a+";"+"}"+"if (isDelta) {"+"return new this.constructor("+b.map(function(b,c){return"this._"+b+(a===b?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+b.map(function(b,c){return a===b?"value":"this._"+b}).join(", ")+");")}),g.forEach(function(b){k(a,b),k(b,a)}),g.push(a)}var g=[],h={},i=function(a){return typeof a=="undefined"},j=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,k=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,l=new RegExp("^(rgb|hsl|hsv)a?\\("+j.source+","+j.source+","+j.source+"(?:,"+k.source+")?"+"\\)$","i");m.installMethod=function(a,b){g.forEach(function(c){m[c].prototype[a]=b})},n("RGB",["red","green","blue","alpha"],{hex:function(){var a=(e(255*this._red)*65536+e(255*this._green)*256+e(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-a.length)+a},css:function(){return"rgb("+e(255*this._red)+","+e(255*this._green)+","+e(255*this._blue)+")"},cssa:function(){return"rgba("+e(255*this._red)+","+e(255*this._green)+","+e(255*this._blue)+","+this._alpha+")"}}),typeof module!="undefined"?module.exports=m:typeof define=="function"&&!i(define.amd)?define([],function(){return m}):(one=window.one||{},one.color=m),n("HSV",["hue","saturation","value","alpha"],{rgb:function(){var a=this._hue,b=this._saturation,c=this._value,e=f(5,d.floor(a*6)),g=a*6-e,h=c*(1-b),i=c*(1-g*b),j=c*(1-(1-g)*b),k,l,n;switch(e){case 0:k=c,l=j,n=h;break;case 1:k=i,l=c,n=h;break;case 2:k=h,l=c,n=j;break;case 3:k=h,l=i,n=c;break;case 4:k=j,l=h,n=c;break;case 5:k=c,l=h,n=i}return new m.RGB(k,l,n,this._alpha)},hsl:function(){var a=(2-this._saturation)*this._value,b=this._saturation*this._value,c=a<=1?a:2-a,d;return c<1e-9?d=0:d=b/c,new m.HSL(this._hue,d,a/2,this._alpha)},fromRgb:function(){var a=this._red,b=this._green,c=this._blue,e=d.max(a,b,c),g=f(a,b,c),h=e-g,i,j=e===0?0:h/e,k=e;if(h===0)i=0;else switch(e){case a:i=(b-c)/h/6+(b<c?1:0);break;case b:i=(c-a)/h/6+1/3;break;case c:i=(a-b)/h/6+2/3}return new m.HSV(i,j,k,this._alpha)}}),n("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var a=this._lightness*2,b=this._saturation*(a<=1?a:2-a),c;return a+b<1e-9?c=0:c=2*b/(a+b),new m.HSV(this._hue,c,(a+b)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}})})(parseFloat,parseInt,Function,Math,Math.round,Math.min)
(function(a,b,c,d,e,f){function m(c){if(Object.prototype.toString.apply(c)==="[object Array]")return c.length===4?new m.RGB(c[0]/255,c[1]/255,c[2]/255,c[3]/255):new m[c[0]](c.slice(1,c.length));if(typeof c=="string"){var d=c.toLowerCase();h[d]&&(c="#"+h[d]);var e=c.match(l);if(e){var f=e[1].toUpperCase(),g=i(e[8])?e[8]:a(e[8]),j=f[0]==="H",k=e[3]?100:j?360:255,n=e[5]||j?100:255,o=e[7]||j?100:255;if(i(m[f]))throw new Error("one.color."+f+" is not installed.");return new m[f](a(e[2])/k,a(e[4])/n,a(e[6])/o,g)}c.length<6&&(c=c.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var p=c.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(p)return new m.RGB(b(p[1],16)/255,b(p[2],16)/255,b(p[3],16)/255)}else{if(typeof c=="object"&&c.isColor)return c;if(!isNaN(c))return new m.RGB((c&255)/255,((c&65280)>>8)/255,((c&16711680)>>16)/255)}return!1}function n(a,b,e){function k(a,b){var d={};d[b.toLowerCase()]=new c("return this.rgb()."+b.toLowerCase()+"();"),m[b].propertyNames.forEach(function(a,e){d[a]=new c("value","isDelta","return this."+b.toLowerCase()+"()."+a+"(value, isDelta);")});for(var e in d)d.hasOwnProperty(e)&&m[a].prototype[e]===undefined&&(m[a].prototype[e]=d[e])}m[a]=new c(b.join(","),"if (Object.prototype.toString.apply("+b[0]+") === '[object Array]') {"+b.map(function(a,c){return a+"="+b[0]+"["+c+"];"}).reverse().join("")+"}"+"if ("+b.filter(function(a){return a!=="alpha"}).map(function(a){return"isNaN("+a+")"}).join("||")+"){"+'throw new Error("['+a+']: Invalid color: ("+'+b.join('+","+')+'+")");}'+b.map(function(a){return a==="hue"?"this._hue=hue<0?hue-Math.floor(hue):hue%1":a==="alpha"?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+a+"="+a+"<0?0:("+a+">1?1:"+a+")"}).join(";")+";"),m[a].propertyNames=b;var f=m[a].prototype;["valueOf","hex","css","cssa"].forEach(function(b){f[b]=f[b]||(a==="RGB"?f.hex:new c("return this.rgb()."+b+"();"))}),f.isColor=!0,f.equals=function(c,e){i(e)&&(e=1e-10),c=c[a.toLowerCase()]();for(var f=0;f<b.length;f+=1)if(d.abs(this["_"+b[f]]-c["_"+b[f]])>e)return!1;return!0},f.toJSON=new c("return ['"+a+"', "+b.map(function(a){return"this._"+a},this).join(", ")+"];");for(var h in e)if(e.hasOwnProperty(h)){var j=h.match(/^from(.*)$/);j?m[j[1].toUpperCase()].prototype[a.toLowerCase()]=e[h]:f[h]=e[h]}f[a.toLowerCase()]=function(){return this},f.toString=new c('return "[one.color.'+a+':"+'+b.map(function(a,c){return'" '+b[c]+'="+this._'+a}).join("+")+'+"]";'),b.forEach(function(a,d){f[a]=new c("value","isDelta","if (typeof value === 'undefined') {return this._"+a+";"+"}"+"if (isDelta) {"+"return new this.constructor("+b.map(function(b,c){return"this._"+b+(a===b?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+b.map(function(b,c){return a===b?"value":"this._"+b}).join(", ")+");")}),g.forEach(function(b){k(a,b),k(b,a)}),g.push(a)}var g=[],h={},i=function(a){return typeof a=="undefined"},j=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,k=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,l=new RegExp("^(rgb|hsl|hsv)a?\\("+j.source+","+j.source+","+j.source+"(?:,"+k.source+")?"+"\\)$","i");m.installMethod=function(a,b){g.forEach(function(c){m[c].prototype[a]=b})},n("RGB",["red","green","blue","alpha"],{hex:function(){var a=(e(255*this._red)*65536+e(255*this._green)*256+e(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-a.length)+a},css:function(){return"rgb("+e(255*this._red)+","+e(255*this._green)+","+e(255*this._blue)+")"},cssa:function(){return"rgba("+e(255*this._red)+","+e(255*this._green)+","+e(255*this._blue)+","+this._alpha+")"}}),typeof module!="undefined"?module.exports=m:typeof define=="function"&&!i(define.amd)?define([],function(){return m}):!i(jQuery)&&i(jQuery.color)?jQuery.color=m:(one=window.one||{},one.color=m),n("HSV",["hue","saturation","value","alpha"],{rgb:function(){var a=this._hue,b=this._saturation,c=this._value,e=f(5,d.floor(a*6)),g=a*6-e,h=c*(1-b),i=c*(1-g*b),j=c*(1-(1-g)*b),k,l,n;switch(e){case 0:k=c,l=j,n=h;break;case 1:k=i,l=c,n=h;break;case 2:k=h,l=c,n=j;break;case 3:k=h,l=i,n=c;break;case 4:k=j,l=h,n=c;break;case 5:k=c,l=h,n=i}return new m.RGB(k,l,n,this._alpha)},hsl:function(){var a=(2-this._saturation)*this._value,b=this._saturation*this._value,c=a<=1?a:2-a,d;return c<1e-9?d=0:d=b/c,new m.HSL(this._hue,d,a/2,this._alpha)},fromRgb:function(){var a=this._red,b=this._green,c=this._blue,e=d.max(a,b,c),g=f(a,b,c),h=e-g,i,j=e===0?0:h/e,k=e;if(h===0)i=0;else switch(e){case a:i=(b-c)/h/6+(b<c?1:0);break;case b:i=(c-a)/h/6+1/3;break;case c:i=(a-b)/h/6+2/3}return new m.HSV(i,j,k,this._alpha)}}),n("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var a=this._lightness*2,b=this._saturation*(a<=1?a:2-a),c;return a+b<1e-9?c=0:c=2*b/(a+b),new m.HSV(this._hue,c,(a+b)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}})})(parseFloat,parseInt,Function,Math,Math.round,Math.min)

@@ -5,3 +5,3 @@ {

"repository": "git@github.com:One-com/one-color.git",
"version": "2.2.7",
"version": "2.2.8",
"keywords": ["ender", "color", "colour", "requirejs", "amd"],

@@ -8,0 +8,0 @@ "maintainers": [

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