Get distinct colors

Share:

Description

Get a set of distinct colors selected from colors.

Usage

1
2
getDistinctColors(n, start.color = "blue4", exclude.colors = c("white",
  "black", "gray", "grey"), exclude.rgb.above = 210)

Arguments

n

Number of colors to select.

start.color

Color to start the selection process from.

exclude.colors

Character vector with colors that should not be used.

exclude.rgb.above

Exclude colors where all RGB values are above. This is useful to exclude whitish colors.

Details

The function computes the euclidian distance between all colors and iteratively selects those that have the furthest closes distance to the set of already selected colors.

Value

A character vector with colors.

Author(s)

Aaron Taudt

Examples

1
2
cols <- getDistinctColors(5)
pie(rep(1,5), labels=cols, col=cols)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.