This ensures all colors are distinct by packing the (visible part) of the CIELAB color space with the needed number of spheres, and using their centers to generate the colors.

distinct_colors(
n,
minimal_saturation = 33,
minimal_lightness = 20,
maximal_lightness = 80
)

## Arguments

n The requested (positive) number of colors. Exclude colors whose saturation (hypot(a, b) in CIELAB color space) is less than this value (by default, 33). Exclude colors whose lightnes (l in CIELAB color space) is less than this value (by default, 20). Exclude colors whose lightnes (l in CIELAB color space) is more than this value (by default, 80).

## Value

A list with two elements, name containing the color names and lab containing a matrix with a row per color and three columns containing the l, a and b coordinates of each color.

## Examples

chameleon::distinct_colors(8)
#> $lab #> l a b #> [1,] 45.31069 16.83526 -53.526963 #> [2,] 45.31069 59.32081 -53.526963 #> [3,] 45.31069 38.07803 -16.733398 #> [4,] 45.31069 59.32081 20.060166 #> [5,] 80.00000 -68.13584 44.589209 #> [6,] 80.00000 -25.65029 -28.997920 #> [7,] 80.00000 -46.89306 7.795645 #> [8,] 80.00000 -25.65029 44.589209 #> #>$name
#> [1] "#3E67C5" "#9C3FC6" "#9B5188" "#C6314D" "#30E36E" "#4DD6FB" "#51DDB6"
#> [8] "#B3D270"
#>