Skip to content
Browse files

Bump version

  • Loading branch information...
1 parent dd195f9 commit 5087d62a9fa113a2abe951341bd096c237f88ad3 @bebraw committed Jun 25, 2013
Showing with 3 additions and 3 deletions.
  1. +1 −1 dist/colorjoe.js
  2. +1 −1 dist/colorjoe.min.js
  3. +1 −1 package.json
View
2 dist/colorjoe.js
@@ -1,4 +1,4 @@
-/*! colorjoe - v0.7.2 - Juho Vepsalainen <bebraw@gmail.com> - MIT
+/*! colorjoe - v0.8.0 - Juho Vepsalainen <bebraw@gmail.com> - MIT
https://bebraw.github.com/colorjoe - 2013-06-25 */
/*! drag.js - v0.3.8 - 2012-07-11
* http://bebraw.github.com/drag.js/
View
2 dist/colorjoe.min.js
@@ -1 +1 @@
-function ONECOLOR(a){if("[object Array]"===Object.prototype.toString.apply(a)){if("string"==typeof a[0]&&"function"==typeof ONECOLOR[a[0]])return new ONECOLOR[a[0]](a.slice(1,a.length));if(4===a.length)return new ONECOLOR.RGB(a[0]/255,a[1]/255,a[2]/255,a[3]/255)}else if("string"==typeof a){var b=a.toLowerCase();namedColors[b]&&(a="#"+namedColors[b]),"transparent"===b&&(a="rgba(0,0,0,0)");var c=a.match(cssColorRegExp);if(c){var d=c[1].toUpperCase(),e=undef(c[8])?c[8]:parseFloat(c[8]),f="H"===d[0],g=c[3]?100:f?360:255,h=c[5]||f?100:255,i=c[7]||f?100:255;if(undef(ONECOLOR[d]))throw new Error("one.color."+d+" is not installed.");return new ONECOLOR[d](parseFloat(c[2])/g,parseFloat(c[4])/h,parseFloat(c[6])/i,e)}a.length<6&&(a=a.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var j=a.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(j)return new ONECOLOR.RGB(parseInt(j[1],16)/255,parseInt(j[2],16)/255,parseInt(j[3],16)/255)}else if("object"==typeof a&&a.isColor)return a;return!1}function installColorSpace(a,b,c){function d(a,b){var c={};c[b.toLowerCase()]=new Function("return this.rgb()."+b.toLowerCase()+"();"),ONECOLOR[b].propertyNames.forEach(function(a){c[a]=c["black"===a?"k":a[0]]=new Function("value","isDelta","return this."+b.toLowerCase()+"()."+a+"(value, isDelta);")});for(var d in c)c.hasOwnProperty(d)&&void 0===ONECOLOR[a].prototype[d]&&(ONECOLOR[a].prototype[d]=c[d])}ONECOLOR[a]=new Function(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"alpha"!==a}).map(function(a){return"isNaN("+a+")"}).join("||")+"){"+'throw new Error("['+a+']: Invalid color: ("+'+b.join('+","+')+'+")");}'+b.map(function(a){return"hue"===a?"this._hue=hue<0?hue-Math.floor(hue):hue%1":"alpha"===a?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+a+"="+a+"<0?0:("+a+">1?1:"+a+")"}).join(";")+";"),ONECOLOR[a].propertyNames=b;var e=ONECOLOR[a].prototype;["valueOf","hex","hexa","css","cssa"].forEach(function(b){e[b]=e[b]||("RGB"===a?e.hex:new Function("return this.rgb()."+b+"();"))}),e.isColor=!0,e.equals=function(c,d){undef(d)&&(d=1e-10),c=c[a.toLowerCase()]();for(var e=0;e<b.length;e+=1)if(Math.abs(this["_"+b[e]]-c["_"+b[e]])>d)return!1;return!0},e.toJSON=new Function("return ['"+a+"', "+b.map(function(a){return"this._"+a},this).join(", ")+"];");for(var f in c)if(c.hasOwnProperty(f)){var g=f.match(/^from(.*)$/);g?ONECOLOR[g[1].toUpperCase()].prototype[a.toLowerCase()]=c[f]:e[f]=c[f]}e[a.toLowerCase()]=function(){return this},e.toString=new Function('return "[one.color.'+a+':"+'+b.map(function(a,c){return'" '+b[c]+'="+this._'+a}).join("+")+'+"]";'),b.forEach(function(a){e[a]=e["black"===a?"k":a[0]]=new Function("value","isDelta","if (typeof value === 'undefined') {return this._"+a+";"+"}"+"if (isDelta) {"+"return new this.constructor("+b.map(function(b){return"this._"+b+(a===b?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+b.map(function(b){return a===b?"value":"this._"+b}).join(", ")+");")}),installedColorSpaces.forEach(function(b){d(a,b),d(b,a)}),installedColorSpaces.push(a)}function gs(){var a=this.rgb(),b=.3*a._red+.59*a._green+.11*a._blue;return new ONECOLOR.RGB(b,b,b,this._alpha)}!function(a,b){"function"==typeof define&&define.amd?define(b):a.drag=b()}(this,function(){function a(a,b){return a?(g()?h(a,b,"touchstart","touchmove","touchend"):h(a,b,"mousedown","mousemove","mouseup"),void 0):(console.warn("drag is missing elem!"),void 0)}function b(b){var c=e(b["class"]||"",b.parent),f=e("pointer",c);return e("shape shape1",f),e("shape shape2",f),e("bg bg1",c),e("bg bg2",c),a(c,d(b.cbs,f)),{background:c,pointer:f}}function c(b){var c=e(b["class"],b.parent),f=e("pointer",c);return e("shape",f),e("bg",c),a(c,d(b.cbs,f)),{background:c,pointer:f}}function d(a,b){function c(a){return function(c){c.pointer=b,a(c)}}var d={};for(var e in a)d[e]=c(a[e]);return d}function e(a,b){return f("div",a,b)}function f(a,b,c){var d=document.createElement(a);return b&&(d.className=b),c.appendChild(d),d}function g(){return"undefined"!=typeof window.ontouchstart}function h(a,b,c,d,e){var f=!1;b=k(b);var g=b.begin,h=b.change,l=b.end;i(a,c,function(b){function c(){f=!1,j(document,d,k),j(document,e,c),n(l,a,b)}f=!0;var k=o(n,h,a);i(document,d,k),i(document,e,c),n(g,a,b)})}function i(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)}function j(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)}function k(a){if(a)return{begin:a.begin||m,change:a.change||m,end:a.end||m};var b,c;return{begin:function(a){b={x:a.elem.offsetLeft,y:a.elem.offsetTop},c=a.cursor},change:function(a){l(a.elem,"left",b.x+a.cursor.x-c.x+"px"),l(a.elem,"top",b.y+a.cursor.y-c.y+"px")},end:m}}function l(a,b,c){a.style[b]=c}function m(){}function n(a,b,c){c.preventDefault();var d=p(b),e=b.clientWidth,f=b.clientHeight,g={x:q(b,c),y:r(b,c)},h=(g.x-d.x)/e,i=(g.y-d.y)/f;a({x:isNaN(h)?0:h,y:isNaN(i)?0:i,cursor:g,elem:b,e:c})}function o(a){var b=Array.prototype.slice,c=b.apply(arguments,[1]);return function(){return a.apply(null,c.concat(b.apply(arguments)))}}function p(a){var b=0,c=0;if(a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return{x:b,y:c}}function q(a,b){if(t(a)){var c=parseInt(u(document.body,"marginLeft"),10)-s(a,"scrollLeft")+window.pageXOffset+a.style.marginLeft;return b.clientX-c}return b.pageX?b.pageX:b.clientX?b.clientX+document.body.scrollLeft:void 0}function r(a,b){if(t(a)){var c=parseInt(u(document.body,"marginTop"),10)-s(a,"scrollTop")+window.pageYOffset+a.style.marginTop;return b.clientY-c}return b.pageY?b.pageY:b.clientY?b.clientY+document.body.scrollTop:void 0}function s(a,b){for(var c=0;"HTML"!=a.nodeName;)c+=a[b],a=a.parentNode;return c}function t(a){for(;"HTML"!=a.nodeName&&"fixed"!=v(a,"position");)a=a.parentNode;return"HTML"==a.nodeName?!1:!0}function u(a,b){return a.currentStyle?a.currentStyle[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,"")[b]:a.style[b]}function v(a,b){var c;return c=window.getComputedStyle?window.getComputedStyle(a,null):a.currentStyle,c[b]}return a.xyslider=b,a.slider=c,a});var installedColorSpaces=[],namedColors={},undef=function(a){return"undefined"==typeof a},channelRegExp=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,alphaChannelRegExp=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,cssColorRegExp=new RegExp("^(rgb|hsl|hsv)a?\\("+channelRegExp.source+","+channelRegExp.source+","+channelRegExp.source+"(?:,"+alphaChannelRegExp.source+")?"+"\\)$","i");ONECOLOR.installMethod=function(a,b){installedColorSpaces.forEach(function(c){ONECOLOR[c].prototype[a]=b})},installColorSpace("RGB",["red","green","blue","alpha"],{hex:function(){var a=(65536*Math.round(255*this._red)+256*Math.round(255*this._green)+Math.round(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-a.length)+a},hexa:function(){var a=Math.round(255*this._alpha).toString(16);return"#"+"00".substr(0,2-a.length)+a+this.hex().substr(1,6)},css:function(){return"rgb("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+")"},cssa:function(){return"rgba("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+","+this._alpha+")"}}),"undefined"!=typeof module?module.exports=ONECOLOR:"function"!=typeof define||undef(define.amd)?"undefined"!=typeof jQuery&&undef(jQuery.color)?jQuery.color=ONECOLOR:(one=window.one||{},one.color=ONECOLOR):define([],function(){return ONECOLOR}),namedColors={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"},installColorSpace("XYZ",["x","y","z","alpha"],{fromRgb:function(){var a=function(a){return 100*(a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92)},b=a(this._red),c=a(this._green),d=a(this._blue);return new ONECOLOR.XYZ(.4124*b+.3576*c+.1805*d,.2126*b+.7152*c+.0722*d,.0193*b+.1192*c+.9505*d,this._alpha)},rgb:function(){var a=this._x/100,b=this._y/100,c=this._z/100,d=function(a){return a>.0031308?1.055*Math.pow(a,1/2.4)-.055:12.92*a};return new ONECOLOR.RGB(d(3.2406*a+-1.5372*b+c*-.4986),d(a*-.9689+1.8758*b+.0415*c),d(.0557*a+b*-.204+1.057*c),this._alpha)},lab:function(){var a=function(a){return a>.008856?Math.pow(a,1/3):7.787037*a+4/29},b=a(this._x/95.047),c=a(this._y/100),d=a(this._z/108.883);return new ONECOLOR.LAB(116*c-16,500*(b-c),200*(c-d),this._alpha)}}),installColorSpace("LAB",["l","a","b","alpha"],{fromRgb:function(){return this.xyz().lab()},rgb:function(){return this.xyz().rgb()},xyz:function(){var a=function(a){var b=Math.pow(a,3);return b>.008856?b:(a-16/116)/7.87},b=(this._l+16)/116,c=this._a/500+b,d=b-this._b/200;return new ONECOLOR.XYZ(95.047*a(c),100*a(b),108.883*a(d),this._alpha)}}),installColorSpace("HSV",["hue","saturation","value","alpha"],{rgb:function(){var a,b,c,d=this._hue,e=this._saturation,f=this._value,g=Math.min(5,Math.floor(6*d)),h=6*d-g,i=f*(1-e),j=f*(1-h*e),k=f*(1-(1-h)*e);switch(g){case 0:a=f,b=k,c=i;break;case 1:a=j,b=f,c=i;break;case 2:a=i,b=f,c=k;break;case 3:a=i,b=j,c=f;break;case 4:a=k,b=i,c=f;break;case 5:a=f,b=i,c=j}return new ONECOLOR.RGB(a,b,c,this._alpha)},hsl:function(){var a,b=(2-this._saturation)*this._value,c=this._saturation*this._value,d=1>=b?b:2-b;return a=1e-9>d?0:c/d,new ONECOLOR.HSL(this._hue,a,b/2,this._alpha)},fromRgb:function(){var a,b=this._red,c=this._green,d=this._blue,e=Math.max(b,c,d),f=Math.min(b,c,d),g=e-f,h=0===e?0:g/e,i=e;if(0===g)a=0;else switch(e){case b:a=(c-d)/g/6+(d>c?1:0);break;case c:a=(d-b)/g/6+1/3;break;case d:a=(b-c)/g/6+2/3}return new ONECOLOR.HSV(a,h,i,this._alpha)}}),installColorSpace("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var a,b=2*this._lightness,c=this._saturation*(1>=b?b:2-b);return a=1e-9>b+c?0:2*c/(b+c),new ONECOLOR.HSV(this._hue,a,(b+c)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}}),installColorSpace("CMYK",["cyan","magenta","yellow","black","alpha"],{rgb:function(){return new ONECOLOR.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,g=1;return a||b||c?(g=Math.min(d,Math.min(e,f)),d=(d-g)/(1-g),e=(e-g)/(1-g),f=(f-g)/(1-g)):g=1,new ONECOLOR.CMYK(d,e,f,g,this._alpha)}}),ONECOLOR.installMethod("clearer",function(a){return this.alpha(isNaN(a)?-.1:-a,!0)}),ONECOLOR.installMethod("darken",function(a){return this.lightness(isNaN(a)?-.1:-a,!0)}),ONECOLOR.installMethod("desaturate",function(a){return this.saturation(isNaN(a)?-.1:-a,!0)}),ONECOLOR.installMethod("greyscale",gs),ONECOLOR.installMethod("grayscale",gs),ONECOLOR.installMethod("lighten",function(a){return this.lightness(isNaN(a)?.1:a,!0)}),ONECOLOR.installMethod("mix",function(a,b){a=ONECOLOR(a).rgb(),b=1-(isNaN(b)?.5:b);var c=2*b-1,d=this._alpha-a._alpha,e=((-1===c*d?c:(c+d)/(1+c*d))+1)/2,f=1-e,g=this.rgb();return new ONECOLOR.RGB(g._red*e+a._red*f,g._green*e+a._green*f,g._blue*e+a._blue*f,g._alpha*b+a._alpha*(1-b))}),ONECOLOR.installMethod("negate",function(){var a=this.rgb();return new ONECOLOR.RGB(1-a._red,1-a._green,1-a._blue,this._alpha)}),ONECOLOR.installMethod("opaquer",function(a){return this.alpha(isNaN(a)?.1:a,!0)}),ONECOLOR.installMethod("rotate",function(a){return this.hue((a||0)/360,!0)}),ONECOLOR.installMethod("saturate",function(a){return this.saturation(isNaN(a)?.1:a,!0)}),ONECOLOR.installMethod("toAlpha",function(a){var b=this.rgb(),c=ONECOLOR(a).rgb(),d=1e-10,e=new ONECOLOR.RGB(0,0,0,b._alpha),f=["_red","_green","_blue"];return f.forEach(function(a){e[a]=b[a]<d?b[a]:b[a]>c[a]?(b[a]-c[a])/(1-c[a]):b[a]>c[a]?(c[a]-b[a])/c[a]:0}),b._alpha=e._red>e._green?e._red>e._blue?e._red:e._blue:e._green>e._blue?e._green: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)}),function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.elemutils=b()}(this,function(){function a(a,b,c){var d=document.createElement(a);return d.className=b,c.appendChild(d),d}function b(a){var b=Array.prototype.slice,c=b.apply(arguments,[1]);return function(){return a.apply(null,c.concat(b.apply(arguments)))}}function c(a,b,c,f){var g=j(a,c),h=d(b,g),i=e("text",g,f);return{label:h,input:i}}function d(b,c){var d=a("label","",c);return d.innerHTML=b,d}function e(b,c,d){var e=a("input","",c);return e.type=b,d&&(e.maxLength=d),e}function f(a,b){a.style.left=i(100*b,0,100)+"%"}function g(a,b){a.style.top=i(100*b,0,100)+"%"}function h(a,b){a.style.background=b}function i(a,b,c){return Math.min(Math.max(a,b),c)}var j=b(a,"div");return{clamp:i,e:a,div:j,partial:b,labelInput:c,X:f,Y:g,BG:h}}),function(a,b){"function"==typeof define&&define.amd?define(["./elemutils","./drag"],b):a.colorjoeextras=b(a.elemutils,a.drag)}(this,function(a,b){function c(b){var c=a.div("currentColorContainer",b),d=a.div("currentColor",c);return{change:function(b){a.BG(d,b.cssa())}}}function d(b,c,d){function e(){var a=[f];m.forEach(function(b){a.push(b.e.input.value/g)}),k||a.push(c.getAlpha()),c.set(a)}var f=d.space,g=d.limit||255,h=d.fix>=0?d.fix:0,i=(""+g).length+h;i=h?i+1:i;var j=f.split(""),k="A"==f[f.length-1];if(f=k?f.slice(0,-1):f,["RGB","HSL","HSV","CMYK"].indexOf(f)<0)return console.warn("Invalid field names",f);var l=a.div("colorFields",b),m=j.map(function(b){b=b.toLowerCase();var c=a.labelInput("color "+b,b,l,i);return c.input.onkeyup=e,{name:b,e:c}});return{change:function(a){m.forEach(function(b){b.e.input.value=(a[b.name]()*g).toFixed(h)})}}}function e(c,d){function e(b){var c=a.clamp(b.y,0,1);a.Y(b.pointer,c),d.setAlpha(1-c)}var f=b.slider({parent:c,"class":"oned alpha",cbs:{begin:e,change:e}});return{change:function(b){a.Y(f.pointer,1-b.alpha())}}}function f(b,c,d){var e=a.labelInput("hex",d.label||"",b,7);return e.input.value="#",e.input.onkeyup=function(a){var b=a.keyCode||a.which,d=a.target.value;d="#"==d[0]?d:"#"+d,d=h(d,7,"0"),13==b&&c.set(d)},e.input.onblur=function(a){c.set(a.target.value)},{change:function(a){e.input.value="#"==e.input.value[0]?"#":"",e.input.value+=a.hex().slice(1)}}}function g(b,c,d){var e=a.e("a",d["class"]||"close",b);e.href="#",e.innerHTML=d.label||"Close",e.onclick=function(a){a.preventDefault(),c.hide()}}function h(a,b,c){for(var d=a,e=a.length;b>e;e++)d+=c;return d}return{currentColor:c,fields:d,hex:f,alpha:e,close:g}});
+function ONECOLOR(a){if("[object Array]"===Object.prototype.toString.apply(a)){if("string"==typeof a[0]&&"function"==typeof ONECOLOR[a[0]])return new ONECOLOR[a[0]](a.slice(1,a.length));if(4===a.length)return new ONECOLOR.RGB(a[0]/255,a[1]/255,a[2]/255,a[3]/255)}else if("string"==typeof a){var b=a.toLowerCase();namedColors[b]&&(a="#"+namedColors[b]),"transparent"===b&&(a="rgba(0,0,0,0)");var c=a.match(cssColorRegExp);if(c){var d=c[1].toUpperCase(),e=undef(c[8])?c[8]:parseFloat(c[8]),f="H"===d[0],g=c[3]?100:f?360:255,h=c[5]||f?100:255,i=c[7]||f?100:255;if(undef(ONECOLOR[d]))throw new Error("one.color."+d+" is not installed.");return new ONECOLOR[d](parseFloat(c[2])/g,parseFloat(c[4])/h,parseFloat(c[6])/i,e)}a.length<6&&(a=a.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var j=a.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(j)return new ONECOLOR.RGB(parseInt(j[1],16)/255,parseInt(j[2],16)/255,parseInt(j[3],16)/255)}else if("object"==typeof a&&a.isColor)return a;return!1}function installColorSpace(a,b,c){function d(a,b){var c={};c[b.toLowerCase()]=new Function("return this.rgb()."+b.toLowerCase()+"();"),ONECOLOR[b].propertyNames.forEach(function(a){c[a]=c["black"===a?"k":a[0]]=new Function("value","isDelta","return this."+b.toLowerCase()+"()."+a+"(value, isDelta);")});for(var d in c)c.hasOwnProperty(d)&&void 0===ONECOLOR[a].prototype[d]&&(ONECOLOR[a].prototype[d]=c[d])}ONECOLOR[a]=new Function(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"alpha"!==a}).map(function(a){return"isNaN("+a+")"}).join("||")+"){"+'throw new Error("['+a+']: Invalid color: ("+'+b.join('+","+')+'+")");}'+b.map(function(a){return"hue"===a?"this._hue=hue<0?hue-Math.floor(hue):hue%1":"alpha"===a?"this._alpha=(isNaN(alpha)||alpha>1)?1:(alpha<0?0:alpha);":"this._"+a+"="+a+"<0?0:("+a+">1?1:"+a+")"}).join(";")+";"),ONECOLOR[a].propertyNames=b;var e=ONECOLOR[a].prototype;["valueOf","hex","hexa","css","cssa"].forEach(function(b){e[b]=e[b]||("RGB"===a?e.hex:new Function("return this.rgb()."+b+"();"))}),e.isColor=!0,e.equals=function(c,d){undef(d)&&(d=1e-10),c=c[a.toLowerCase()]();for(var e=0;e<b.length;e+=1)if(Math.abs(this["_"+b[e]]-c["_"+b[e]])>d)return!1;return!0},e.toJSON=new Function("return ['"+a+"', "+b.map(function(a){return"this._"+a},this).join(", ")+"];");for(var f in c)if(c.hasOwnProperty(f)){var g=f.match(/^from(.*)$/);g?ONECOLOR[g[1].toUpperCase()].prototype[a.toLowerCase()]=c[f]:e[f]=c[f]}e[a.toLowerCase()]=function(){return this},e.toString=new Function('return "[one.color.'+a+':"+'+b.map(function(a,c){return'" '+b[c]+'="+this._'+a}).join("+")+'+"]";'),b.forEach(function(a){e[a]=e["black"===a?"k":a[0]]=new Function("value","isDelta","if (typeof value === 'undefined') {return this._"+a+";"+"}"+"if (isDelta) {"+"return new this.constructor("+b.map(function(b){return"this._"+b+(a===b?"+value":"")}).join(", ")+");"+"}"+"return new this.constructor("+b.map(function(b){return a===b?"value":"this._"+b}).join(", ")+");")}),installedColorSpaces.forEach(function(b){d(a,b),d(b,a)}),installedColorSpaces.push(a)}function gs(){var a=this.rgb(),b=.3*a._red+.59*a._green+.11*a._blue;return new ONECOLOR.RGB(b,b,b,this._alpha)}!function(a,b){"function"==typeof define&&define.amd?define(b):a.drag=b()}(this,function(){function a(a,b){return a?(g()?h(a,b,"touchstart","touchmove","touchend"):h(a,b,"mousedown","mousemove","mouseup"),void 0):(console.warn("drag is missing elem!"),void 0)}function b(b){var c=e(b["class"]||"",b.parent),f=e("pointer",c);return e("shape shape1",f),e("shape shape2",f),e("bg bg1",c),e("bg bg2",c),a(c,d(b.cbs,f)),{background:c,pointer:f}}function c(b){var c=e(b["class"],b.parent),f=e("pointer",c);return e("shape",f),e("bg",c),a(c,d(b.cbs,f)),{background:c,pointer:f}}function d(a,b){function c(a){return function(c){c.pointer=b,a(c)}}var d={};for(var e in a)d[e]=c(a[e]);return d}function e(a,b){return f("div",a,b)}function f(a,b,c){var d=document.createElement(a);return b&&(d.className=b),c.appendChild(d),d}function g(){return"undefined"!=typeof window.ontouchstart}function h(a,b,c,d,e){var f=!1;b=k(b);var g=b.begin,h=b.change,l=b.end;i(a,c,function(b){function c(){f=!1,j(document,d,k),j(document,e,c),n(l,a,b)}f=!0;var k=o(n,h,a);i(document,d,k),i(document,e,c),n(g,a,b)})}function i(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)}function j(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)}function k(a){if(a)return{begin:a.begin||m,change:a.change||m,end:a.end||m};var b,c;return{begin:function(a){b={x:a.elem.offsetLeft,y:a.elem.offsetTop},c=a.cursor},change:function(a){l(a.elem,"left",b.x+a.cursor.x-c.x+"px"),l(a.elem,"top",b.y+a.cursor.y-c.y+"px")},end:m}}function l(a,b,c){a.style[b]=c}function m(){}function n(a,b,c){c.preventDefault();var d=p(b),e=b.clientWidth,f=b.clientHeight,g={x:q(b,c),y:r(b,c)},h=(g.x-d.x)/e,i=(g.y-d.y)/f;a({x:isNaN(h)?0:h,y:isNaN(i)?0:i,cursor:g,elem:b,e:c})}function o(a){var b=Array.prototype.slice,c=b.apply(arguments,[1]);return function(){return a.apply(null,c.concat(b.apply(arguments)))}}function p(a){var b=0,c=0;if(a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return{x:b,y:c}}function q(a,b){if(t(a)){var c=parseInt(u(document.body,"marginLeft"),10)-s(a,"scrollLeft")+window.pageXOffset+a.style.marginLeft;return b.clientX-c}return b.pageX?b.pageX:b.clientX?b.clientX+document.body.scrollLeft:void 0}function r(a,b){if(t(a)){var c=parseInt(u(document.body,"marginTop"),10)-s(a,"scrollTop")+window.pageYOffset+a.style.marginTop;return b.clientY-c}return b.pageY?b.pageY:b.clientY?b.clientY+document.body.scrollTop:void 0}function s(a,b){for(var c=0;"HTML"!=a.nodeName;)c+=a[b],a=a.parentNode;return c}function t(a){for(;"HTML"!=a.nodeName&&"fixed"!=v(a,"position");)a=a.parentNode;return"HTML"==a.nodeName?!1:!0}function u(a,b){return a.currentStyle?a.currentStyle[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,"")[b]:a.style[b]}function v(a,b){var c;return c=window.getComputedStyle?window.getComputedStyle(a,null):a.currentStyle,c[b]}return a.xyslider=b,a.slider=c,a});var installedColorSpaces=[],namedColors={},undef=function(a){return"undefined"==typeof a},channelRegExp=/\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,alphaChannelRegExp=/\s*(\.\d+|\d+(?:\.\d+)?)\s*/,cssColorRegExp=new RegExp("^(rgb|hsl|hsv)a?\\("+channelRegExp.source+","+channelRegExp.source+","+channelRegExp.source+"(?:,"+alphaChannelRegExp.source+")?"+"\\)$","i");ONECOLOR.installMethod=function(a,b){installedColorSpaces.forEach(function(c){ONECOLOR[c].prototype[a]=b})},installColorSpace("RGB",["red","green","blue","alpha"],{hex:function(){var a=(65536*Math.round(255*this._red)+256*Math.round(255*this._green)+Math.round(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-a.length)+a},hexa:function(){var a=Math.round(255*this._alpha).toString(16);return"#"+"00".substr(0,2-a.length)+a+this.hex().substr(1,6)},css:function(){return"rgb("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+")"},cssa:function(){return"rgba("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+","+this._alpha+")"}}),"undefined"!=typeof module?module.exports=ONECOLOR:"function"!=typeof define||undef(define.amd)?"undefined"!=typeof jQuery&&undef(jQuery.color)?jQuery.color=ONECOLOR:(one=window.one||{},one.color=ONECOLOR):define([],function(){return ONECOLOR}),namedColors={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"},installColorSpace("XYZ",["x","y","z","alpha"],{fromRgb:function(){var a=function(a){return 100*(a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92)},b=a(this._red),c=a(this._green),d=a(this._blue);return new ONECOLOR.XYZ(.4124*b+.3576*c+.1805*d,.2126*b+.7152*c+.0722*d,.0193*b+.1192*c+.9505*d,this._alpha)},rgb:function(){var a=this._x/100,b=this._y/100,c=this._z/100,d=function(a){return a>.0031308?1.055*Math.pow(a,1/2.4)-.055:12.92*a};return new ONECOLOR.RGB(d(3.2406*a+-1.5372*b+c*-.4986),d(a*-.9689+1.8758*b+.0415*c),d(.0557*a+b*-.204+1.057*c),this._alpha)},lab:function(){var a=function(a){return a>.008856?Math.pow(a,1/3):7.787037*a+4/29},b=a(this._x/95.047),c=a(this._y/100),d=a(this._z/108.883);return new ONECOLOR.LAB(116*c-16,500*(b-c),200*(c-d),this._alpha)}}),installColorSpace("LAB",["l","a","b","alpha"],{fromRgb:function(){return this.xyz().lab()},rgb:function(){return this.xyz().rgb()},xyz:function(){var a=function(a){var b=Math.pow(a,3);return b>.008856?b:(a-16/116)/7.87},b=(this._l+16)/116,c=this._a/500+b,d=b-this._b/200;return new ONECOLOR.XYZ(95.047*a(c),100*a(b),108.883*a(d),this._alpha)}}),installColorSpace("HSV",["hue","saturation","value","alpha"],{rgb:function(){var a,b,c,d=this._hue,e=this._saturation,f=this._value,g=Math.min(5,Math.floor(6*d)),h=6*d-g,i=f*(1-e),j=f*(1-h*e),k=f*(1-(1-h)*e);switch(g){case 0:a=f,b=k,c=i;break;case 1:a=j,b=f,c=i;break;case 2:a=i,b=f,c=k;break;case 3:a=i,b=j,c=f;break;case 4:a=k,b=i,c=f;break;case 5:a=f,b=i,c=j}return new ONECOLOR.RGB(a,b,c,this._alpha)},hsl:function(){var a,b=(2-this._saturation)*this._value,c=this._saturation*this._value,d=1>=b?b:2-b;return a=1e-9>d?0:c/d,new ONECOLOR.HSL(this._hue,a,b/2,this._alpha)},fromRgb:function(){var a,b=this._red,c=this._green,d=this._blue,e=Math.max(b,c,d),f=Math.min(b,c,d),g=e-f,h=0===e?0:g/e,i=e;if(0===g)a=0;else switch(e){case b:a=(c-d)/g/6+(d>c?1:0);break;case c:a=(d-b)/g/6+1/3;break;case d:a=(b-c)/g/6+2/3}return new ONECOLOR.HSV(a,h,i,this._alpha)}}),installColorSpace("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var a,b=2*this._lightness,c=this._saturation*(1>=b?b:2-b);return a=1e-9>b+c?0:2*c/(b+c),new ONECOLOR.HSV(this._hue,a,(b+c)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}}),installColorSpace("CMYK",["cyan","magenta","yellow","black","alpha"],{rgb:function(){return new ONECOLOR.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,g=1;return a||b||c?(g=Math.min(d,Math.min(e,f)),d=(d-g)/(1-g),e=(e-g)/(1-g),f=(f-g)/(1-g)):g=1,new ONECOLOR.CMYK(d,e,f,g,this._alpha)}}),ONECOLOR.installMethod("clearer",function(a){return this.alpha(isNaN(a)?-.1:-a,!0)}),ONECOLOR.installMethod("darken",function(a){return this.lightness(isNaN(a)?-.1:-a,!0)}),ONECOLOR.installMethod("desaturate",function(a){return this.saturation(isNaN(a)?-.1:-a,!0)}),ONECOLOR.installMethod("greyscale",gs),ONECOLOR.installMethod("grayscale",gs),ONECOLOR.installMethod("lighten",function(a){return this.lightness(isNaN(a)?.1:a,!0)}),ONECOLOR.installMethod("mix",function(a,b){a=ONECOLOR(a).rgb(),b=1-(isNaN(b)?.5:b);var c=2*b-1,d=this._alpha-a._alpha,e=((-1===c*d?c:(c+d)/(1+c*d))+1)/2,f=1-e,g=this.rgb();return new ONECOLOR.RGB(g._red*e+a._red*f,g._green*e+a._green*f,g._blue*e+a._blue*f,g._alpha*b+a._alpha*(1-b))}),ONECOLOR.installMethod("negate",function(){var a=this.rgb();return new ONECOLOR.RGB(1-a._red,1-a._green,1-a._blue,this._alpha)}),ONECOLOR.installMethod("opaquer",function(a){return this.alpha(isNaN(a)?.1:a,!0)}),ONECOLOR.installMethod("rotate",function(a){return this.hue((a||0)/360,!0)}),ONECOLOR.installMethod("saturate",function(a){return this.saturation(isNaN(a)?.1:a,!0)}),ONECOLOR.installMethod("toAlpha",function(a){var b=this.rgb(),c=ONECOLOR(a).rgb(),d=1e-10,e=new ONECOLOR.RGB(0,0,0,b._alpha),f=["_red","_green","_blue"];return f.forEach(function(a){e[a]=b[a]<d?b[a]:b[a]>c[a]?(b[a]-c[a])/(1-c[a]):b[a]>c[a]?(c[a]-b[a])/c[a]:0}),b._alpha=e._red>e._green?e._red>e._blue?e._red:e._blue:e._green>e._blue?e._green: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)}),function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.elemutils=b()}(this,function(){function a(a,b,c){var d=document.createElement(a);return d.className=b,c.appendChild(d),d}function b(a){var b=Array.prototype.slice,c=b.apply(arguments,[1]);return function(){return a.apply(null,c.concat(b.apply(arguments)))}}function c(a,b,c,f){var g=j(a,c),h=d(b,g),i=e("text",g,f);return{label:h,input:i}}function d(b,c){var d=a("label","",c);return d.innerHTML=b,d}function e(b,c,d){var e=a("input","",c);return e.type=b,d&&(e.maxLength=d),e}function f(a,b){a.style.left=i(100*b,0,100)+"%"}function g(a,b){a.style.top=i(100*b,0,100)+"%"}function h(a,b){a.style.background=b}function i(a,b,c){return Math.min(Math.max(a,b),c)}var j=b(a,"div");return{clamp:i,e:a,div:j,partial:b,labelInput:c,X:f,Y:g,BG:h}}),function(a,b){"function"==typeof define&&define.amd?define(["./elemutils","./drag"],b):a.colorjoeextras=b(a.elemutils,a.drag)}(this,function(a,b){function c(b){var c=a.div("currentColorContainer",b),d=a.div("currentColor",c);return{change:function(b){a.BG(d,b.cssa())}}}function d(b,c,d){function e(){var a=[f];m.forEach(function(b){a.push(b.e.input.value/g)}),k||a.push(c.getAlpha()),c.set(a)}var f=d.space,g=d.limit||255,h=d.fix>=0?d.fix:0,i=(""+g).length+h;i=h?i+1:i;var j=f.split(""),k="A"==f[f.length-1];if(f=k?f.slice(0,-1):f,["RGB","HSL","HSV","CMYK"].indexOf(f)<0)return console.warn("Invalid field names",f);var l=a.div("colorFields",b),m=j.map(function(b){b=b.toLowerCase();var c=a.labelInput("color "+b,b,l,i);return c.input.onkeyup=e,{name:b,e:c}});return{change:function(a){m.forEach(function(b){b.e.input.value=(a[b.name]()*g).toFixed(h)})}}}function e(c,d){function e(b){var c=a.clamp(b.y,0,1);a.Y(b.pointer,c),d.setAlpha(1-c)}var f=b.slider({parent:c,"class":"oned alpha",cbs:{begin:e,change:e}});return{change:function(b){a.Y(f.pointer,1-b.alpha())}}}function f(b,c,d){var e=a.labelInput("hex",d.label||"",b,7);return e.input.value="#",e.input.onkeyup=function(a){var b=a.keyCode||a.which,d=a.target.value;d="#"==d[0]?d:"#"+d,d=h(d,7,"0"),13==b&&c.set(d)},e.input.onblur=function(a){c.set(a.target.value)},{change:function(a){e.input.value="#"==e.input.value[0]?"#":"",e.input.value+=a.hex().slice(1)}}}function g(b,c,d){var e=a.e("a",d["class"]||"close",b);e.href="#",e.innerHTML=d.label||"Close",e.onclick=function(a){a.preventDefault(),c.hide()}}function h(a,b,c){for(var d=a,e=a.length;b>e;e++)d+=c;return d}return{currentColor:c,fields:d,hex:f,alpha:e,close:g}}),function(a,b){"function"==typeof define&&define.amd?define(["./onecolor","./drag","./elemutils","./extras"],b):a.colorjoe=b(a.ONECOLOR,a.drag,a.elemutils,a.colorjoeextras)}(this,function(a,b,c,d){function e(b,d){c.BG(b,new a.HSV(d,1,1).cssa())}function f(a){function d(a){q=k.xy(q,{x:c.clamp(a.x,0,1),y:c.clamp(a.y,0,1)},n,o),f()}function e(a){q=k.z(q,c.clamp(a.y,0,1),n,o),f()}function f(a){a=l(a)?a:[];for(var b,c=r.change,d=0,e=c.length;e>d;d++)b=c[d],-1==a.indexOf(b.name)&&b.fn(q)}function i(){if(!p.equals(q)){for(var a=0,b=r.done.length;b>a;a++)r.done[a].fn(q);p=q}}if(!a.e)return console.warn("colorjoe: missing element");var j=m(a.e)?document.getElementById(a.e):a.e;j.className="colorPicker";var k=a.cbs,n=b.xyslider({parent:j,"class":"twod",cbs:{begin:d,change:d,end:i}}),o=b.slider({parent:j,"class":"oned",cbs:{begin:e,change:e,end:i}}),p=g(a.color),q=k.init(p,n,o),r={change:[],done:[]},s={e:j,update:function(a){return f(a),this},hide:function(){return j.style.display="none",this},show:function(){return j.style.display="",this},get:function(){return q},set:function(a){var b=this.get();return q=k.init(g(a),n,o),b.equals(q)||this.update(),this},getAlpha:function(){return q.alpha()},setAlpha:function(a){return q=q.alpha(a),this.update(),this},on:function(a,b,c){return"change"==a||"done"==a?r[a].push({name:c,fn:b}):console.warn('Passed invalid evt name "'+a+'" to colorjoe.on'),this},removeAllListeners:function(a){if(a)delete r[a];else for(var b in r)delete r[b];return this}};return h(j,s,a.extras),f(),s}function g(b){if(!n(b))return a("black");if(b.isColor)return b;var c=a(b);return c?c:(n(b)&&console.warn("Passed invalid color to colorjoe, using black instead"),a("black"))}function h(a,b,d){if(d){var e,f,g,h=c.div("extras",a);d.forEach(function(a,c){if(l(a)?(f=a[0],g=a.length>1?a[1]:{}):(f=a,g={}),extra=f in q._extras?q._extras[f]:null){e=extra(h,i(b,f+c),g);for(var d in e)b.on(d,e[d],f)}})}}function i(a,b){var c=j(a);return c.update=function(){a.update([b])},c}function j(a){var b={};for(var c in a)b[c]=a[c];return b}function k(a,b){return b.map(a).filter(p).length==b.length}function l(a){return"[object Array]"===Object.prototype.toString.call(a)}function m(a){return"string"==typeof a}function n(a){return"undefined"!=typeof a}function o(a){return"function"==typeof a}function p(a){return a}var q=function(a){return k(o,[a.init,a.xy,a.z])?function(b,c,d){return f({e:b,color:c,cbs:a,extras:d})}:console.warn("colorjoe: missing cb")};q.rgb=q({init:function(b,c,d){var e=a(b).hsl();return this.xy(e,{x:e.saturation(),y:1-e.value()},c,d),this.z(e,e.hue(),c,d),e},xy:function(a,b,d){return c.X(d.pointer,b.x),c.Y(d.pointer,b.y),a.saturation(b.x).value(1-b.y)},z:function(a,b,d,f){return c.Y(f.pointer,b),e(d.background,b),a.hue(b)}}),q.hsl=q({init:function(b,c,d){var e=a(b).hsl();return this.xy(e,{x:e.hue(),y:1-e.saturation()},c,d),this.z(e,1-e.lightness(),c,d),e},xy:function(a,b,d,f){return c.X(d.pointer,b.x),c.Y(d.pointer,b.y),e(f.background,b.x),a.hue(b.x).saturation(1-b.y)},z:function(a,b,d,e){return c.Y(e.pointer,b),a.lightness(1-b)}}),q._extras={},q.registerExtra=function(a,b){a in q._extras&&console.warn('Extra "'+a+'"has been registered already!'),q._extras[a]=b};for(var r in d)q.registerExtra(r,d[r]);return q});
View
2 package.json
@@ -2,7 +2,7 @@
"name": "colorjoe",
"description": "Scaleable color picker",
"author": "Juho Vepsalainen <bebraw@gmail.com>",
- "version": "0.7.2",
+ "version": "0.8.0",
"dependencies": {
"drag.js": "0.3.8",
"onecolor": "2.3.4",

0 comments on commit 5087d62

Please sign in to comment.
Something went wrong with that request. Please try again.