distinct_colors: Pick a number of distinct colors.

View source: R/chameleon.R

distinct_colorsR Documentation

Pick a number of distinct colors.

Description

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.

Usage

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

Arguments

n

The requested (positive) number of colors.

minimal_saturation

Exclude colors whose saturation (hypot(a, b) in CIELAB color space) is less than this value (by default, 33).

minimal_lightness

Exclude colors whose lightnes (l in CIELAB color space) is less than this value (by default, 20).

maximal_lightness

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)

chameleon documentation built on Sept. 27, 2022, 9:06 a.m.