src/color.js
/*
 * Convert floating-point to normalized uint8.
 */
Convert floating-point to normalized uint8.
Convert floating - point to normalized uint8 .
function u8(x) {
	var y = Math.floor(x * 256);
	if (y >= 0) {
		if (y < 256) {
			return y;
		} else {
			return 255;
		}
	} else {
		return 0;
	}
}
function u8 ( x ) { var y = Math . floor ( x * 256 ) ; if ( y >= 0 ) { if ( y < 256 ) { return y ; } else { return 255 ; } } else { return 0 ; } }
Convert floating-point to normalized uint8.
Convert floating - point to normalized uint8 .