Lifecycle: Experimental.
Creates ggplot2 themes to match the xaringanthemer theme used in the xaringan slides that seamlessly matches the "normal" slide colors and styles.
theme_xaringan( text_color = NULL, background_color = NULL, accent_color = NULL, accent_secondary_color = NULL, css_file = NULL, ... )
| text_color | Color for text and foreground, inherits from |
|---|---|
| background_color | Color for background, inherits from
|
| accent_color | Color for titles and accents, inherits from
|
| accent_secondary_color | Color for secondary accents, inherits from
|
| css_file | Path to a xaringanthemer CSS file, from which the theme variables and values will be inferred. In general, if you use the xaringathemer defaults, you will not need to set this. This feature lets you create a ggplot2 theme for your xaringan slides, even if you have only saved your theme CSS file and you aren't creating your CSS theme with xaringanthemer in your slides' source file. |
| ... | Arguments passed on to
|
A ggplot2 theme
Other xaringanthemer ggplot2 themes:
theme_xaringan_base(),
theme_xaringan_inverse(),
theme_xaringan_set_defaults()
# Requires ggplot2 has_ggplot2 <- requireNamespace("ggplot2", quietly = TRUE) if (has_ggplot2) { # Because this is an example, we'll save the CSS to a temp file path_to_css_file <- tempfile(fileext = ".css") # Create the xaringan theme: dark blue background with teal green accents style_duo( primary_color = "#002b36", secondary_color = "#31b09e", # Using basic fonts for this example, but the plot theme will # automatically use your theme font if you use Google fonts text_font_family = "sans", header_font_family = "serif", outfile = path_to_css_file ) library(ggplot2) ggplot(iris) + aes(Petal.Length, Petal.Width) + geom_point() + ggtitle("Yet another Iris plot") + theme_xaringan() }