😎 Give your xaringan slides some style
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

542 lines
40KB

  1. <!DOCTYPE html>
  2. <!-- Generated by pkgdown: do not edit by hand --><html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  8. <title>Xaringan CSS Theme Generator • xaringanthemer</title>
  9. <!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
  10. <link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
  11. <link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
  12. <link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
  13. <link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
  14. <link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
  15. <script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  16. <link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet">
  17. <script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/IBM_Plex_Mono-0.4.9/font.css" rel="stylesheet">
  18. <link href="../deps/Outfit-0.4.9/font.css" rel="stylesheet">
  19. <link href="../deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet">
  20. <link href="../deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet">
  21. <script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
  22. <meta property="og:title" content="Xaringan CSS Theme Generator">
  23. <meta name="robots" content="noindex">
  24. </head>
  25. <body>
  26. <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
  27. <nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
  28. <a class="navbar-brand me-2" href="../index.html">xaringanthemer</a>
  29. <small class="nav-text text-danger me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="In-development version">0.4.2.9000</small>
  30. <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
  31. <span class="navbar-toggler-icon"></span>
  32. </button>
  33. <div id="navbar" class="collapse navbar-collapse ms-3">
  34. <ul class="navbar-nav me-auto">
  35. <li class="active nav-item"><a class="nav-link" href="../articles/xaringanthemer.html">Features</a></li>
  36. <li class="nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
  37. <li class="nav-item dropdown">
  38. <button class="nav-link dropdown-toggle" type="button" id="dropdown-themes" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Themes</button>
  39. <ul class="dropdown-menu" aria-labelledby="dropdown-themes">
  40. <li><h6 class="dropdown-header" data-toc-skip>Themes</h6></li>
  41. <li><a class="dropdown-item" href="../articles/themes.html">Slide Themes</a></li>
  42. <li><a class="dropdown-item" href="../articles/ggplot2-themes.html">ggplot2 Themes</a></li>
  43. <li><hr class="dropdown-divider"></li>
  44. <li><h6 class="dropdown-header" data-toc-skip>More Customization</h6></li>
  45. <li><a class="dropdown-item" href="../articles/fonts.html">Fonts</a></li>
  46. <li><a class="dropdown-item" href="../articles/template-variables.html">Template Variables</a></li>
  47. </ul>
  48. </li>
  49. </ul>
  50. <ul class="navbar-nav">
  51. <li class="nav-item dropdown">
  52. <button class="nav-link dropdown-toggle" type="button" id="dropdown-" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true"><span class="fa far fa-newspaper fa-lg"></span> </button>
  53. <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdown-">
  54. <li><a class="external-link dropdown-item" href="https://garrickadenbuie.com/blog/xaringanthemer-v0-3-0/">xaringanthemer 0.3.0</a></li>
  55. <li><hr class="dropdown-divider"></li>
  56. <li><a class="dropdown-item" href="../news/index.html">Changelog</a></li>
  57. </ul>
  58. </li>
  59. <li class="nav-item"><a class="external-link nav-link" href="https://github.com/gadenbuie/xaringanthemer"><span class="fa fab fa-github fa-lg"></span></a></li>
  60. <li class="nav-item"><a class="external-link nav-link" href="https://twitter.com/grrrck"><span class="fa fab fa-twitter fa-lg"></span></a></li>
  61. <li class="nav-item"><a class="external-link nav-link" href="https://www.garrickadenbuie.com"><span class="fa fas fa-home fa-lg"></span></a></li>
  62. </ul>
  63. </div>
  64. </div>
  65. </nav><div class="container template-article">
  66. <div class="row">
  67. <main id="main" class="col-md-9"><div class="page-header">
  68. <img src="../logo.png" class="logo" alt=""><h1>Xaringan CSS Theme Generator</h1>
  69. <small class="dont-index">Source: <a href="https://github.com/gadenbuie/xaringanthemer/blob/main/vignettes/xaringanthemer.Rmd" class="external-link"><code>vignettes/xaringanthemer.Rmd</code></a></small>
  70. <div class="d-none name"><code>xaringanthemer.Rmd</code></div>
  71. </div>
  72. <style type="text/css">
  73. img { max-width: 100%; }
  74. </style>
  75. <p>Jump to: <a href="#quick-intro">Quick Intro</a>, <a href="#themes">Themes</a>, <a href="#theme-settings">Theme Settings</a>,
  76. <a href="#fonts">Fonts</a>, <a href="#colors">Colors</a>, <a href="#adding-custom-css">Adding Custom CSS</a></p>
  77. <div class="section level2">
  78. <h2 id="quick-intro">Quick Intro<a class="anchor" aria-label="anchor" href="#quick-intro"></a>
  79. </h2>
  80. <!-- Set link to theme-settings, template-variables, theme functions -->
  81. <p>First, add the <code>xaringan-themer.css</code> file to the YAML
  82. header of your xaringan slides.</p>
  83. <div class="sourceCode" id="cb1"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">output</span><span class="kw">:</span></span>
  84. <span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a><span class="at"> xaringan:</span><span class="fu">:moon_reader</span><span class="kw">:</span></span>
  85. <span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a><span class="at"> </span><span class="fu">css</span><span class="kw">:</span><span class="at"> xaringan-themer.css</span></span></code></pre></div>
  86. <p>Then, in a hidden chunk just after the knitr setup chunk, load
  87. <strong>xaringanthemer</strong> and try one of the <a href="#themes">theme functions</a>.</p>
  88. <div class="sourceCode" id="cb2"><pre class="sourceCode markdown"><code class="sourceCode markdown"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="in">```{r xaringan-themer, include=FALSE, warning=FALSE}</span></span>
  89. <span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a><span class="in">library(xaringanthemer)</span></span>
  90. <span id="cb2-3"><a href="#cb2-3" tabindex="-1"></a><span class="in">style_mono_accent(</span></span>
  91. <span id="cb2-4"><a href="#cb2-4" tabindex="-1"></a><span class="in"> base_color = "#1c5253",</span></span>
  92. <span id="cb2-5"><a href="#cb2-5" tabindex="-1"></a><span class="in"> header_font_google = google_font("Josefin Sans"),</span></span>
  93. <span id="cb2-6"><a href="#cb2-6" tabindex="-1"></a><span class="in"> text_font_google = google_font("Montserrat", "300", "300i"),</span></span>
  94. <span id="cb2-7"><a href="#cb2-7" tabindex="-1"></a><span class="in"> code_font_google = google_font("Fira Mono")</span></span>
  95. <span id="cb2-8"><a href="#cb2-8" tabindex="-1"></a><span class="in">)</span></span>
  96. <span id="cb2-9"><a href="#cb2-9" tabindex="-1"></a><span class="in">```</span></span></code></pre></div>
  97. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent_1c5253.png" alt="Example title and normal slides using a green xaringanthemer theme" data-external="1"></p>
  98. <div class="section level3">
  99. <h3 id="matching-ggplot-themes">Matching ggplot Themes<a class="anchor" aria-label="anchor" href="#matching-ggplot-themes"></a>
  100. </h3>
  101. <p><strong>xaringanthemer</strong> even provides a [ggplot2] theme with
  102. <code><a href="../reference/theme_xaringan.html">theme_xaringan()</a></code> that uses the colors and fonts from your
  103. slide theme. Built on the <a href="https://github.com/yixuan/showtext" class="external-link">showtext</a> package, and
  104. designed to work seamlessly with <a href="https://fonts.google.com" class="external-link">Google Fonts</a>.</p>
  105. <p>Color and fill scales are also provided for matching sequential color
  106. scales based on the primary color used in your slides. See
  107. <code><a href="../reference/scale_xaringan.html">?scale_xaringan</a></code> for more details.</p>
  108. <p>More details and examples can be found in
  109. <code><a href="../articles/ggplot2-themes.html">vignette("ggplot2-themes")</a></code>.</p>
  110. <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
  111. <code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://ggplot2.tidyverse.org" class="external-link">ggplot2</a></span><span class="op">)</span></span>
  112. <span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html" class="external-link">ggplot</a></span><span class="op">(</span><span class="va">diamonds</span><span class="op">)</span> <span class="op">+</span></span>
  113. <span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html" class="external-link">aes</a></span><span class="op">(</span><span class="va">cut</span>, fill <span class="op">=</span> <span class="va">cut</span><span class="op">)</span> <span class="op">+</span></span>
  114. <span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html" class="external-link">geom_bar</a></span><span class="op">(</span>show.legend <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span> <span class="op">+</span></span>
  115. <span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/labs.html" class="external-link">labs</a></span><span class="op">(</span></span>
  116. <span> x <span class="op">=</span> <span class="st">"Cut"</span>,</span>
  117. <span> y <span class="op">=</span> <span class="st">"Count"</span>,</span>
  118. <span> title <span class="op">=</span> <span class="st">"A Fancy diamonds Plot"</span></span>
  119. <span> <span class="op">)</span> <span class="op">+</span></span>
  120. <span> <span class="fu"><a href="../reference/theme_xaringan.html">theme_xaringan</a></span><span class="op">(</span>background_color <span class="op">=</span> <span class="st">"#FFFFFF"</span><span class="op">)</span> <span class="op">+</span></span>
  121. <span> <span class="fu"><a href="../reference/scale_xaringan.html">scale_xaringan_fill_discrete</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
  122. <p><img src="../reference/figures/index-theme_xaringan_demo-1.png"></p>
  123. </div>
  124. <div class="section level3">
  125. <h3 id="tab-completion">Tab Completion<a class="anchor" aria-label="anchor" href="#tab-completion"></a>
  126. </h3>
  127. <p><strong>xaringanthemer</strong> is <kbd>Tab</kbd> friendly – <a href="#theme-settings">use autocomplete to explore</a> the <a href="template-variables.html">template variables</a> that you can
  128. adjust in each of the themes!</p>
  129. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example-rstudio-completion.gif" alt="Demonstration of argument auto-completion with RStudio" data-external="1"></p>
  130. </div>
  131. <div class="section level3">
  132. <h3 id="r-markdown-template-in-rstudio">R Markdown Template in RStudio<a class="anchor" aria-label="anchor" href="#r-markdown-template-in-rstudio"></a>
  133. </h3>
  134. <p>You can also skip the above and just create a <em>Ninja Themed
  135. Presentation</em> from the New R Markdown Document menu in RStudio.</p>
  136. <center>
  137. <img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/rmarkdown-template-screenshot.png" alt="The 'New R Markdown Document' menu in RStudio" data-external="1">
  138. </center>
  139. </div>
  140. </div>
  141. <div class="section level2">
  142. <h2 id="themes">Themes<a class="anchor" aria-label="anchor" href="#themes"></a>
  143. </h2>
  144. <p><strong>xaringanthemer</strong> includes a number of functions that
  145. provide themed <strong>xaringan</strong> styles. All of the styling
  146. functions start with the <code>style_</code> prefix.</p>
  147. <p>The goal of each style function is to quickly set up a coordinated
  148. color palette for your slides based on one or two starter colors. Styles
  149. based on one color start with <code>style_mono_</code> and styles based
  150. on two colors start with <code>style_duo_</code>. How the starter colors
  151. are used is described in the final portion of the style function name.
  152. For example, <code><a href="../reference/style_mono_accent.html">style_mono_accent()</a></code> uses a single color as an
  153. accent color.</p>
  154. <p>Note that the colors used below are for demonstration only, the point
  155. of the <code>style_</code> functions is for you to choose your own color
  156. palette!</p>
  157. <p>If your color palette uses more than two colors, you can add
  158. additional colors with the <code>colors</code> argument. See the <a href="#colors">Colors</a> section for more information.</p>
  159. <div class="section level3">
  160. <h3 id="monotone">Monotone<a class="anchor" aria-label="anchor" href="#monotone"></a>
  161. </h3>
  162. <p>Use these functions to automatically create a consistent color
  163. palette for your slides, based around a single color.</p>
  164. <div class="section level4">
  165. <h4 id="style_mono_light">
  166. <code>style_mono_light()</code><a class="anchor" aria-label="anchor" href="#style_mono_light"></a>
  167. </h4>
  168. <p>A light theme based around a single color.</p>
  169. <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
  170. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>base_color <span class="op">=</span> <span class="st">"#23395b"</span><span class="op">)</span></span></code></pre></div>
  171. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_light.png" data-external="1"></p>
  172. </div>
  173. <div class="section level4">
  174. <h4 id="style_mono_dark">
  175. <code>style_mono_dark()</code><a class="anchor" aria-label="anchor" href="#style_mono_dark"></a>
  176. </h4>
  177. <p>A dark theme based around a single color.</p>
  178. <div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
  179. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_mono_dark.html">style_mono_dark</a></span><span class="op">(</span>base_color <span class="op">=</span> <span class="st">"#cbf7ed"</span><span class="op">)</span></span></code></pre></div>
  180. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_dark.png" data-external="1"></p>
  181. </div>
  182. <div class="section level4">
  183. <h4 id="style_mono_accent">
  184. <code>style_mono_accent()</code><a class="anchor" aria-label="anchor" href="#style_mono_accent"></a>
  185. </h4>
  186. <p>The default xaringan theme with a single color used for color accents
  187. on select elements (headers, bold text, etc.).</p>
  188. <div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
  189. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_mono_accent.html">style_mono_accent</a></span><span class="op">(</span>base_color <span class="op">=</span> <span class="st">"#43418A"</span><span class="op">)</span></span></code></pre></div>
  190. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent.png" data-external="1"></p>
  191. </div>
  192. <div class="section level4">
  193. <h4 id="style_mono_accent_inverse">
  194. <code>style_mono_accent_inverse()</code><a class="anchor" aria-label="anchor" href="#style_mono_accent_inverse"></a>
  195. </h4>
  196. <p>An “inverted” default xaringan theme with a single color used for
  197. color accents on select elements (headers, bold text, etc.).</p>
  198. <div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
  199. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_mono_accent_inverse.html">style_mono_accent_inverse</a></span><span class="op">(</span>base_color <span class="op">=</span> <span class="st">"#3C989E"</span><span class="op">)</span></span></code></pre></div>
  200. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent_inverse.png" data-external="1"></p>
  201. </div>
  202. </div>
  203. <div class="section level3">
  204. <h3 id="duotone">Duotone<a class="anchor" aria-label="anchor" href="#duotone"></a>
  205. </h3>
  206. <p>These themes build from two (ideally) complementary colors.</p>
  207. <div class="section level4">
  208. <h4 id="style_duo">
  209. <code>style_duo()</code><a class="anchor" aria-label="anchor" href="#style_duo"></a>
  210. </h4>
  211. <p>A two-colored theme based on a primary and secondary color.</p>
  212. <div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
  213. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_duo.html">style_duo</a></span><span class="op">(</span>primary_color <span class="op">=</span> <span class="st">"#1F4257"</span>, secondary_color <span class="op">=</span> <span class="st">"#F97B64"</span><span class="op">)</span></span></code></pre></div>
  214. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo.png" data-external="1"></p>
  215. </div>
  216. <div class="section level4">
  217. <h4 id="style_duo_accent">
  218. <code>style_duo_accent()</code><a class="anchor" aria-label="anchor" href="#style_duo_accent"></a>
  219. </h4>
  220. <p>The default Xaringan theme with two accent colors.</p>
  221. <div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
  222. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_duo_accent.html">style_duo_accent</a></span><span class="op">(</span>primary_color <span class="op">=</span> <span class="st">"#035AA6"</span>, secondary_color <span class="op">=</span> <span class="st">"#03A696"</span><span class="op">)</span></span></code></pre></div>
  223. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent.png" data-external="1"></p>
  224. </div>
  225. <div class="section level4">
  226. <h4 id="style_duo_accent_inverse">
  227. <code>style_duo_accent_inverse()</code><a class="anchor" aria-label="anchor" href="#style_duo_accent_inverse"></a>
  228. </h4>
  229. <p>An “inverted” default Xaringan theme with two accent colors.</p>
  230. <div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
  231. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_duo_accent_inverse.html">style_duo_accent_inverse</a></span><span class="op">(</span>primary_color <span class="op">=</span> <span class="st">"#035AA6"</span>, secondary_color <span class="op">=</span> <span class="st">"#03A696"</span><span class="op">)</span></span></code></pre></div>
  232. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent_inverse.png" data-external="1"></p>
  233. </div>
  234. </div>
  235. <div class="section level3">
  236. <h3 id="solarized">Solarized<a class="anchor" aria-label="anchor" href="#solarized"></a>
  237. </h3>
  238. <p>There are also two themes based around the <a href="https://ethanschoonover.com/solarized/" class="external-link">solarized color
  239. palette</a>, <code><a href="../reference/style_solarized_light.html">style_solarized_light()</a></code> and
  240. <code><a href="../reference/style_solarized_dark.html">style_solarized_dark()</a></code>. For both themes, it is advisted to
  241. change the syntax highlighting theme to <code>solarized-light</code> or
  242. <code>solarized-dark</code> (looks great paired or constrasted).</p>
  243. <div class="section level4">
  244. <h4 id="style_solarized_light">
  245. <code>style_solarized_light()</code><a class="anchor" aria-label="anchor" href="#style_solarized_light"></a>
  246. </h4>
  247. <div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
  248. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_solarized_light.html">style_solarized_light</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
  249. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_light.png" data-external="1"></p>
  250. </div>
  251. <div class="section level4">
  252. <h4 id="style_solarized_dark">
  253. <code>style_solarized_dark()</code><a class="anchor" aria-label="anchor" href="#style_solarized_dark"></a>
  254. </h4>
  255. <div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
  256. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_solarized_dark.html">style_solarized_dark</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
  257. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_dark.png" data-external="1"></p>
  258. <p>To do this, your YAML header should look more-or-less like this:</p>
  259. <div class="sourceCode" id="cb13"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb13-1"><a href="#cb13-1" tabindex="-1"></a><span class="fu">output</span><span class="kw">:</span></span>
  260. <span id="cb13-2"><a href="#cb13-2" tabindex="-1"></a><span class="at"> xaringan:</span><span class="fu">:moon_reader</span><span class="kw">:</span></span>
  261. <span id="cb13-3"><a href="#cb13-3" tabindex="-1"></a><span class="at"> </span><span class="fu">css</span><span class="kw">:</span><span class="at"> </span><span class="kw">[</span><span class="st">"xaringan-themer.css"</span><span class="kw">]</span></span>
  262. <span id="cb13-4"><a href="#cb13-4" tabindex="-1"></a><span class="at"> </span><span class="fu">nature</span><span class="kw">:</span></span>
  263. <span id="cb13-5"><a href="#cb13-5" tabindex="-1"></a><span class="at"> </span><span class="fu">highlightStyle</span><span class="kw">:</span><span class="at"> solarized-dark</span></span>
  264. <span id="cb13-6"><a href="#cb13-6" tabindex="-1"></a><span class="at"> </span><span class="fu">highlightLines</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
  265. <span id="cb13-7"><a href="#cb13-7" tabindex="-1"></a><span class="at"> </span><span class="fu">countIncrementalSlides</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span></span></code></pre></div>
  266. </div>
  267. </div>
  268. </div>
  269. <div class="section level2">
  270. <h2 id="theme-settings">Theme Settings<a class="anchor" aria-label="anchor" href="#theme-settings"></a>
  271. </h2>
  272. <p>The theme functions listed above are just wrappers around the central
  273. function of this package, <code><a href="../reference/style_xaringan.html">style_xaringan()</a></code>. If you want to
  274. start from the default <strong>xaringan</strong> theme and make a few
  275. modifications, start there.</p>
  276. <p>All of the theme template variables are repeated in each of the theme
  277. functions (instead of relying on <code>...</code>) so that you can use
  278. autocompletion to find and change the defaults for any theme function.
  279. To override the default value of any theme functions, set the
  280. appropriate argument in the theme function. A table of all template
  281. variables is included in <a href="template-variables.html"><code>vignette("template-variables", "xaringanthemer")</code></a>.</p>
  282. <p>As an example, try loading <code>xaringanthemer</code>, type out
  283. <code>style_duo_theme(</code> and then press <kbd>Tab</kbd> to see all
  284. of the theme options.</p>
  285. <p>All of the theme options are named so that you first think of the
  286. element you want to change, then the property of that element.</p>
  287. <p>Here are some of the <code>text_</code> theme options:</p>
  288. <ul>
  289. <li><code>text_color</code></li>
  290. <li><code>text_bold_color</code></li>
  291. <li><code>text_slide_number_color</code></li>
  292. <li><code>text_font_size</code></li>
  293. <li><code>text_slide_number_font_size</code></li>
  294. <li><em>and more …</em></li>
  295. </ul>
  296. <p>And here are the title slide theme options:</p>
  297. <ul>
  298. <li><code>title_slide_text_color</code></li>
  299. <li><code>title_slide_background_color</code></li>
  300. <li><code>title_slide_background_image</code></li>
  301. <li><code>title_slide_background_size</code></li>
  302. <li><code>title_slide_background_position</code></li>
  303. </ul>
  304. </div>
  305. <div class="section level2">
  306. <h2 id="fonts">Fonts<a class="anchor" aria-label="anchor" href="#fonts"></a>
  307. </h2>
  308. <!-- Need to set [adding-custom-css] -->
  309. <p><link href="https://fonts.googleapis.com/css2?family=Cabin:wght@600&amp;family=Noto+Sans&amp;display=swap" rel="stylesheet"></p>
  310. <style type="text/css">
  311. .cabin {
  312. font-family: Cabin;
  313. font-weight: 600
  314. }
  315. .noto-sans {
  316. font-family: 'Noto Sans';
  317. }
  318. .font-preview {
  319. padding: 1em;
  320. margin-top: 1em;
  321. margin-bottom: 1em;
  322. border: 1px solid #dddddd;
  323. border-radius: 3px;
  324. font-size: 1.25em;
  325. }
  326. </style>
  327. <div class="section level3">
  328. <h3 id="default-fonts">Default Fonts<a class="anchor" aria-label="anchor" href="#default-fonts"></a>
  329. </h3>
  330. <p>The default heading and body fonts used in
  331. <strong>xaringanthemer</strong> are different than the xaringan default
  332. fonts. In xaringanthemer, <a href="https://fonts.google.com/specimen/Cabin" class="external-link">Cabin</a> is used for
  333. headings and <a href="https://fonts.google.com/specimen/Noto+Sans" class="external-link">Noto
  334. Sans</a> for body text.</p>
  335. <div class="font-preview">
  336. <p style="font-size: 1.5em" class="cabin">
  337. A Cabin in the Clearing
  338. </p>
  339. <p class="noto-sans">
  340. Pack my box with five dozen liquor jugs. Amazingly few discotheques
  341. provide jukeboxes.
  342. </p>
  343. </div>
  344. <p>These fonts are easier to read on screens and at a distance during
  345. presentations, and they support a wide variety of languages and weights.
  346. Another reason for the change is that the xaringan (remarkjs) default
  347. body font, <em>Droid Serif</em>, is no longer officially included in
  348. Google Fonts.</p>
  349. <p>If you would like to use the fonts from the <a href="https://slides.yihui.org/xaringan/" class="external-link">default xaringan theme</a>,
  350. you can use the following arguments in your style function.</p>
  351. <div class="sourceCode" id="cb14"><pre class="downlit sourceCode r">
  352. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_xaringan.html">style_xaringan</a></span><span class="op">(</span></span>
  353. <span> text_font_family <span class="op">=</span> <span class="st">"Droid Serif"</span>,</span>
  354. <span> text_font_url <span class="op">=</span> <span class="st">"https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic"</span>,</span>
  355. <span> header_font_google <span class="op">=</span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"Yanone Kaffeesatz"</span><span class="op">)</span></span>
  356. <span><span class="op">)</span></span></code></pre></div>
  357. </div>
  358. <div class="section level3">
  359. <h3 id="custom-and-google-font-fonts">Custom and <em>Google Font</em> Fonts<a class="anchor" aria-label="anchor" href="#custom-and-google-font-fonts"></a>
  360. </h3>
  361. <p><strong>xaringanthemer</strong> makes it easy to use <a href="https://fonts.google.com" class="external-link">Google Fonts</a> in your presentations
  362. (provided you have an internet connection during the presentation) or to
  363. fully specify your font files.</p>
  364. <p>To use <a href="https://fonts.google.com" class="external-link">Google Fonts</a>, set the
  365. <code>&lt;type&gt;_font_google</code> theme arguments –
  366. <code>text_font_google</code>, <code>header_font_google</code>,
  367. <code>code_font_google</code> — using the <code><a href="../reference/google_font.html">google_font()</a></code>
  368. helper. The help documentation in <code><a href="../reference/google_font.html">?google_font</a></code> provides
  369. more info.</p>
  370. <div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
  371. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span></span>
  372. <span> header_font_google <span class="op">=</span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"Josefin Slab"</span>, <span class="st">"600"</span><span class="op">)</span>,</span>
  373. <span> text_font_google <span class="op">=</span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"Work Sans"</span>, <span class="st">"300"</span>, <span class="st">"300i"</span><span class="op">)</span>,</span>
  374. <span> code_font_google <span class="op">=</span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"IBM Plex Mono"</span><span class="op">)</span></span>
  375. <span><span class="op">)</span></span></code></pre></div>
  376. <p>If you set an <code>&lt;type&gt;_font_google</code> theme arguments,
  377. then <code>&lt;type&gt;_font_family</code>,
  378. <code>&lt;type&gt;_font_weight</code> and
  379. <code>&lt;type&gt;_font_url</code> are overwritten – where
  380. <code>&lt;type&gt;</code> is one of <code>header</code>,
  381. <code>text</code>, or <code>code</code>.</p>
  382. <p>To use a font hosted outside of Google fonts, you need to provide
  383. both <code>&lt;type&gt;_font_family</code> and
  384. <code>&lt;type&gt;_font_url</code>. For example, suppose you want to use
  385. a code font with ligatures for your code chunks, such as <a href="https://github.com/tonsky/FiraCode" class="external-link">Fira Code</a>, which would be
  386. declared with <code>code_font_family</code>. The <a href="https://github.com/tonsky/FiraCode#browser-support" class="external-link">browser
  387. usage</a> section of the Fira Code README provides a CSS URL to be used
  388. with an <code>@import</code> statement that you can use with the
  389. <code>code_font_url</code> argument.</p>
  390. <div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
  391. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_solarized_dark.html">style_solarized_dark</a></span><span class="op">(</span></span>
  392. <span> code_font_family <span class="op">=</span> <span class="st">"Fira Code"</span>,</span>
  393. <span> code_font_url <span class="op">=</span> <span class="st">"https://cdn.jsdelivr.net/gh/tonsky/FiraCode@2/distr/fira_code.css"</span></span>
  394. <span><span class="op">)</span></span></code></pre></div>
  395. <p>Remember that you need to supply either
  396. <code>&lt;type&gt;_google_font</code> using the
  397. <code><a href="../reference/google_font.html">google_font()</a></code> helper <em>or both</em>
  398. <code>&lt;type&gt;_font_family</code> and
  399. <code>&lt;type&gt;_font_url</code>.</p>
  400. </div>
  401. <div class="section level3">
  402. <h3 id="using-additional-fonts">Using Additional Fonts<a class="anchor" aria-label="anchor" href="#using-additional-fonts"></a>
  403. </h3>
  404. <p>If you want to use additional fonts for use in <a href="#adding-custom-css">custom CSS definitions</a>, use the
  405. <code>extra_fonts</code> argument to pass a list of URLs or
  406. <code><a href="../reference/google_font.html">google_font()</a></code>s. Notice that you will need to add custom CSS
  407. (for example, via <code>extra_css</code>) to use the fonts imported in
  408. <code>extra_fonts</code>.</p>
  409. <div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
  410. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span></span>
  411. <span> extra_fonts <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
  412. <span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"Sofia"</span><span class="op">)</span>,</span>
  413. <span> <span class="co"># Young Serif by uplaod.fr</span></span>
  414. <span> <span class="st">"https://cdn.jsdelivr.net/gh/uplaod/YoungSerif/fonts/webfonts/fontface.css"</span>,</span>
  415. <span> <span class="op">)</span>,</span>
  416. <span> extra_css <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
  417. <span> <span class="st">".title-slide h2"</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span><span class="st">"font-family"</span> <span class="op">=</span> <span class="st">"Sofia"</span><span class="op">)</span>,</span>
  418. <span> blockquote <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span><span class="st">"font-family"</span> <span class="op">=</span> <span class="st">"youngserifregular"</span><span class="op">)</span></span>
  419. <span> <span class="op">)</span></span>
  420. <span><span class="op">)</span></span></code></pre></div>
  421. </div>
  422. </div>
  423. <div class="section level2">
  424. <h2 id="colors">Colors<a class="anchor" aria-label="anchor" href="#colors"></a>
  425. </h2>
  426. <p>When designing your xaringan theme, you may have additional colors in
  427. your desired color palette beyond those used in the accent colors of the
  428. mono and duotone styles.</p>
  429. <p>The <code>style*()</code> functions in xaringanthemer include a
  430. <code>colors</code> argument that lets you quickly define additional
  431. colors to use in your slides. This argument takes a vector of named
  432. colors</p>
  433. <div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
  434. <code class="sourceCode R"><span><span class="va">colors</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span></span>
  435. <span> red <span class="op">=</span> <span class="st">"#f34213"</span>,</span>
  436. <span> purple <span class="op">=</span> <span class="st">"#3e2f5b"</span>,</span>
  437. <span> orange <span class="op">=</span> <span class="st">"#ff8811"</span>,</span>
  438. <span> green <span class="op">=</span> <span class="st">"#136f63"</span>,</span>
  439. <span> white <span class="op">=</span> <span class="st">"#FFFFFF"</span></span>
  440. <span><span class="op">)</span></span></code></pre></div>
  441. <p>and creates CSS classes from the color name that set the text color —
  442. e.g. <code>.red</code> — or that set the background color —
  443. e.g. <code>.bg-red</code>. If you use custom CSS in your slides, the
  444. color name is also stored in a CSS variable —
  445. e.g. <code>var(--red)</code>.</p>
  446. <p>So slide text like this</p>
  447. <div class="sourceCode" id="cb19"><pre class="sourceCode markdown"><code class="sourceCode markdown"><span id="cb19-1"><a href="#cb19-1" tabindex="-1"></a>This **.red[simple]** .white.bg-purple<span class="co">[</span><span class="ot">demo</span><span class="co">]</span> </span>
  448. <span id="cb19-2"><a href="#cb19-2" tabindex="-1"></a>_.orange[shows]_ the colors .green<span class="co">[</span><span class="ot">in action</span><span class="co">]</span>.</span></code></pre></div>
  449. <p>will be rendered in HTML as</p>
  450. <blockquote>
  451. This <strong><span style="color: #f34213">simple</span></strong> <span style="color:#FFFFFF;background-color:#3e2f5b;">demo</span>
  452. <em style="color:#ff8811">shows</em> the colors <span style="color:#136f63">in action</span>.
  453. </blockquote>
  454. <p>Note that the color names in <code>colors</code> need to be valid CSS
  455. names, so <code>"purple-light"</code> will work, but
  456. <code>"purple light"</code> will not.</p>
  457. </div>
  458. <div class="section level2">
  459. <h2 id="adding-custom-css">Adding Custom CSS<a class="anchor" aria-label="anchor" href="#adding-custom-css"></a>
  460. </h2>
  461. <p>You can also add custom CSS classes using the <code>extra_css</code>
  462. argument in the theme functions. This argument takes a named list of CSS
  463. definitions each containing a named list of CSS property-value
  464. pairs.</p>
  465. <div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
  466. <code class="sourceCode R"><span><span class="va">extra_css</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
  467. <span> <span class="st">".small"</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span><span class="st">"font-size"</span> <span class="op">=</span> <span class="st">"90%"</span><span class="op">)</span>,</span>
  468. <span> <span class="st">".full-width"</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
  469. <span> display <span class="op">=</span> <span class="st">"flex"</span>,</span>
  470. <span> width <span class="op">=</span> <span class="st">"100%"</span>,</span>
  471. <span> flex <span class="op">=</span> <span class="st">"1 1 auto"</span></span>
  472. <span> <span class="op">)</span></span>
  473. <span><span class="op">)</span></span></code></pre></div>
  474. <p>If you would rather keep your additional css definitions in a
  475. separate file, you can call <code><a href="../reference/style_extra_css.html">style_extra_css()</a></code> separately.
  476. Just be sure to include your new CSS file in the list of applied files
  477. in your YAML header.</p>
  478. <div class="sourceCode" id="cb21"><pre class="downlit sourceCode r">
  479. <code class="sourceCode R"><span><span class="fu"><a href="../reference/style_extra_css.html">style_extra_css</a></span><span class="op">(</span>css <span class="op">=</span> <span class="va">extra_css</span>, outfile <span class="op">=</span> <span class="st">"custom.css"</span><span class="op">)</span></span></code></pre></div>
  480. <div class="sourceCode" id="cb22"><pre class="sourceCode css"><code class="sourceCode css"><span id="cb22-1"><a href="#cb22-1" tabindex="-1"></a><span class="co">/* Extra CSS */</span></span>
  481. <span id="cb22-2"><a href="#cb22-2" tabindex="-1"></a><span class="fu">.small</span> {</span>
  482. <span id="cb22-3"><a href="#cb22-3" tabindex="-1"></a> <span class="kw">font-size</span><span class="ch">:</span> <span class="dv">90</span><span class="dt">%</span><span class="op">;</span></span>
  483. <span id="cb22-4"><a href="#cb22-4" tabindex="-1"></a>}</span>
  484. <span id="cb22-5"><a href="#cb22-5" tabindex="-1"></a><span class="fu">.full-width</span> {</span>
  485. <span id="cb22-6"><a href="#cb22-6" tabindex="-1"></a> <span class="kw">display</span><span class="ch">:</span> <span class="dv">flex</span><span class="op">;</span></span>
  486. <span id="cb22-7"><a href="#cb22-7" tabindex="-1"></a> <span class="kw">width</span><span class="ch">:</span> <span class="dv">100</span><span class="dt">%</span><span class="op">;</span></span>
  487. <span id="cb22-8"><a href="#cb22-8" tabindex="-1"></a> <span class="kw">flex</span><span class="ch">:</span> <span class="dv">1</span> <span class="dv">1</span> <span class="bu">auto</span><span class="op">;</span></span>
  488. <span id="cb22-9"><a href="#cb22-9" tabindex="-1"></a>}</span></code></pre></div>
  489. <p>This is most helpful when wanting to define helper classes to work
  490. with the <a href="https://github.com/gnab/remark" class="external-link">remark.js</a>
  491. <code>.class[]</code> syntax. Using the above example, we could add
  492. slide text <code>.small[in smaller font size]</code>.</p>
  493. <hr>
  494. <p><strong>xaringanthemer</strong> was built by <a href="https://www.garrickadenbuie.com" class="external-link">Garrick Aden-Buie</a> (<a href="https://twitter.com/grrrck" class="external-link">@grrrck</a>).</p>
  495. <p>Big thank you to <a href="https://yihui.org" class="external-link">Yihui Xie</a>,
  496. especially for <a href="https://github.com/yihui/xaringan" class="external-link">xaringan</a>.
  497. Also thanks to <a href="http://www.gnab.org/" class="external-link">Ole Petter Bang</a> for <a href="https://github.com/gnab/remark" class="external-link">remark.js</a>.</p>
  498. <p>Feel free to <a href="https://github.com/gadenbuie/xaringanthemer/issues" class="external-link">file an
  499. issue</a> if you find a bug or have a theme suggestion – or better yet,
  500. submit a pull request!</p>
  501. </div>
  502. </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
  503. </nav></aside>
  504. </div>
  505. <footer><div class="pkgdown-footer-left">
  506. <p>Developed by <a href="https://www.garrickadenbuie.com" class="external-link">Garrick Aden-Buie</a>.</p>
  507. </div>
  508. <div class="pkgdown-footer-right">
  509. <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.0.</p>
  510. </div>
  511. </footer>
  512. </div>
  513. <script src="../doc-versions.js"></script>
  514. </body>
  515. </html>