dark_mode: Activate dark mode on a 'ggplot2' theme

Description Usage Arguments Value Examples

View source: R/dark_mode.R

Description

Activate dark mode on a 'ggplot2' theme

Usage

1
2
dark_mode(.theme = theme_get(), verbose = TRUE,
  force_geom_invert = FALSE)

Arguments

.theme

ggplot2 theme object

verbose

print messages (default: TRUE)

force_geom_invert

Force the inversion of geom defaults for fill and color/colour (default: FALSE)

Value

dark version of theme

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(ggplot2)

p1 <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point()

p1  # theme returned by theme_get()
p1 + dark_mode()  # activate dark mode on theme returned by theme_get()

p2 <- ggplot(iris, aes(Sepal.Width, Sepal.Length)) +
  geom_point() +
  facet_wrap(~ Species)

p2 + dark_mode(theme_minimal())  # activate dark mode on another theme

invert_geom_defaults()  # restore geom defaults to their original values

Example output

Inverted geom defaults of fill and color/colour.
To change them back, use invert_geom_defaults().

ggdark documentation built on May 2, 2019, 3:43 p.m.