Color Palettes

David Gerbing

library("lessR")

The getColors() function can generate a variety of color palates. Use them to, for example, fill the bars in a histogram or bar chart with the fill parameter.

Qualitative Scales

The default is a color spectrum of 12 hcl colors presented in the order in which they are assigned to discrete levels of a categorical variable.

getColors()

Display the color spectrum of 12 hcl colors ordered by hue from 0 by intervals of 360/12 = 30 degrees.

getColors(in_order=TRUE)

Get a color wheel of 36 ordered hues around the wheel.

getColors(n=36, shape="wheel", border="off")

Obtain deep rich colors for HCL qualitative scale.

getColors(c=90, l=45)

Sequential Scales

Generate an hcl blue sequence with c=60 and vary l.

getColors("blues", labels=FALSE)

Vary chroma for a yellow hcl sequence.

getColors("browns", c=c(20,90), l=60)

Divergent Scales

Generate seven colors from rust to blue.

getColors("rusts", "blues", n=7)

Add a custom value of chroma, c, to make less saturated.

getColors("rusts", "blues", n=7, c=45)

Manual Specification of Colors

Individually specify colors.

getColors(c("black", "blue", "red"))

Generate a custom sequential range of colors.

getColors(pal="aliceblue", end_pal="blue")