//>>built
define("dojo/_base/Color",["./kernel","./lang","./array","./config"],function(f,g,h,k){var b=f.Color=function(a){a&&this.setColor(a)};b.named={black:[0,0,0],silver:[192,192,192],gray:[128,128,128],white:[255,255,255],maroon:[128,0,0],red:[255,0,0],purple:[128,0,128],fuchsia:[255,0,255],green:[0,128,0],lime:[0,255,0],olive:[128,128,0],yellow:[255,255,0],navy:[0,0,128],blue:[0,0,255],teal:[0,128,128],aqua:[0,255,255],transparent:k.transparentColor||[0,0,0,0]};g.extend(b,{r:255,g:255,b:255,a:1,_set:function(a,
b,c,e){this.r=a;this.g=b;this.b=c;this.a=e},setColor:function(a){g.isString(a)?b.fromString(a,this):g.isArray(a)?b.fromArray(a,this):(this._set(a.r,a.g,a.b,a.a),a instanceof b||this.sanitize());return this},sanitize:function(){return this},toRgb:function(){return[this.r,this.g,this.b]},toRgba:function(){return[this.r,this.g,this.b,this.a]},toHex:function(){return"#"+h.map(["r","g","b"],function(a){a=this[a].toString(16);return 2>a.length?"0"+a:a},this).join("")},toCss:function(a){var b=this.r+", "+
this.g+", "+this.b;return(a?"rgba("+b+", "+this.a:"rgb("+b)+")"},toString:function(){return this.toCss(!0)}});b.blendColors=f.blendColors=function(a,d,c,e){e=e||new b;e.r=Math.round(a.r+(d.r-a.r)*c);e.g=Math.round(a.g+(d.g-a.g)*c);e.b=Math.round(a.b+(d.b-a.b)*c);e.a=a.a+(d.a-a.a)*c;return e.sanitize()};b.fromRgb=f.colorFromRgb=function(a,d){var c=a.toLowerCase().match(/^rgba?\(([\s\.,0-9]+)\)/);return c&&b.fromArray(c[1].split(/\s*,\s*/),d)};b.fromHex=f.colorFromHex=function(a,d){var c=d||new b,e=
4==a.length?4:8,f=(1<<e)-1;a=Number("0x"+a.substr(1));if(isNaN(a))return null;h.forEach(["b","g","r"],function(b){var d=a&f;a>>=e;c[b]=4==e?17*d:d});c.a=1;return c};b.fromArray=f.colorFromArray=function(a,d){var c=d||new b;c._set(Number(a[0]),Number(a[1]),Number(a[2]),Number(a[3]));isNaN(c.a)&&(c.a=1);return c.sanitize()};b.fromString=f.colorFromString=function(a,d){var c=b.named[a];return c&&b.fromArray(c,d)||b.fromRgb(a,d)||b.fromHex(a,d)};return b});
//# sourceMappingURL=Color.js.map