// Generates n distinct colors. // l is the fixed lightness, the L in LAB color space. // r is the radius of the circle in AB space along which points are taken. // Documented at http://bl.ocks.org/curran/dd73d3d8925cdf50df86 define([], function (){ var lDefault = 50, rDefault = 100; return function generateColors(n, l, r){ var colors = [], a, b, θ; l = l || lDefault; r = r || rDefault; for(var i = 0; i < n; i++){ θ = (i / n) * Math.PI * 2; a = Math.sin(θ) * r; b = Math.cos(θ) * r; colors.push(d3.lab(l, a, b).toString()); } return colors; } });