function (obj) {
	if (obj instanceof Color) {
		return obj;
	}
	if (!(this instanceof Color)) {
		return new Color(obj);
	}

	this.valid = false;
	this.values = {
		rgb: [0, 0, 0],
		hsl: [0, 0, 0],
		hsv: [0, 0, 0],
		hwb: [0, 0, 0],
		cmyk: [0, 0, 0, 0],
		alpha: 1
	};

	// parse Color() argument
	var vals;
	if (typeof obj === 'string') {
		vals = colorString.getRgba(obj);
		if (vals) {
			this.setValues('rgb', vals);
		} else if (vals = colorString.getHsla(obj)) {
			this.setValues('hsl', vals);
		} else if (vals = colorString.getHwb(obj)) {
			this.setValues('hwb', vals);
		}
	} else if (typeof obj === 'object') {
		vals = obj;
		if (vals.r !== undefined || vals.red !== undefined) {
			this.setValues('rgb', vals);
		} else if (vals.l !== undefined || vals.lightness !== undefined) {
			this.setValues('hsl', vals);
		} else if (vals.v !== undefined || vals.value !== undefined) {
			this.setValues('hsv', vals);
		} else if (vals.w !== undefined || vals.whiteness !== undefined) {
			this.setValues('hwb', vals);
		} else if (vals.c !== undefined || vals.cyan !== undefined) {
			this.setValues('cmyk', vals);
		}
	}
}
function (obj) {
	if (obj instanceof Color) {
		return obj;
	}
	if (!(this instanceof Color)) {
		return new Color(obj);
	}

	this.valid = false;
	this.values = {
		rgb: [0, 0, 0],
		hsl: [0, 0, 0],
		hsv: [0, 0, 0],
		hwb: [0, 0, 0],
		cmyk: [0, 0, 0, 0],
		alpha: 1
	};

	// parse Color() argument
	var vals;
	if (typeof obj === 'string') {
		vals = colorString.getRgba(obj);
		if (vals) {
			this.setValues('rgb', vals);
		} else if (vals = colorString.getHsla(obj)) {
			this.setValues('hsl', vals);
		} else if (vals = colorString.getHwb(obj)) {
			this.setValues('hwb', vals);
		}
	} else if (typeof obj === 'object') {
		vals = obj;
		if (vals.r !== undefined || vals.red !== undefined) {
			this.setValues('rgb', vals);
		} else if (vals.l !== undefined || vals.lightness !== undefined) {
			this.setValues('hsl', vals);
		} else if (vals.v !== undefined || vals.value !== undefined) {
			this.setValues('hsv', vals);
		} else if (vals.w !== undefined || vals.whiteness !== undefined) {
			this.setValues('hwb', vals);
		} else if (vals.c !== undefined || vals.cyan !== undefined) {
			this.setValues('cmyk', vals);
		}
	}
}
function ( obj ) { if ( obj instanceof Color ) { return obj ; } if ( ! ( this instanceof Color ) ) { return new Color ( obj ) ; } this . valid = false ; this . values = { rgb : [ 0 , 0 , 0 ] , hsl : [ 0 , 0 , 0 ] , hsv : [ 0 , 0 , 0 ] , hwb : [ 0 , 0 , 0 ] , cmyk : [ 0 , 0 , 0 , 0 ] , alpha : 1 } ; // parse Color() argument var vals ; if ( typeof obj === 'string' ) { vals = colorString . getRgba ( obj ) ; if ( vals ) { this . setValues ( 'rgb' , vals ) ; } else if ( vals = colorString . getHsla ( obj ) ) { this . setValues ( 'hsl' , vals ) ; } else if ( vals = colorString . getHwb ( obj ) ) { this . setValues ( 'hwb' , vals ) ; } } else if ( typeof obj === 'object' ) { vals = obj ; if ( vals . r !== undefined || vals . red !== undefined ) { this . setValues ( 'rgb' , vals ) ; } else if ( vals . l !== undefined || vals . lightness !== undefined ) { this . setValues ( 'hsl' , vals ) ; } else if ( vals . v !== undefined || vals . value !== undefined ) { this . setValues ( 'hsv' , vals ) ; } else if ( vals . w !== undefined || vals . whiteness !== undefined ) { this . setValues ( 'hwb' , vals ) ; } else if ( vals . c !== undefined || vals . cyan !== undefined ) { this . setValues ( 'cmyk' , vals ) ; } } }
/* MIT license
/ * MIT license
Color constructor.