class: middle, center # Styling Shiny & R Markdown with bslib & thematic ### Carson Sievert, Software Engineer @ RStudio ### Slides: https://bit.ly/noRth2020
[@cpsievert](https://twitter.com/cpsievert)
[@cpsievert](https://github.com/cpsievert)
[cpsievert.me](https://cpsievert.me)
<cpsievert1@gmail.com> <style type="text/css"> @import url(https://fonts.googleapis.com/css?family=IBM+Plex+Sans);body{font-family:IBM Plex Sans}h1,h2,h3{font-family:IBM Plex Sans}.remark-slide-content{background-color:#002B36;color:#FDF6E3}.remark-slide-content a{color:#2AA198}.remark-slide-content.darkly{background-color:#222;color:#FFF}.remark-slide-content.darkly a{color:#0CE3AC}.remark-slide-content.dark-mode{background-color:#444;color:#e4e4e4}.remark-slide-content.dark-mode a{color:#e39777}.remark-slide-content.lucid{background-color:#3D4752;color:#FFFFFF}.remark-slide-content.large{font-size:1.5rem}.remark-slide-content.contrast{background-color:#FFFFFF;color:black}.remark-slide-content.contrast a{color:#74AADB} </style> --- class: contrast, large ## New tools for styling Shiny & R Markdown __bslib__: tools for styling HTML from R (e.g., Shiny apps, `rmarkdown::html_document()`, etc) ```r remotes::install_github("rstudio/bslib") ``` __thematic__: simplified theming of R plots (e.g., **ggplot2**, **lattice**, **base**) ```r remotes::install_github("rstudio/thematic") ``` .footnote[ Documentation: <https://rstudio.github.io/bslib> <br/> <https://rstudio.github.io/thematic> ] --- class: contrast ## Running code examples #### <span style="color:red">WARNING: much of this is a work-in-progress and may change!</span> On RStudio Cloud (<https://bit.ly/thematic-cloud>) <div> <a href="https://rstudio.cloud/project/1208127" target="_blank"> <img src="thematic-cloud.svg" alt="RStudio Cloud Example" height="80px" style="display: block; margin: 0 auto;"> </a> </div> Or, locally ```r library(remotes) install_github("rstudio/shiny@demo/bslib") install_github("rstudio/rmarkdown#1706") install_github("rstudio/DT@sass") install_github("ropensci/plotly") install.packages(c('shinythemes', 'ggplot2', 'lattice')) ``` --- class: large ## Approaches to styling Shiny & R Markdown 1. __I'm just happy it works__ (accept the defaults) 2. __I want a different 'pre-packaged' look__ (**shinythemes**) 3. __I want specific fonts/colors/styles__ (custom CSS) --- class: large ## Approaches to styling Shiny & R Markdown 1. [__I'm just happy it works__ (accept the defaults)](#6) 2. __I want a different 'pre-packaged' look__ (**shinythemes**) 3. __I want specific fonts/colors/styles__ (custom CSS) --- class: contrast ### Example app with default styling .panelset[ .panel[.panel-name[Code] ```r library(shiny) ui <- navbarPage("Theming demo app", ...) ``` Imagine the `...` has a bunch of shiny UI (e.g., `selectInput()`, `sliderInput()`, `wellPanel()`, etc) ] .panel[.panel-name[Result]  ] ] --- class: large ## Approaches to styling Shiny & R Markdown 1. __I'm just happy it works__ (accept the defaults) 2. [__I want a different 'pre-packaged' look__ (**shinythemes**)](#8) 3. __I want specific fonts/colors/styles__ (custom CSS) --- class: contrast ### Flatly theme .panelset[ .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>ui <- navbarPage(<br> "Theming demo app", ..., <br> theme = <span style='background-color:#ffff7f'>shinythemes::shinytheme("flatly")</span><br>)</code> ] .panel[.panel-name[Result]  ] ] --- class: contrast ### Darkly theme .panelset[ .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>ui <- navbarPage(<br> "Theming demo app", ..., <br> theme = <span style='background-color:#ffff7f'>shinythemes::shinytheme("darkly")</span><br>)</code> ] .panel[.panel-name[Result]  ] ] --- class: contrast ### Superhero theme .panelset[ .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>ui <- navbarPage(<br> "Theming demo app", ..., <br> theme = <span style='background-color:#ffff7f'>shinythemes::shinytheme("superhero")</span><br>)</code> ] .panel[.panel-name[Result]  ] ] --- class: large ## Approaches to styling Shiny & R Markdown 1. __I'm just happy it works__ (accept the defaults) 2. __I want a different 'pre-packaged' look__ (**shinythemes**) 3. [__I want specific fonts/colors/styles__ (custom CSS)](#12) * Writing custom CSS to override styles is tedious and error prone! .footnote[ See also Joe Cheng's [recent rstudio::conf talk](https://rstudio.com/resources/rstudioconf-2020/styling-shiny-apps-with-sass-and-bootstrap-4/) ] --- class: large ## Approaches to styling Shiny & R Markdown 1. __I'm just happy it works__ (accept the defaults) 2. __I want a different 'pre-packaged' look__ (**shinythemes**) 3. [__I want specific fonts/colors/styles__ (custom CSS)](#12) * Writing custom CSS to override styles is tedious and error prone! * Instead, use __bslib__ to customize Bootstrap CSS using simple R functions. .footnote[ See also Joe Cheng's [recent rstudio::conf talk](https://rstudio.com/resources/rstudioconf-2020/styling-shiny-apps-with-sass-and-bootstrap-4/) ] --- class: contrast ### To use bslib with shiny, do: .panelset[ .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br><span style='background-color:#ffff7f'>library(bslib)</span><br><span style='background-color:#ffff7f'>shinyOptions(bslib = TRUE)</span><br><span style='background-color:#ffff7f'>bs_theme_new()</span><br>ui <- navbarPage("Theming demo app", ...)</code> This'll upgrade Bootstrap (the underlying CSS framework) from 3 to 4 ] .panel[.panel-name[Bootstrap 3] <code class ='r hljs remark-code'>library(shiny)<br>library(bslib)<br>shinyOptions(bslib = TRUE)<br>bs_theme_new(<span style='background-color:#ffff7f'>version = 3</span>)<br>ui <- navbarPage("Theming demo app", ...)</code> If, for some reason, you still want Bootstrap 3 (shiny's current default) ] .panel[.panel-name[Result]  ] ] --- class: contrast ### Like shinythemes, can specify a 'pre-packaged' theme .panelset[ .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>library(bslib)<br>shinyOptions(bslib = TRUE)<br>bs_theme_new(<span style='background-color:#ffff7f'>bootswatch = "solar"</span>)<br>ui <- navbarPage("Theming demo app", ...)</code> Meaning you can use a Bootstrap 4 only theme (e.g., solar, [sketchy](https://bootswatch.com/sketchy), [minty](https://bootswatch.com/minty), etc) ] .panel[.panel-name[Result]  ] ] --- class: contrast ### Customize the main colors .panelset[ .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>library(bslib)<br>shinyOptions(bslib = TRUE)<br>bs_theme_new()<br><span style='background-color:#ffff7f'>bs_theme_base_colors</span>(bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, fg = <span style='background-color:#EEE8D5'>"#EEE8D5"</span>)<br><span style='background-color:#ffff7f'>bs_theme_accent_colors</span>(primary = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>)<br>ui <- navbarPage("Theming demo app", ...)</code> ] .panel[.panel-name[Result]  ] ] --- class: contrast ### Customize the fonts .panelset[ .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>library(bslib)<br>shinyOptions(bslib = TRUE)<br>bs_theme_new()<br>bs_theme_base_colors(bg = "#002B36", fg = "#EEE8D5")<br>bs_theme_accent_colors(primary = "#2AA198")<br><span style='background-color:#ffff7f'>bs_theme_fonts("Fira Code")</span><br>ui <- navbarPage(<br> "Theming demo app", ...,<br><span style='background-color:#ffff7f'> tags$link(href = "https://fonts.googleapis.com/css?family=Fira+Code", rel = "stylesheet")</span><br>)</code> [See here](https://rstudio.github.io/bslib/articles/recipes.html#fonts-1) for more on how to properly import font files ] .panel[.panel-name[Result]  ] ] --- class: contrast ### 'Core' Shiny input widgets reflect bslib theme .panelset[ .panel[.panel-name[selectInput()] <br> <div align="center"> <img src="custom-select.png" width="50%" /> </div> ] .panel[.panel-name[sliderInput()] <br> <div align="center"> <img src="custom-slider.png" width="60%" /> </div> ] .panel[.panel-name[dateInput()] <br> <div align="center"> <img src="custom-date.png" width="35%" /> </div> ] .panel[.panel-name[textInput()/numericInput()] <br> <div align="center"> <img src="custom-input.png" width="50%" /> </div> ] ] --- class: contrast ### Oh no, R plots are unaware of the app's styling 😞 .panelset[ .panel[.panel-name[Result]  ] ] --- class: contrast ### thematic to the rescue! 🎉 .panelset[ .panel[.panel-name[Result]  ] .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>library(bslib)<br>shinyOptions(bslib = TRUE)<br>bs_theme_new()<br>bs_theme_base_colors(bg = "#002B36", fg = "#EEE8D5")<br>bs_theme_accent_colors(primary = "#2AA198")<br><span style='background-color:#ffff7f'>thematic::thematic_shiny()</span><br>ui <- navbarPage(<br> "Theming demo app", ...,<br> tags$link(href = "//fonts.googleapis.com/css?family=Fira+Code", rel = "stylesheet")<br>)</code> * __thematic__'s [auto-theming](https://rstudio.github.io/thematic/articles/auto.html) essentially translates CSS styles into new R defaults. It works: * Regardless of _how_ you style the Shiny app * With RStudio and R Markdown (although, custom CSS styles must come from **bslib**) ] ] --- class: contrast ### Auto colors _and fonts_! 🎉 .panelset[ .panel[.panel-name[Result]  ] .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>library(bslib)<br>shinyOptions(bslib = TRUE)<br>bs_theme_new()<br>bs_theme_base_colors(bg = "#002B36", fg = "#EEE8D5")<br>bs_theme_accent_colors(primary = "#2AA198")<br>bs_theme_fonts("Fira Code")<br>thematic::thematic_shiny(<span style='background-color:#ffff7f'>font = "auto"</span>)<br>ui <- navbarPage(<br> "Theming demo app", ...,<br> tags$link(href = "//fonts.googleapis.com/css?family=Fira+Code", rel = "stylesheet")<br>)</code> Works as long as either: 1. R can already render the font. 2. The font is Google Font (and **showtext** is installed) ] ] --- class: contrast ### Now, with bslib's 'real-time' themer ✨ .panelset[ .panel[.panel-name[Result] <br>
] .panel[.panel-name[Code] <code class ='r hljs remark-code'>library(shiny)<br>library(bslib)<br>shinyOptions(bslib = TRUE)<br>bs_theme_new()<br>thematic::thematic_shiny(font = "auto")<br><span style='background-color:#ffff7f'>bs_theme_preview</span>()</code> * `bs_theme_preview()` gives you a demo app with the real-time themer * To run any app with the themer, use `run_with_themer()` ] ] --- class: middle, center # Demo --- class: contrast ### 'Auto-theming' in R Markdown's `html_document()` <img src="html-document.svg" width="100%" > --- class: contrast ### 'Custom-theming' in non-HTML output formats <img src="tufte.svg" width="100%" > --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots The main color settings are `bg`, `fg`, `accent` (they default to `"auto"`). .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span><br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) + <br> geom_point() + <br> geom_smooth()</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-15-1.svg" width="100%" style="display: block; margin: auto;" /> ] (BTW, the values here intentionally match the CSS of my slides) --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Also specify any `font` known to R or any [Google Font](https://fonts.google.com/)<sup>1</sup> (e.g., <span style="font-family:Pacifico">Pacifico</span>) .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "<span style='background-color:#ffff7f'>Pacifico</span>"<br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) + <br> geom_point() + <br> geom_smooth()</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-17-1.svg" width="100%" style="display: block; margin: auto;" /> ] .footnote[ 1. Requires **showtext** or **ragg** to be installed, and potential other "setup" (for details, see <https://rstudio.github.io/thematic>) ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Use `font_spec()` to control other font settings (e.g., `scale`) .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font=font_spec("Pacifico", <span style='background-color:#ffff7f'>scale=2</span>)<br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) + <br> geom_point() + <br> geom_smooth()</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-19-1.svg" width="100%" style="display: block; margin: auto;" /> ] .footnote[ 1. Requires **showtext** or **ragg** to be installed, and potential other "setup" (for details, see <https://rstudio.github.io/thematic>) ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots **thematic** informs `theme()` _defaults_ (i.e., plot specific code takes priority) .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "Pacifico"<br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) + <br> geom_point() + <br> geom_smooth() + <br> theme(axis.title = element_text(color = <span style='background-color:#6C71C4;color:white'>"#6C71C4"</span>))</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-21-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots **thematic** informs `theme()` _and geom_ defaults .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#D33682;color:white'>"#D33682"</span>,<br> font = "Pacifico"<br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) + <br> geom_point(color = <span style='background-color:#586E75;color:white'>"#586E75"</span>) + <br> geom_smooth() + <br> theme(axis.title = element_text(color = <span style='background-color:#6C71C4;color:white'>"#6C71C4"</span>))</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-23-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Uses `bg`, `fg`, `accent` to construct a new default for sequential colorscales. .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "Roboto Condensed"<br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) +<br> geom_point(aes(<span style='background-color:#ffff7f'>color = cyl</span>))</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-25-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Customize with `sequential_gradient()` (here is `fg` -> `accent`) .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "Roboto Condensed",<br> <span style='background-color:#ffff7f'>sequential=sequential_gradient(1,0)</span><br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) +<br> geom_point(aes(<span style='background-color:#ffff7f'>color = cyl</span>))</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-27-1.svg" width="100%" style="display: block; margin: auto;" /> ] .footnote[ For more examples, see the [customization article](http://rstudio.github.io/thematic/articles/customize.html). ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Opt-out with `NA`. .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "Roboto Condensed",<br> <span style='background-color:#ffff7f'>sequential = NA</span><br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) +<br> geom_point(aes(color = cyl))</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-29-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Also sets qualitative colorscale defaults to [Okabe-Ito](https://jfly.uni-koeln.de/color/) (colour-blind safe) .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "Roboto Condensed"<br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) +<br> geom_point(aes(<span style='background-color:#ffff7f'>color=factor(cyl)</span>))</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-31-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Customize with any vector of color codes .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "Roboto Condensed",<br> qualitative = c(<br> <span style='background-color:#1B9E77;color:white'>"#1B9E77"</span>, <span style='background-color:#D95F02;color:white'>"#D95F02"</span>, <span style='background-color:#7570B3;color:white'>"#7570B3"</span><br> )<br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) +<br> geom_point(aes(<span style='background-color:#ffff7f'>color=factor(cyl)</span>))</code> For **ggplot2**, `qualitative` is only relevant if there are enough colors to encode the levels. ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-33-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Opt-out with `NA` .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "Roboto Condensed",<br> <span style='background-color:#ffff7f'>qualitative = NA</span><br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) +<br> geom_point(aes(<span style='background-color:#ffff7f'>color=factor(cyl)</span>))</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-35-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots [**thematic**](https://github.com/rstudio/thematic) works with **ggplot2** (and extensions) .pull-left[ <code class ='r hljs remark-code'>thematic_on(<br> bg = <span style='background-color:#002B36;color:white'>"#002B36"</span>, <br> fg = "#FDF6E3", <br> accent = <span style='background-color:#2AA198;color:white'>"#2AA198"</span>,<br> font = "Roboto Condensed"<br>)<br>library(ggplot2)<br>ggplot(mtcars, aes(wt, mpg)) +<br> <span style='background-color:#ffff7f'>ggrepel::geom_text_repel</span>(<br> aes(color = factor(cyl), label = row.names(mtcars))<br> )</code> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-37-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Also **lattice** graphics: <code class ='r hljs remark-code'><span style='background-color:#ffff7f'>lattice</span>::show.settings()</code> <img src="index_files/figure-html/unnamed-chunk-39-1.svg" width="80%" style="display: block; margin: auto;" /> --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots Also **base** graphics: ```r par(mfrow = c(1, 2)) hist(rnorm(100)) plot(rep(1:5, each = 5), rep(1:5, 5), col = 1:25, pch = 1:25) ``` <img src="index_files/figure-html/unnamed-chunk-40-1.svg" width="80%" style="display: block; margin: auto;" /> --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots ...but, for accents, you'll have to inform `col` <code class ='r hljs remark-code'>plot(cars, main = "Stopping Distance versus Speed")<br>lines(stats::lowess(cars), <span style='background-color:#ffff7f'>col = thematic_get_option("accent")</span>)</code> <img src="index_files/figure-html/unnamed-chunk-42-1.svg" width="80%" style="display: block; margin: auto;" /> --- ## [**thematic**](https://github.com/rstudio/thematic): simplified theming of R plots ...and same for sequential colorscales <code class ='r hljs remark-code'>par(mfrow = c(1, 2))<br>image(volcano)<br>image(volcano, <span style='background-color:#ffff7f'>col = thematic_get_option("sequential")</span>)</code> <img src="index_files/figure-html/unnamed-chunk-44-1.svg" width="80%" style="display: block; margin: auto;" /> --- class: large ### Summary * Use **bslib** to style HTML in Shiny & R Markdown. * Or just to simply use Bootstrap 4 (instead of 3). * Specify custom colors and fonts with `bs_theme_base_colors()`, `bs_theme_accent_colors()`, & `bs_theme_fonts()` * Even more customization is available via `bs_theme_add_variables()` * Use **thematic** for easier theming of R plots * Works with **ggplot2**, `plotly::ggplotly()`, **lattice**, and **base** R graphics. * Auto-theming (i.e., translating CSS to R defaults) works great on Shiny, but can also specify colors and fonts directly in **thematic**. --- class: center, middle ## Thank you! Any questions? ### Slides: <https://bit.ly/noRth2020> ### <https://rstudio.github.io/bslib> ### <https://rstudio.github.io/thematic>
<a href='https://twitter.com/cpsievert'>@cpsievert</a> <br />
<a href='https://github.com/cpsievert'>@cpsievert</a> <br />
<cpsievert1@gmail.com> <br />
<https://cpsievert.me/> .footnote[ <br> Slides made possible thanks to [**xaringan**](https://github.com/yihui/xaringan), [**xaringanExtra**](https://github.com/gadenbuie/xaringanExtra), and [**flair**](https://github.com/kbodwin/flair) ]