getDistinctColors: Get distinct colors

Description Usage Arguments Details Value Author(s) Examples

View source: R/getDistinctColors.R

Description

Get a set of distinct colors selected from colors.

Usage

1
2
3
4
5
6
7
8
getDistinctColors(
  n,
  start.color = "blue4",
  exclude.colors = c("white", "black", "gray", "grey", "\\<yellow\\>", "yellow1",
    "lemonchiffon"),
  exclude.brightness.above = 1,
  exclude.rgb.above = 210
)

Arguments

n

Number of colors to select. If n is a character vector, length(n) will be taken as the number of colors and the colors will be named by n.

start.color

Color to start the selection process from.

exclude.colors

Character vector with colors that should not be used.

exclude.brightness.above

Exclude colors where the 'brightness' value in HSV space is above. This is useful to obtain a matt palette.

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)

ataudt/chromstaR documentation built on Dec. 26, 2021, 12:07 a.m.