function huediff(a, b) {
	let diff = Math.abs(a.hue - b.hue);
	if (diff > 180)
		diff = 360 - diff;

	return diff / 180; // returns 0 .. 1
}
// Helper for the hue, due to the wraparound
Helper for the hue, due to the wraparound
Helper for the hue due to the wraparound
function huediff(a, b) {
	let diff = Math.abs(a.hue - b.hue);
	if (diff > 180)
		diff = 360 - diff;
	return diff / 180; 
}
function huediff ( a , b ) { let diff = Math . abs ( a . hue - b . hue ) ; if ( diff > 180 ) diff = 360 - diff ; return diff / 180 ; }
Helper for the hue, due to the wraparound
Helper for the hue due to the wraparound
// returns 0 .. 1