Debian Codegraph @

inst/rmarkdown/templates/legacy/skeleton/skeleton.Rmd

raw
1 ---
2 title: "Legacy theming with bslib and thematic"
3 output:
4 html_document:
5 code_folding: show
6 theme:
7 bg: "#202123"
8 fg: "#B8BCC2"
9 primary: "#EA80FC"
10 base_font:
11 google: Prompt
12 heading_font:
13 google: Proza Libre
14 version: 3
15 ---
16
17 ```{r setup, include=FALSE}
18 if (requireNamespace("thematic"))
19 thematic::thematic_rmd(font = "auto")
20 ```
21
22 ## R Markdown
23
24 This is an R Markdown document themed with [`{bslib}` package](https://rstudio.github.io/bslib/). `{bslib}` makes it easy to customize the main colors and fonts of a `html_document`, [`flexdashboard::flex_dashboard`](https://flexdashboard-pkg.netlify.app/articles/articles/theme.html), [shiny::fluidPage()](https://shiny.rstudio.com/reference/shiny/latest/fluidPage.html), or more generally any website that uses [Bootstrap](https://getbootstrap.com/) for styling. The `theme` parameter in the yaml front-matter of this Rmd document describes a [`bslib::bs_theme()`](https://rstudio.github.io/bslib/reference/bs_theme.html) object. This particular example uses Bootstrap 3 (`version: 3`), which is primarily for 'legacy' documents that would break with Bootstrap 4 or above.
25
26 ## Themed Plots {.tabset .tabset-pills}
27
28 When running this document with [`{thematic}`](https://rstudio.github.io/thematic/) installed, the `thematic::thematic_rmd(font = "auto")` effectively translates `theme` (CSS) settings to new global theming defaults for `{ggplot2}`, `{lattice}`, and `{base}` R graphics:
29
30 ### ggplot2
31
32 ```{r}
33 library(ggplot2)
34
35 ggplot(mpg, aes(displ, hwy)) +
36 geom_point() + geom_smooth()
37 ```
38
39 ### lattice
40
41 ```{r}
42 lattice::show.settings()
43 ```
44
45 ### base
46
47 ```{r}
48 plot(pressure, col = thematic::thematic_get_option("accent"))
49 ```