IN_PKGDOWN <- identical(Sys.getenv("IN_PKGDOWN"), "true")
First, add the xaringan-themer.css
file to the YAML header of your xaringan slides.
output: xaringan::moon_reader: css: xaringan-themer.css
Then, in a hidden chunk just after the knitr setup chunk, load xaringanthemer and try one of the [theme functions][theme-functions].
```r`r ""` library(xaringanthemer) style_mono_accent( base_color = "#1c5253", header_font_google = google_font("Josefin Sans"), text_font_google = google_font("Montserrat", "300", "300i"), code_font_google = google_font("Fira Mono") ) ```
xaringanthemer even provides a [ggplot2] theme
with theme_xaringan()
that uses the colors and fonts from your slide theme.
Built on the showtext package,
and designed to work seamlessly with Google Fonts.
Color and fill scales are also provided
for matching sequential color scales based on
the primary color used in your slides.
See ?scale_xaringan
for more details.
More details and examples can be found in vignette("ggplot2-themes")
.
style_mono_accent( base_color = "#1c5253", header_font_google = google_font("Josefin Sans"), text_font_google = google_font("Montserrat", "300", "300i"), code_font_google = google_font("Fira Mono"), outfile = NULL )
library(ggplot2) ggplot(diamonds) + aes(cut, fill = cut) + geom_bar(show.legend = FALSE) + labs( x = "Cut", y = "Count", title = "A Fancy diamonds Plot" ) + theme_xaringan(background_color = "#FFFFFF") + scale_xaringan_fill_discrete()
cat("![](../reference/figures/index-theme_xaringan_demo-1.png)")
xaringanthemer is Tab friendly -- [use autocomplete to explore][theme-settings] the [template variables][template-variables] that you can adjust in each of the themes!
You can also skip the above and just create a Ninja Themed Presentation from the New R Markdown Document menu in RStudio.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.