src/color.js
/*
 * Tint and shade a color.
 */
Tint and shade a color.
Tint and shade a color .
function tintShade(out, color, tint, shade) {
	var rem = 1 - tint - shade;
	if (tint + shade > 1) {
		var s = 1 / (tint + shade);
		tint *= s;
		shade *= s;
		rem = 0;
	}
	var i, a = color[3];
	for (i = 0; i < 3; i++) {
		out[i] = color[i] * rem + tint;
	}
	out[3] = a;
}
function tintShade ( out , color , tint , shade ) { var rem = 1 - tint - shade ; if ( tint + shade > 1 ) { var s = 1 / ( tint + shade ) ; tint *= s ; shade *= s ; rem = 0 ; } var i , a = color [ 3 ] ; for ( i = 0 ; i < 3 ; i ++ ) { out [ i ] = color [ i ] * rem + tint ; } out [ 3 ] = a ; }
Tint and shade a color.
Tint and shade a color .