color_palette: Color palettes matching RStudio themes

Description Usage Arguments Details Value Note Examples

Description

The function get_pal generates a palette of colors according to a provided theme. The list of available themes is returned by list_pal (see also Details). Palettes can be previewed using the function viz_pal.

Usage

1
2
3
4
5
get_pal(theme = NA, n)

list_pal()

viz_pal(pal, print.ribbon = TRUE, print.hex = FALSE)

Arguments

theme

Theme of the palette. A string corresponding to one of the 31 themes available in RStudio (see Details). If not specified, the function tries to retrieve the active theme using rstudioapi.

n

Number of colors to return. Currently limited to 5.

pal

A color palette as returned by get_pal.

print.ribbon

Logical stating whether a ribbon with the name of the palette should be added to the plot (default TRUE).

print.hex

Logical stating whether the hexadecimal code of each color should be added to the plot (default FALSE).

Details

The available themes are: Ambiance, Chaos, Chrome, Clouds, Clouds Midnight, Cobalt, Crimson Editor, Dawn, Dracula, Dreamweaver, Eclipse, Idle Fingers, Katzenmilch, Kr Theme, Material, Merbivore, Merbivore Soft, Mono Industrial, Monokai, Pastel On Dark, Solarized Dark, Solarized Light, TextMate, Tomorrow, Tomorrow Night, Tomorrow Night 80s, Tomorrow Night Blue, Tomorrow Night Bright, Twilight, Vibrant Ink and Xcode.

Value

A vector of hexadecimal colors with additional attributes.

Note

The function viz_pal is directly inspired by the function print.palette available in the package wesanderson by Karthik Ram.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
get_pal()

## End(Not run)

list_pal()
my_pal <- get_pal(theme = "Twilight")
viz_pal(my_pal, print.hex = TRUE)

par(mfrow = c(7, 5))
for(i in list_pal()) {viz_pal(get_pal(i))}

fkeck/editheme documentation built on May 29, 2019, 2:34 p.m.