Learn R Programming

chameleon (version 0.2-3)

distinct_colors: 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
)

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.

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).

Examples

Run this code
chameleon::distinct_colors(8)

Run the code above in your browser using DataLab