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.
sc()
functionThis function stands for simplecolors. You can specify base colors
or add modifiers
And you can use it just like you’d use "red"
or "blue"
Let’s look at the base R colors. Although the terms “lightblue” and “navyblue” are common ways to talk about the lightness of blue, when we use them, the colors don’t have the same “feel” as they go light to dark.
Let’s see what it looks like with simplecolors
You could also simplify this further as sc_blue(2:4)
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
sc("blue")
= #4479E4
sc("blue5")
= #0D2659
sc("dullblue3")
= #7489B4
There are multiple ways to access palettes
sc_across()
- holding light and saturation constant (at your choosing), a palette will be built across hues in the order you specify. The palette order is created using the first letter (uppercase) of each color, or “Gy” for “grey”.sc_[color]()
there is a shortcut of sc_within()
for each of the hues, for example sc_teal()
, sc_red()
, etc.#> [1] "#29FFFF" "#00B3B3" "#006666"