 class Color
 	###
 	data type for colors
-	
+
 	eg.
 	new Color() // white
 	new Color(120,.8,.5) // defaults to hsl color
 	new Color([120,.8,.5]) // this also works
 	new Color(255,100,50,'rgb') //  color using RGB
 	new Color('#ff0000') // or hex value
-	
+
 	###
 	constructor: (x,y,z,m) ->
 		me = @
-		
+
 		if not x? and not y? and not z? and not m?
 			x = [255,0,255]
-			
+
 		if type(x) == "array" and x.length == 3
 			m ?= y
 			[x,y,z] = x
-		
+
 		if type(x) == "string"
 			m = 'hex'
-		else 
+		else
 			m ?= 'rgb'
 
 		if m == 'rgb'

	x = ill[0] * finv(sl + (a/5.0))
	z = ill[2] * finv(sl - (b/2.0))
	[x,y,z]
	
Color.xyz2rgb = (x,y,z) ->
	###
	Convert from XYZ doubles to sRGB bytes

	if r == max then h = (g - b) / (max - min)
	else if (g == max) then h = 2 + (b - r) / (max - min)
	else if (b == max) then h = 4 + (r - g) / (max - min)

	h *= 60;
	h += 360 if h < 0
	[h,s,l]

#
# L*a*b* scale by David Dalrymple
# http://davidad.net/colorviz/
#
Color.lab2xyz = (l,a,b) ->
	###
