Comparing version 2.4.1 to 2.4.2
@@ -216,10 +216,9 @@ /*jshint evil:true, onevar:false*/ | ||
}); | ||
if (typeof module !== 'undefined') { | ||
if (typeof define === 'function' && !undef(define.amd)) { | ||
define(function () { | ||
return ONECOLOR; | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node module export | ||
module.exports = ONECOLOR; | ||
} else if (typeof define === 'function' && !undef(define.amd)) { | ||
define([], function () { | ||
return ONECOLOR; | ||
}); | ||
} else { | ||
@@ -226,0 +225,0 @@ one = window.one || {}; |
@@ -1,1 +0,1 @@ | ||
(function(e,t,n,r,i,s,o,u){function d(e){if(Object.prototype.toString.apply(e)==="[object Array]"){if(typeof e[0]=="string"&&typeof d[e[0]]=="function")return new d[e[0]](e.slice(1,e.length));if(e.length===4)return new d.RGB(e[0]/255,e[1]/255,e[2]/255,e[3]/255)}else if(typeof e=="string"){var r=e.toLowerCase();f[r]&&(e="#"+f[r]),r==="transparent"&&(e="rgba(0,0,0,0)");var i=e.match(p);if(i){var s=i[1].toUpperCase(),o=l(i[8])?i[8]:t(i[8]),u=s[0]==="H",a=i[3]?100:u?360:255,c=i[5]||u?100:255,h=i[7]||u?100:255;if(l(d[s]))throw new Error("one.color."+s+" is not installed.");return new d[s](t(i[2])/a,t(i[4])/c,t(i[6])/h,o)}e.length<6&&(e=e.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var v=e.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(v)return new d.RGB(n(v[1],16)/255,n(v[2],16)/255,n(v[3],16)/255)}else if(typeof e=="object"&&e.isColor)return e;return!1}function v(t,n,i){function f(e,t){var n={};n[t.toLowerCase()]=new r("return this.rgb()."+t.toLowerCase()+"();"),d[t].propertyNames.forEach(function(e,i){n[e]=n[e==="black"?"k":e[0]]=new r("value","isDelta","return this."+t.toLowerCase()+"()."+e+"(value, isDelta);")});for(var i in n)n.hasOwnProperty(i)&&d[e].prototype[i]===undefined&&(d[e].prototype[i]=n[i])}d[t]=new r(n.join(","),"if (Object.prototype.toString.apply("+n[0]+") === '[object Array]') {"+n.map(function(e,t){return e+"="+n[0]+"["+t+"];"}).reverse().join("")+"}"+"if ("+n.filter(function(e){return e!=="alpha"}).map(function(e){return"isNaN("+e+")"}).join("||")+"){"+'throw new Error("['+t+']: Invalid color: ("+'+n.join('+","+')+'+")");}'+n.map(function(e){return e==="hue"?"this._hue=hue<0?hue-Math.floor(hue):hue%1":e==="alpha"?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+e+"="+e+"<0?0:("+e+">1?1:"+e+")"}).join(";")+";"),d[t].propertyNames=n;var s=d[t].prototype;["valueOf","hex","hexa","css","cssa"].forEach(function(e){s[e]=s[e]||(t==="RGB"?s.hex:new r("return this.rgb()."+e+"();"))}),s.isColor=!0,s.equals=function(r,i){l(i)&&(i=1e-10),r=r[t.toLowerCase()]();for(var s=0;s<n.length;s+=1)if(e.abs(this["_"+n[s]]-r["_"+n[s]])>i)return!1;return!0},s.toJSON=new r("return ['"+t+"', "+n.map(function(e){return"this._"+e},this).join(", ")+"];");for(var o in i)if(i.hasOwnProperty(o)){var u=o.match(/^from(.*)$/);u?d[u[1].toUpperCase()].prototype[t.toLowerCase()]=i[o]:s[o]=i[o]}s[t.toLowerCase()]=function(){return this},s.toString=new r('return "[one.color.'+t+':"+'+n.map(function(e,t){return'" '+n[t]+'="+this._'+e}).join("+")+'+"]";'),n.forEach(function(e,t){s[e]=s[e==="black"?"k":e[0]]=new r("value","isDelta","if (typeof value === 'undefined') {return this._"+e+";"+"}"+"if (isDelta) {"+"return new this.constructor("+n.map(function(t,n){return"this._"+t+(e===t?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+n.map(function(t,n){return e===t?"value":"this._"+t}).join(", ")+");")}),a.forEach(function(e){f(t,e),f(e,t)}),a.push(t)}function m(){var e=this.rgb(),t=e._red*.3+e._green*.59+e._blue*.11;return new d.RGB(t,t,t,this._alpha)}var a=[],f={},l=function(e){return typeof e=="undefined"},c=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,h=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,p=new RegExp("^(rgb|hsl|hsv)a?\\("+c.source+","+c.source+","+c.source+"(?:,"+h.source+")?"+"\\)$","i");d.installMethod=function(e,t){a.forEach(function(n){d[n].prototype[e]=t})},v("RGB",["red","green","blue","alpha"],{hex:function(){var e=(s(255*this._red)*65536+s(255*this._green)*256+s(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-e.length)+e},hexa:function(){var e=s(this._alpha*255).toString(16);return"#"+"00".substr(0,2-e.length)+e+this.hex().substr(1,6)},css:function(){return"rgb("+s(255*this._red)+","+s(255*this._green)+","+s(255*this._blue)+")"},cssa:function(){return"rgba("+s(255*this._red)+","+s(255*this._green)+","+s(255*this._blue)+","+this._alpha+")"}}),typeof module!="undefined"?module.exports=d:typeof define=="function"&&!l(define.amd)?define([],function(){return d}):(one=window.one||{},one.color=d),typeof jQuery!="undefined"&&l(jQuery.color)&&(jQuery.color=d),f={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",rebeccapurple:"639",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"},v("XYZ",["x","y","z","alpha"],{fromRgb:function(){var e=function(e){return e>.04045?o((e+.055)/1.055,2.4):e/12.92},t=e(this._red),n=e(this._green),r=e(this._blue);return new d.XYZ(t*.4124564+n*.3575761+r*.1804375,t*.2126729+n*.7151522+r*.072175,t*.0193339+n*.119192+r*.9503041,this._alpha)},rgb:function(){var e=this._x,t=this._y,n=this._z,r=function(e){return e>.0031308?1.055*o(e,1/2.4)-.055:12.92*e};return new d.RGB(r(e*3.2404542+t*-1.5371385+n*-0.4985314),r(e*-0.969266+t*1.8760108+n*.041556),r(e*.0556434+t*-0.2040259+n*1.0572252),this._alpha)},lab:function(){var e=function(e){return e>.008856?o(e,1/3):7.787037*e+4/29},t=e(this._x/95.047),n=e(this._y/100),r=e(this._z/108.883);return new d.LAB(116*n-16,500*(t-n),200*(n-r),this._alpha)}}),v("LAB",["l","a","b","alpha"],{fromRgb:function(){return this.xyz().lab()},rgb:function(){return this.xyz().rgb()},xyz:function(){var e=function(e){var t=o(e,3);return t>.008856?t:(e-16/116)/7.87},t=(this._l+16)/116,n=this._a/500+t,r=t-this._b/200;return new d.XYZ(e(n)*95.047,e(t)*100,e(r)*108.883,this._alpha)}}),v("HSV",["hue","saturation","value","alpha"],{rgb:function(){var t=this._hue,n=this._saturation,r=this._value,i=u(5,e.floor(t*6)),s=t*6-i,o=r*(1-n),a=r*(1-s*n),f=r*(1-(1-s)*n),l,c,h;switch(i){case 0:l=r,c=f,h=o;break;case 1:l=a,c=r,h=o;break;case 2:l=o,c=r,h=f;break;case 3:l=o,c=a,h=r;break;case 4:l=f,c=o,h=r;break;case 5:l=r,c=o,h=a}return new d.RGB(l,c,h,this._alpha)},hsl:function(){var e=(2-this._saturation)*this._value,t=this._saturation*this._value,n=e<=1?e:2-e,r;return n<1e-9?r=0:r=t/n,new d.HSL(this._hue,r,e/2,this._alpha)},fromRgb:function(){var t=this._red,n=this._green,r=this._blue,i=e.max(t,n,r),s=u(t,n,r),o=i-s,a,f=i===0?0:o/i,l=i;if(o===0)a=0;else switch(i){case t:a=(n-r)/o/6+(n<r?1:0);break;case n:a=(r-t)/o/6+1/3;break;case r:a=(t-n)/o/6+2/3}return new d.HSV(a,f,l,this._alpha)}}),v("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var e=this._lightness*2,t=this._saturation*(e<=1?e:2-e),n;return e+t<1e-9?n=0:n=2*t/(e+t),new d.HSV(this._hue,n,(e+t)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}}),v("CMYK",["cyan","magenta","yellow","black","alpha"],{rgb:function(){return new d.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 e=this._red,t=this._green,n=this._blue,r=1-e,i=1-t,s=1-n,o=1;return e||t||n?(o=u(r,u(i,s)),r=(r-o)/(1-o),i=(i-o)/(1-o),s=(s-o)/(1-o)):o=1,new d.CMYK(r,i,s,o,this._alpha)}}),d.installMethod("clearer",function(e){return this.alpha(i(e)?-0.1:-e,!0)}),d.installMethod("darken",function(e){return this.lightness(i(e)?-0.1:-e,!0)}),d.installMethod("desaturate",function(e){return this.saturation(i(e)?-0.1:-e,!0)}),d.installMethod("greyscale",m),d.installMethod("grayscale",m),d.installMethod("lighten",function(e){return this.lightness(i(e)?.1:e,!0)}),d.installMethod("mix",function(e,t){e=d(e).rgb(),t=1-(i(t)?.5:t);var n=t*2-1,r=this._alpha-e._alpha,s=((n*r===-1?n:(n+r)/(1+n*r))+1)/2,o=1-s,u=this.rgb();return new d.RGB(u._red*s+e._red*o,u._green*s+e._green*o,u._blue*s+e._blue*o,u._alpha*t+e._alpha*(1-t))}),d.installMethod("negate",function(){var e=this.rgb();return new d.RGB(1-e._red,1-e._green,1-e._blue,this._alpha)}),d.installMethod("opaquer",function(e){return this.alpha(i(e)?.1:e,!0)}),d.installMethod("rotate",function(e){return this.hue((e||0)/360,!0)}),d.installMethod("saturate",function(e){return this.saturation(i(e)?.1:e,!0)}),d.installMethod("toAlpha",function(e){var t=this.rgb(),n=d(e).rgb(),r=1e-10,i=new d.RGB(0,0,0,t._alpha),s=["_red","_green","_blue"];return s.forEach(function(e){t[e]<r?i[e]=t[e]:t[e]>n[e]?i[e]=(t[e]-n[e])/(1-n[e]):t[e]>n[e]?i[e]=(n[e]-t[e])/n[e]:i[e]=0}),i._red>i._green?i._red>i._blue?t._alpha=i._red:t._alpha=i._blue:i._green>i._blue?t._alpha=i._green:t._alpha=i._blue,t._alpha<r?t:(s.forEach(function(e){t[e]=(t[e]-n[e])/t._alpha+n[e]}),t._alpha*=i._alpha,t)})})(Math,parseFloat,parseInt,Function,isNaN,Math.round,Math.pow,Math.min) | ||
(function(e,t,n,r,i,s,o,u){function d(e){if(Object.prototype.toString.apply(e)==="[object Array]"){if(typeof e[0]=="string"&&typeof d[e[0]]=="function")return new d[e[0]](e.slice(1,e.length));if(e.length===4)return new d.RGB(e[0]/255,e[1]/255,e[2]/255,e[3]/255)}else if(typeof e=="string"){var r=e.toLowerCase();f[r]&&(e="#"+f[r]),r==="transparent"&&(e="rgba(0,0,0,0)");var i=e.match(p);if(i){var s=i[1].toUpperCase(),o=l(i[8])?i[8]:t(i[8]),u=s[0]==="H",a=i[3]?100:u?360:255,c=i[5]||u?100:255,h=i[7]||u?100:255;if(l(d[s]))throw new Error("one.color."+s+" is not installed.");return new d[s](t(i[2])/a,t(i[4])/c,t(i[6])/h,o)}e.length<6&&(e=e.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var v=e.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(v)return new d.RGB(n(v[1],16)/255,n(v[2],16)/255,n(v[3],16)/255)}else if(typeof e=="object"&&e.isColor)return e;return!1}function v(t,n,i){function f(e,t){var n={};n[t.toLowerCase()]=new r("return this.rgb()."+t.toLowerCase()+"();"),d[t].propertyNames.forEach(function(e,i){n[e]=n[e==="black"?"k":e[0]]=new r("value","isDelta","return this."+t.toLowerCase()+"()."+e+"(value, isDelta);")});for(var i in n)n.hasOwnProperty(i)&&d[e].prototype[i]===undefined&&(d[e].prototype[i]=n[i])}d[t]=new r(n.join(","),"if (Object.prototype.toString.apply("+n[0]+") === '[object Array]') {"+n.map(function(e,t){return e+"="+n[0]+"["+t+"];"}).reverse().join("")+"}"+"if ("+n.filter(function(e){return e!=="alpha"}).map(function(e){return"isNaN("+e+")"}).join("||")+"){"+'throw new Error("['+t+']: Invalid color: ("+'+n.join('+","+')+'+")");}'+n.map(function(e){return e==="hue"?"this._hue=hue<0?hue-Math.floor(hue):hue%1":e==="alpha"?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+e+"="+e+"<0?0:("+e+">1?1:"+e+")"}).join(";")+";"),d[t].propertyNames=n;var s=d[t].prototype;["valueOf","hex","hexa","css","cssa"].forEach(function(e){s[e]=s[e]||(t==="RGB"?s.hex:new r("return this.rgb()."+e+"();"))}),s.isColor=!0,s.equals=function(r,i){l(i)&&(i=1e-10),r=r[t.toLowerCase()]();for(var s=0;s<n.length;s+=1)if(e.abs(this["_"+n[s]]-r["_"+n[s]])>i)return!1;return!0},s.toJSON=new r("return ['"+t+"', "+n.map(function(e){return"this._"+e},this).join(", ")+"];");for(var o in i)if(i.hasOwnProperty(o)){var u=o.match(/^from(.*)$/);u?d[u[1].toUpperCase()].prototype[t.toLowerCase()]=i[o]:s[o]=i[o]}s[t.toLowerCase()]=function(){return this},s.toString=new r('return "[one.color.'+t+':"+'+n.map(function(e,t){return'" '+n[t]+'="+this._'+e}).join("+")+'+"]";'),n.forEach(function(e,t){s[e]=s[e==="black"?"k":e[0]]=new r("value","isDelta","if (typeof value === 'undefined') {return this._"+e+";"+"}"+"if (isDelta) {"+"return new this.constructor("+n.map(function(t,n){return"this._"+t+(e===t?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+n.map(function(t,n){return e===t?"value":"this._"+t}).join(", ")+");")}),a.forEach(function(e){f(t,e),f(e,t)}),a.push(t)}function m(){var e=this.rgb(),t=e._red*.3+e._green*.59+e._blue*.11;return new d.RGB(t,t,t,this._alpha)}var a=[],f={},l=function(e){return typeof e=="undefined"},c=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,h=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,p=new RegExp("^(rgb|hsl|hsv)a?\\("+c.source+","+c.source+","+c.source+"(?:,"+h.source+")?"+"\\)$","i");d.installMethod=function(e,t){a.forEach(function(n){d[n].prototype[e]=t})},v("RGB",["red","green","blue","alpha"],{hex:function(){var e=(s(255*this._red)*65536+s(255*this._green)*256+s(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-e.length)+e},hexa:function(){var e=s(this._alpha*255).toString(16);return"#"+"00".substr(0,2-e.length)+e+this.hex().substr(1,6)},css:function(){return"rgb("+s(255*this._red)+","+s(255*this._green)+","+s(255*this._blue)+")"},cssa:function(){return"rgba("+s(255*this._red)+","+s(255*this._green)+","+s(255*this._blue)+","+this._alpha+")"}}),typeof define=="function"&&!l(define.amd)?define(function(){return d}):typeof exports=="object"?module.exports=d:(one=window.one||{},one.color=d),typeof jQuery!="undefined"&&l(jQuery.color)&&(jQuery.color=d),f={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",rebeccapurple:"639",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"},v("XYZ",["x","y","z","alpha"],{fromRgb:function(){var e=function(e){return e>.04045?o((e+.055)/1.055,2.4):e/12.92},t=e(this._red),n=e(this._green),r=e(this._blue);return new d.XYZ(t*.4124564+n*.3575761+r*.1804375,t*.2126729+n*.7151522+r*.072175,t*.0193339+n*.119192+r*.9503041,this._alpha)},rgb:function(){var e=this._x,t=this._y,n=this._z,r=function(e){return e>.0031308?1.055*o(e,1/2.4)-.055:12.92*e};return new d.RGB(r(e*3.2404542+t*-1.5371385+n*-0.4985314),r(e*-0.969266+t*1.8760108+n*.041556),r(e*.0556434+t*-0.2040259+n*1.0572252),this._alpha)},lab:function(){var e=function(e){return e>.008856?o(e,1/3):7.787037*e+4/29},t=e(this._x/95.047),n=e(this._y/100),r=e(this._z/108.883);return new d.LAB(116*n-16,500*(t-n),200*(n-r),this._alpha)}}),v("LAB",["l","a","b","alpha"],{fromRgb:function(){return this.xyz().lab()},rgb:function(){return this.xyz().rgb()},xyz:function(){var e=function(e){var t=o(e,3);return t>.008856?t:(e-16/116)/7.87},t=(this._l+16)/116,n=this._a/500+t,r=t-this._b/200;return new d.XYZ(e(n)*95.047,e(t)*100,e(r)*108.883,this._alpha)}}),v("HSV",["hue","saturation","value","alpha"],{rgb:function(){var t=this._hue,n=this._saturation,r=this._value,i=u(5,e.floor(t*6)),s=t*6-i,o=r*(1-n),a=r*(1-s*n),f=r*(1-(1-s)*n),l,c,h;switch(i){case 0:l=r,c=f,h=o;break;case 1:l=a,c=r,h=o;break;case 2:l=o,c=r,h=f;break;case 3:l=o,c=a,h=r;break;case 4:l=f,c=o,h=r;break;case 5:l=r,c=o,h=a}return new d.RGB(l,c,h,this._alpha)},hsl:function(){var e=(2-this._saturation)*this._value,t=this._saturation*this._value,n=e<=1?e:2-e,r;return n<1e-9?r=0:r=t/n,new d.HSL(this._hue,r,e/2,this._alpha)},fromRgb:function(){var t=this._red,n=this._green,r=this._blue,i=e.max(t,n,r),s=u(t,n,r),o=i-s,a,f=i===0?0:o/i,l=i;if(o===0)a=0;else switch(i){case t:a=(n-r)/o/6+(n<r?1:0);break;case n:a=(r-t)/o/6+1/3;break;case r:a=(t-n)/o/6+2/3}return new d.HSV(a,f,l,this._alpha)}}),v("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var e=this._lightness*2,t=this._saturation*(e<=1?e:2-e),n;return e+t<1e-9?n=0:n=2*t/(e+t),new d.HSV(this._hue,n,(e+t)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}}),v("CMYK",["cyan","magenta","yellow","black","alpha"],{rgb:function(){return new d.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 e=this._red,t=this._green,n=this._blue,r=1-e,i=1-t,s=1-n,o=1;return e||t||n?(o=u(r,u(i,s)),r=(r-o)/(1-o),i=(i-o)/(1-o),s=(s-o)/(1-o)):o=1,new d.CMYK(r,i,s,o,this._alpha)}}),d.installMethod("clearer",function(e){return this.alpha(i(e)?-0.1:-e,!0)}),d.installMethod("darken",function(e){return this.lightness(i(e)?-0.1:-e,!0)}),d.installMethod("desaturate",function(e){return this.saturation(i(e)?-0.1:-e,!0)}),d.installMethod("greyscale",m),d.installMethod("grayscale",m),d.installMethod("lighten",function(e){return this.lightness(i(e)?.1:e,!0)}),d.installMethod("mix",function(e,t){e=d(e).rgb(),t=1-(i(t)?.5:t);var n=t*2-1,r=this._alpha-e._alpha,s=((n*r===-1?n:(n+r)/(1+n*r))+1)/2,o=1-s,u=this.rgb();return new d.RGB(u._red*s+e._red*o,u._green*s+e._green*o,u._blue*s+e._blue*o,u._alpha*t+e._alpha*(1-t))}),d.installMethod("negate",function(){var e=this.rgb();return new d.RGB(1-e._red,1-e._green,1-e._blue,this._alpha)}),d.installMethod("opaquer",function(e){return this.alpha(i(e)?.1:e,!0)}),d.installMethod("rotate",function(e){return this.hue((e||0)/360,!0)}),d.installMethod("saturate",function(e){return this.saturation(i(e)?.1:e,!0)}),d.installMethod("toAlpha",function(e){var t=this.rgb(),n=d(e).rgb(),r=1e-10,i=new d.RGB(0,0,0,t._alpha),s=["_red","_green","_blue"];return s.forEach(function(e){t[e]<r?i[e]=t[e]:t[e]>n[e]?i[e]=(t[e]-n[e])/(1-n[e]):t[e]>n[e]?i[e]=(n[e]-t[e])/n[e]:i[e]=0}),i._red>i._green?i._red>i._blue?t._alpha=i._red:t._alpha=i._blue:i._green>i._blue?t._alpha=i._green:t._alpha=i._blue,t._alpha<r?t:(s.forEach(function(e){t[e]=(t[e]-n[e])/t._alpha+n[e]}),t._alpha*=i._alpha,t)})})(Math,parseFloat,parseInt,Function,isNaN,Math.round,Math.pow,Math.min) |
@@ -216,10 +216,9 @@ /*jshint evil:true, onevar:false*/ | ||
}); | ||
if (typeof module !== 'undefined') { | ||
if (typeof define === 'function' && !undef(define.amd)) { | ||
define(function () { | ||
return ONECOLOR; | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node module export | ||
module.exports = ONECOLOR; | ||
} else if (typeof define === 'function' && !undef(define.amd)) { | ||
define([], function () { | ||
return ONECOLOR; | ||
}); | ||
} else { | ||
@@ -226,0 +225,0 @@ one = window.one || {}; |
@@ -1,1 +0,1 @@ | ||
(function(e,t,n,r,i,s){function h(n){if(Object.prototype.toString.apply(n)==="[object Array]"){if(typeof n[0]=="string"&&typeof h[n[0]]=="function")return new h[n[0]](n.slice(1,n.length));if(n.length===4)return new h.RGB(n[0]/255,n[1]/255,n[2]/255,n[3]/255)}else if(typeof n=="string"){var r=n.toLowerCase();u[r]&&(n="#"+u[r]),r==="transparent"&&(n="rgba(0,0,0,0)");var i=n.match(c);if(i){var s=i[1].toUpperCase(),o=a(i[8])?i[8]:e(i[8]),f=s[0]==="H",l=i[3]?100:f?360:255,p=i[5]||f?100:255,d=i[7]||f?100:255;if(a(h[s]))throw new Error("one.color."+s+" is not installed.");return new h[s](e(i[2])/l,e(i[4])/p,e(i[6])/d,o)}n.length<6&&(n=n.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var v=n.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(v)return new h.RGB(t(v[1],16)/255,t(v[2],16)/255,t(v[3],16)/255)}else if(typeof n=="object"&&n.isColor)return n;return!1}function p(e,t,i){function l(e,t){var r={};r[t.toLowerCase()]=new n("return this.rgb()."+t.toLowerCase()+"();"),h[t].propertyNames.forEach(function(e,i){r[e]=r[e==="black"?"k":e[0]]=new n("value","isDelta","return this."+t.toLowerCase()+"()."+e+"(value, isDelta);")});for(var i in r)r.hasOwnProperty(i)&&h[e].prototype[i]===undefined&&(h[e].prototype[i]=r[i])}h[e]=new n(t.join(","),"if (Object.prototype.toString.apply("+t[0]+") === '[object Array]') {"+t.map(function(e,n){return e+"="+t[0]+"["+n+"];"}).reverse().join("")+"}"+"if ("+t.filter(function(e){return e!=="alpha"}).map(function(e){return"isNaN("+e+")"}).join("||")+"){"+'throw new Error("['+e+']: Invalid color: ("+'+t.join('+","+')+'+")");}'+t.map(function(e){return e==="hue"?"this._hue=hue<0?hue-Math.floor(hue):hue%1":e==="alpha"?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+e+"="+e+"<0?0:("+e+">1?1:"+e+")"}).join(";")+";"),h[e].propertyNames=t;var s=h[e].prototype;["valueOf","hex","hexa","css","cssa"].forEach(function(t){s[t]=s[t]||(e==="RGB"?s.hex:new n("return this.rgb()."+t+"();"))}),s.isColor=!0,s.equals=function(n,i){a(i)&&(i=1e-10),n=n[e.toLowerCase()]();for(var s=0;s<t.length;s+=1)if(r.abs(this["_"+t[s]]-n["_"+t[s]])>i)return!1;return!0},s.toJSON=new n("return ['"+e+"', "+t.map(function(e){return"this._"+e},this).join(", ")+"];");for(var u in i)if(i.hasOwnProperty(u)){var f=u.match(/^from(.*)$/);f?h[f[1].toUpperCase()].prototype[e.toLowerCase()]=i[u]:s[u]=i[u]}s[e.toLowerCase()]=function(){return this},s.toString=new n('return "[one.color.'+e+':"+'+t.map(function(e,n){return'" '+t[n]+'="+this._'+e}).join("+")+'+"]";'),t.forEach(function(e,r){s[e]=s[e==="black"?"k":e[0]]=new n("value","isDelta","if (typeof value === 'undefined') {return this._"+e+";"+"}"+"if (isDelta) {"+"return new this.constructor("+t.map(function(t,n){return"this._"+t+(e===t?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+t.map(function(t,n){return e===t?"value":"this._"+t}).join(", ")+");")}),o.forEach(function(t){l(e,t),l(t,e)}),o.push(e)}var o=[],u={},a=function(e){return typeof e=="undefined"},f=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,l=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,c=new RegExp("^(rgb|hsl|hsv)a?\\("+f.source+","+f.source+","+f.source+"(?:,"+l.source+")?"+"\\)$","i");h.installMethod=function(e,t){o.forEach(function(n){h[n].prototype[e]=t})},p("RGB",["red","green","blue","alpha"],{hex:function(){var e=(i(255*this._red)*65536+i(255*this._green)*256+i(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-e.length)+e},hexa:function(){var e=i(this._alpha*255).toString(16);return"#"+"00".substr(0,2-e.length)+e+this.hex().substr(1,6)},css:function(){return"rgb("+i(255*this._red)+","+i(255*this._green)+","+i(255*this._blue)+")"},cssa:function(){return"rgba("+i(255*this._red)+","+i(255*this._green)+","+i(255*this._blue)+","+this._alpha+")"}}),typeof module!="undefined"?module.exports=h:typeof define=="function"&&!a(define.amd)?define([],function(){return h}):(one=window.one||{},one.color=h),typeof jQuery!="undefined"&&a(jQuery.color)&&(jQuery.color=h),p("HSV",["hue","saturation","value","alpha"],{rgb:function(){var e=this._hue,t=this._saturation,n=this._value,i=s(5,r.floor(e*6)),o=e*6-i,u=n*(1-t),a=n*(1-o*t),f=n*(1-(1-o)*t),l,c,p;switch(i){case 0:l=n,c=f,p=u;break;case 1:l=a,c=n,p=u;break;case 2:l=u,c=n,p=f;break;case 3:l=u,c=a,p=n;break;case 4:l=f,c=u,p=n;break;case 5:l=n,c=u,p=a}return new h.RGB(l,c,p,this._alpha)},hsl:function(){var e=(2-this._saturation)*this._value,t=this._saturation*this._value,n=e<=1?e:2-e,r;return n<1e-9?r=0:r=t/n,new h.HSL(this._hue,r,e/2,this._alpha)},fromRgb:function(){var e=this._red,t=this._green,n=this._blue,i=r.max(e,t,n),o=s(e,t,n),u=i-o,a,f=i===0?0:u/i,l=i;if(u===0)a=0;else switch(i){case e:a=(t-n)/u/6+(t<n?1:0);break;case t:a=(n-e)/u/6+1/3;break;case n:a=(e-t)/u/6+2/3}return new h.HSV(a,f,l,this._alpha)}}),p("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var e=this._lightness*2,t=this._saturation*(e<=1?e:2-e),n;return e+t<1e-9?n=0:n=2*t/(e+t),new h.HSV(this._hue,n,(e+t)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}})})(parseFloat,parseInt,Function,Math,Math.round,Math.min) | ||
(function(e,t,n,r,i,s){function h(n){if(Object.prototype.toString.apply(n)==="[object Array]"){if(typeof n[0]=="string"&&typeof h[n[0]]=="function")return new h[n[0]](n.slice(1,n.length));if(n.length===4)return new h.RGB(n[0]/255,n[1]/255,n[2]/255,n[3]/255)}else if(typeof n=="string"){var r=n.toLowerCase();u[r]&&(n="#"+u[r]),r==="transparent"&&(n="rgba(0,0,0,0)");var i=n.match(c);if(i){var s=i[1].toUpperCase(),o=a(i[8])?i[8]:e(i[8]),f=s[0]==="H",l=i[3]?100:f?360:255,p=i[5]||f?100:255,d=i[7]||f?100:255;if(a(h[s]))throw new Error("one.color."+s+" is not installed.");return new h[s](e(i[2])/l,e(i[4])/p,e(i[6])/d,o)}n.length<6&&(n=n.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var v=n.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(v)return new h.RGB(t(v[1],16)/255,t(v[2],16)/255,t(v[3],16)/255)}else if(typeof n=="object"&&n.isColor)return n;return!1}function p(e,t,i){function l(e,t){var r={};r[t.toLowerCase()]=new n("return this.rgb()."+t.toLowerCase()+"();"),h[t].propertyNames.forEach(function(e,i){r[e]=r[e==="black"?"k":e[0]]=new n("value","isDelta","return this."+t.toLowerCase()+"()."+e+"(value, isDelta);")});for(var i in r)r.hasOwnProperty(i)&&h[e].prototype[i]===undefined&&(h[e].prototype[i]=r[i])}h[e]=new n(t.join(","),"if (Object.prototype.toString.apply("+t[0]+") === '[object Array]') {"+t.map(function(e,n){return e+"="+t[0]+"["+n+"];"}).reverse().join("")+"}"+"if ("+t.filter(function(e){return e!=="alpha"}).map(function(e){return"isNaN("+e+")"}).join("||")+"){"+'throw new Error("['+e+']: Invalid color: ("+'+t.join('+","+')+'+")");}'+t.map(function(e){return e==="hue"?"this._hue=hue<0?hue-Math.floor(hue):hue%1":e==="alpha"?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+e+"="+e+"<0?0:("+e+">1?1:"+e+")"}).join(";")+";"),h[e].propertyNames=t;var s=h[e].prototype;["valueOf","hex","hexa","css","cssa"].forEach(function(t){s[t]=s[t]||(e==="RGB"?s.hex:new n("return this.rgb()."+t+"();"))}),s.isColor=!0,s.equals=function(n,i){a(i)&&(i=1e-10),n=n[e.toLowerCase()]();for(var s=0;s<t.length;s+=1)if(r.abs(this["_"+t[s]]-n["_"+t[s]])>i)return!1;return!0},s.toJSON=new n("return ['"+e+"', "+t.map(function(e){return"this._"+e},this).join(", ")+"];");for(var u in i)if(i.hasOwnProperty(u)){var f=u.match(/^from(.*)$/);f?h[f[1].toUpperCase()].prototype[e.toLowerCase()]=i[u]:s[u]=i[u]}s[e.toLowerCase()]=function(){return this},s.toString=new n('return "[one.color.'+e+':"+'+t.map(function(e,n){return'" '+t[n]+'="+this._'+e}).join("+")+'+"]";'),t.forEach(function(e,r){s[e]=s[e==="black"?"k":e[0]]=new n("value","isDelta","if (typeof value === 'undefined') {return this._"+e+";"+"}"+"if (isDelta) {"+"return new this.constructor("+t.map(function(t,n){return"this._"+t+(e===t?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+t.map(function(t,n){return e===t?"value":"this._"+t}).join(", ")+");")}),o.forEach(function(t){l(e,t),l(t,e)}),o.push(e)}var o=[],u={},a=function(e){return typeof e=="undefined"},f=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,l=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,c=new RegExp("^(rgb|hsl|hsv)a?\\("+f.source+","+f.source+","+f.source+"(?:,"+l.source+")?"+"\\)$","i");h.installMethod=function(e,t){o.forEach(function(n){h[n].prototype[e]=t})},p("RGB",["red","green","blue","alpha"],{hex:function(){var e=(i(255*this._red)*65536+i(255*this._green)*256+i(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-e.length)+e},hexa:function(){var e=i(this._alpha*255).toString(16);return"#"+"00".substr(0,2-e.length)+e+this.hex().substr(1,6)},css:function(){return"rgb("+i(255*this._red)+","+i(255*this._green)+","+i(255*this._blue)+")"},cssa:function(){return"rgba("+i(255*this._red)+","+i(255*this._green)+","+i(255*this._blue)+","+this._alpha+")"}}),typeof define=="function"&&!a(define.amd)?define(function(){return h}):typeof exports=="object"?module.exports=h:(one=window.one||{},one.color=h),typeof jQuery!="undefined"&&a(jQuery.color)&&(jQuery.color=h),p("HSV",["hue","saturation","value","alpha"],{rgb:function(){var e=this._hue,t=this._saturation,n=this._value,i=s(5,r.floor(e*6)),o=e*6-i,u=n*(1-t),a=n*(1-o*t),f=n*(1-(1-o)*t),l,c,p;switch(i){case 0:l=n,c=f,p=u;break;case 1:l=a,c=n,p=u;break;case 2:l=u,c=n,p=f;break;case 3:l=u,c=a,p=n;break;case 4:l=f,c=u,p=n;break;case 5:l=n,c=u,p=a}return new h.RGB(l,c,p,this._alpha)},hsl:function(){var e=(2-this._saturation)*this._value,t=this._saturation*this._value,n=e<=1?e:2-e,r;return n<1e-9?r=0:r=t/n,new h.HSL(this._hue,r,e/2,this._alpha)},fromRgb:function(){var e=this._red,t=this._green,n=this._blue,i=r.max(e,t,n),o=s(e,t,n),u=i-o,a,f=i===0?0:u/i,l=i;if(u===0)a=0;else switch(i){case e:a=(t-n)/u/6+(t<n?1:0);break;case t:a=(n-e)/u/6+1/3;break;case n:a=(e-t)/u/6+2/3}return new h.HSV(a,f,l,this._alpha)}}),p("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var e=this._lightness*2,t=this._saturation*(e<=1?e:2-e),n;return e+t<1e-9?n=0:n=2*t/(e+t),new h.HSV(this._hue,n,(e+t)/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.4.1", | ||
"version": "2.4.2", | ||
"keywords": [ | ||
@@ -28,2 +28,3 @@ "ender", | ||
"optimist": "=0.3.1", | ||
"uglify-js": "=2.4.15", | ||
"vows": "=0.7.0" | ||
@@ -34,5 +35,9 @@ }, | ||
}, | ||
"directories": { | ||
"lib": "./lib" | ||
}, | ||
"files": [ | ||
"one-color-all-debug.js", | ||
"one-color-all.js", | ||
"one-color-debug.js", | ||
"one-color.js", | ||
"one-color-ieshim.js" | ||
], | ||
"publishConfig": { | ||
@@ -44,3 +49,4 @@ "registry": "http://registry.npmjs.org/" | ||
"scripts": { | ||
"postpublish": "jam publish" | ||
"postpublish": "jam publish", | ||
"test": "vows" | ||
}, | ||
@@ -47,0 +53,0 @@ "jam": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
1
67072
5
7
1059
1