Introduction to simplecolors

Trying to find a good color palette in R is difficult. I think most people search google for ggplot colors and end up looking at some funky image of all the color names that work in R. These colors are from the X11 colors that were developed in the 1980s. Unfortunately, they have inconsistent names and the lightness/saturation are all over the place. Using simplecolors gies you access to a smaller, consistent set of colors. It is similar to the palette tool you might be used to with Microsoft Word or Tableau.

The sc() function

This function stands for simplecolors. You can specify base colors

library(simplecolors)
sc("red", "blue", "violet")

or add modifiers

sc("brightred2", "mutedblue3", "dullviolet4")

And you can use it just like you’d use "red" or "blue"

library(ggplot2)

p <- 
  ggplot(mpg, aes(y = drv, fill = drv)) +
  geom_bar() 
p + scale_fill_manual(values = c("lightblue", "blue", "navyblue"))

p + scale_fill_manual(values = sc("blue2", "blue3", "blue4"))

You could also simplify this further as sc_blue(2:4)

Palettes

Construction

To get started there are 8 hues, 4 types of saturation, and 5 levels of lightness plus a greyscale. To use a color, just combine the 3 parts:

For example, the following code will return the corresponding colors

Palettes

There are multiple ways to access palettes

sc_within(hue = "teal", light = 3:5, sat = "bright")
#> [1] "#29FFFF" "#00B3B3" "#006666"
sc_across(palette = "OTVGy", light = 4, sat = "muted")
#> [1] "#86682D" "#2D8686" "#592D86" "#595959"

Types of outputs

There are 3 main outputs for these palettes that can be specified via return =

Using sc_within()

#> [1] "#9DB9F1" "#4479E4" "#16439C" "#0D2659"
color_name hex
blue2 #9DB9F1
blue3 #4479E4
blue4 #16439C
blue5 #0D2659

Using sc_across()

#> [1] "#E44444" "#E4AF44" "#E4E444"
color_name hex
red3 #E44444
orange3 #E4AF44
yellow3 #E4E444

Here is a list of all colors abbreviations you can use in the palette
blue green grey orange pink red teal violet yellow
B G Gy O P R T V Y

sc_red(), sc_blue(), etc…

There is also a sc_within() palette defaulted for each color

#> [1] "#FFCCCC" "#FF8F8F" "#FF2929" "#B30000"
color_name hex
blue5 #0D2659
blue4 #16439C
blue3 #4479E4
blue2 #9DB9F1

And here’s an example where you might use it in a ggplot

All colors