/*
	Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

//>>built
define("dojo/_base/Color",["./kernel","./lang","./array","./config"],function(f,g,h,l){var c=f.Color=function(a){a&&this.setColor(a)};c.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:l.transparentColor||[0,0,0,0]};g.extend(c,{r:255,g:255,b:255,a:1,_set:function(a,
d,b,e){this.r=a;this.g=d;this.b=b;this.a=e},setColor:function(a){g.isString(a)?c.fromString(a,this):g.isArray(a)?c.fromArray(a,this):(this._set(a.r,a.g,a.b,a.a),a instanceof c||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 d=this.r+", "+
this.g+", "+this.b;return(a?"rgba("+d+", "+this.a:"rgb("+d)+")"},toString:function(){return this.toCss(!0)}});c.blendColors=f.blendColors=function(a,d,b,e){e=e||new c;e.r=Math.round(a.r+(d.r-a.r)*b);e.g=Math.round(a.g+(d.g-a.g)*b);e.b=Math.round(a.b+(d.b-a.b)*b);e.a=a.a+(d.a-a.a)*b;return e.sanitize()};c.fromRgb=f.colorFromRgb=function(a,d){var b=a.toLowerCase().match(/^rgba?\(([\s\.,0-9]+)\)/);return b&&c.fromArray(b[1].split(/\s*,\s*/),d)};c.fromHex=f.colorFromHex=function(a,d){var b=d||new c,e=
4==a.length?4:8,m=(1<<e)-1;a=Number("0x"+a.substr(1));if(isNaN(a))return null;h.forEach(["b","g","r"],function(n){var k=a&m;a>>=e;b[n]=4==e?17*k:k});b.a=1;return b};c.fromArray=f.colorFromArray=function(a,d){var b=d||new c;b._set(Number(a[0]),Number(a[1]),Number(a[2]),Number(a[3]));isNaN(b.a)&&(b.a=1);return b.sanitize()};c.fromString=f.colorFromString=function(a,d){var b=c.named[a];return b&&c.fromArray(b,d)||c.fromRgb(a,d)||c.fromHex(a,d)};return c});