😎 Give your xaringan slides some style
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

270 lines
18KB

  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>Themes • 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="Themes">
  23. </head>
  24. <body>
  25. <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
  26. <nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
  27. <a class="navbar-brand me-2" href="../index.html">xaringanthemer</a>
  28. <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">0.4.3</small>
  29. <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
  30. <span class="navbar-toggler-icon"></span>
  31. </button>
  32. <div id="navbar" class="collapse navbar-collapse ms-3">
  33. <ul class="navbar-nav me-auto">
  34. <li class="nav-item"><a class="nav-link" href="../articles/xaringanthemer.html">Features</a></li>
  35. <li class="nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
  36. <li class="active nav-item dropdown">
  37. <button class="nav-link dropdown-toggle" type="button" id="dropdown-themes" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Themes</button>
  38. <ul class="dropdown-menu" aria-labelledby="dropdown-themes">
  39. <li><h6 class="dropdown-header" data-toc-skip>Themes</h6></li>
  40. <li><a class="dropdown-item" href="../articles/themes.html">Slide Themes</a></li>
  41. <li><a class="dropdown-item" href="../articles/ggplot2-themes.html">ggplot2 Themes</a></li>
  42. <li><hr class="dropdown-divider"></li>
  43. <li><h6 class="dropdown-header" data-toc-skip>More Customization</h6></li>
  44. <li><a class="dropdown-item" href="../articles/fonts.html">Fonts</a></li>
  45. <li><a class="dropdown-item" href="../articles/template-variables.html">Template Variables</a></li>
  46. </ul>
  47. </li>
  48. </ul>
  49. <ul class="navbar-nav">
  50. <li class="nav-item dropdown">
  51. <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>
  52. <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdown-">
  53. <li><a class="external-link dropdown-item" href="https://garrickadenbuie.com/blog/xaringanthemer-v0-3-0/">xaringanthemer 0.3.0</a></li>
  54. <li><hr class="dropdown-divider"></li>
  55. <li><a class="dropdown-item" href="../news/index.html">Changelog</a></li>
  56. </ul>
  57. </li>
  58. <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>
  59. <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>
  60. <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>
  61. </ul>
  62. </div>
  63. </div>
  64. </nav><div class="container template-article">
  65. <div class="row">
  66. <main id="main" class="col-md-9"><div class="page-header">
  67. <img src="../logo.png" class="logo" alt=""><h1>Themes</h1>
  68. <small class="dont-index">Source: <a href="https://github.com/gadenbuie/xaringanthemer/blob/main/vignettes/themes.Rmd" class="external-link"><code>vignettes/themes.Rmd</code></a></small>
  69. <div class="d-none name"><code>themes.Rmd</code></div>
  70. </div>
  71. <p><strong>xaringanthemer</strong> includes a number of functions that
  72. provide themed <strong>xaringan</strong> styles. All of the styling
  73. functions start with the <code>style_</code> prefix.</p>
  74. <p>The goal of each style function is to quickly set up a coordinated
  75. color palette for your slides based on one or two starter colors. Styles
  76. based on one color start with <code>style_mono_</code> and styles based
  77. on two colors start with <code>style_duo_</code>. How the starter colors
  78. are used is described in the final portion of the style function name.
  79. For example, <code><a href="../reference/style_mono_accent.html">style_mono_accent()</a></code> uses a single color as an
  80. accent color.</p>
  81. <p>Note that the colors used below are for demonstration only, the point
  82. of the <code>style_</code> functions is for you to choose your own color
  83. palette!</p>
  84. <p>If your color palette uses more than two colors, you can add
  85. additional colors with the <code>colors</code> argument. See the <a href="#colors">Colors</a> section for more information.</p>
  86. <div class="section level3">
  87. <h3 id="monotone">Monotone<a class="anchor" aria-label="anchor" href="#monotone"></a>
  88. </h3>
  89. <p>Use these functions to automatically create a consistent color
  90. palette for your slides, based around a single color.</p>
  91. <div class="section level4">
  92. <h4 id="style_mono_light">
  93. <code>style_mono_light()</code><a class="anchor" aria-label="anchor" href="#style_mono_light"></a>
  94. </h4>
  95. <p>A light theme based around a single color.</p>
  96. <div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
  97. <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>
  98. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_light.png" data-external="1"></p>
  99. </div>
  100. <div class="section level4">
  101. <h4 id="style_mono_dark">
  102. <code>style_mono_dark()</code><a class="anchor" aria-label="anchor" href="#style_mono_dark"></a>
  103. </h4>
  104. <p>A dark theme based around a single color.</p>
  105. <div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
  106. <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>
  107. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_dark.png" data-external="1"></p>
  108. </div>
  109. <div class="section level4">
  110. <h4 id="style_mono_accent">
  111. <code>style_mono_accent()</code><a class="anchor" aria-label="anchor" href="#style_mono_accent"></a>
  112. </h4>
  113. <p>The default xaringan theme with a single color used for color accents
  114. on select elements (headers, bold text, etc.).</p>
  115. <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
  116. <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>
  117. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent.png" data-external="1"></p>
  118. </div>
  119. <div class="section level4">
  120. <h4 id="style_mono_accent_inverse">
  121. <code>style_mono_accent_inverse()</code><a class="anchor" aria-label="anchor" href="#style_mono_accent_inverse"></a>
  122. </h4>
  123. <p>An “inverted” default xaringan theme with a single color used for
  124. color accents on select elements (headers, bold text, etc.).</p>
  125. <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
  126. <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>
  127. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent_inverse.png" data-external="1"></p>
  128. </div>
  129. </div>
  130. <div class="section level3">
  131. <h3 id="duotone">Duotone<a class="anchor" aria-label="anchor" href="#duotone"></a>
  132. </h3>
  133. <p>These themes build from two (ideally) complementary colors.</p>
  134. <div class="section level4">
  135. <h4 id="style_duo">
  136. <code>style_duo()</code><a class="anchor" aria-label="anchor" href="#style_duo"></a>
  137. </h4>
  138. <p>A two-colored theme based on a primary and secondary color.</p>
  139. <div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
  140. <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>
  141. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo.png" data-external="1"></p>
  142. </div>
  143. <div class="section level4">
  144. <h4 id="style_duo_accent">
  145. <code>style_duo_accent()</code><a class="anchor" aria-label="anchor" href="#style_duo_accent"></a>
  146. </h4>
  147. <p>The default Xaringan theme with two accent colors.</p>
  148. <div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
  149. <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>
  150. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent.png" data-external="1"></p>
  151. </div>
  152. <div class="section level4">
  153. <h4 id="style_duo_accent_inverse">
  154. <code>style_duo_accent_inverse()</code><a class="anchor" aria-label="anchor" href="#style_duo_accent_inverse"></a>
  155. </h4>
  156. <p>An “inverted” default Xaringan theme with two accent colors.</p>
  157. <div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
  158. <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>
  159. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent_inverse.png" data-external="1"></p>
  160. </div>
  161. </div>
  162. <div class="section level3">
  163. <h3 id="solarized">Solarized<a class="anchor" aria-label="anchor" href="#solarized"></a>
  164. </h3>
  165. <p>There are also two themes based around the <a href="https://ethanschoonover.com/solarized/" class="external-link">solarized color
  166. palette</a>, <code><a href="../reference/style_solarized_light.html">style_solarized_light()</a></code> and
  167. <code><a href="../reference/style_solarized_dark.html">style_solarized_dark()</a></code>. For both themes, it is advisted to
  168. change the syntax highlighting theme to <code>solarized-light</code> or
  169. <code>solarized-dark</code> (looks great paired or constrasted).</p>
  170. <div class="section level4">
  171. <h4 id="style_solarized_light">
  172. <code>style_solarized_light()</code><a class="anchor" aria-label="anchor" href="#style_solarized_light"></a>
  173. </h4>
  174. <div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
  175. <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>
  176. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_light.png" data-external="1"></p>
  177. </div>
  178. <div class="section level4">
  179. <h4 id="style_solarized_dark">
  180. <code>style_solarized_dark()</code><a class="anchor" aria-label="anchor" href="#style_solarized_dark"></a>
  181. </h4>
  182. <div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
  183. <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>
  184. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_dark.png" data-external="1"></p>
  185. <p>To do this, your YAML header should look more-or-less like this:</p>
  186. <div class="sourceCode" id="cb10"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb10-1"><a href="#cb10-1" tabindex="-1"></a><span class="fu">output</span><span class="kw">:</span></span>
  187. <span id="cb10-2"><a href="#cb10-2" tabindex="-1"></a><span class="at"> xaringan:</span><span class="fu">:moon_reader</span><span class="kw">:</span></span>
  188. <span id="cb10-3"><a href="#cb10-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>
  189. <span id="cb10-4"><a href="#cb10-4" tabindex="-1"></a><span class="at"> </span><span class="fu">nature</span><span class="kw">:</span></span>
  190. <span id="cb10-5"><a href="#cb10-5" tabindex="-1"></a><span class="at"> </span><span class="fu">highlightStyle</span><span class="kw">:</span><span class="at"> solarized-dark</span></span>
  191. <span id="cb10-6"><a href="#cb10-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>
  192. <span id="cb10-7"><a href="#cb10-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>
  193. </div>
  194. </div>
  195. <div class="section level2">
  196. <h2 id="colors">Colors<a class="anchor" aria-label="anchor" href="#colors"></a>
  197. </h2>
  198. <p>When designing your xaringan theme, you may have additional colors in
  199. your desired color palette beyond those used in the accent colors of the
  200. mono and duotone styles.</p>
  201. <p>The <code>style*()</code> functions in xaringanthemer include a
  202. <code>colors</code> argument that lets you quickly define additional
  203. colors to use in your slides. This argument takes a vector of named
  204. colors</p>
  205. <div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
  206. <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>
  207. <span> red <span class="op">=</span> <span class="st">"#f34213"</span>,</span>
  208. <span> purple <span class="op">=</span> <span class="st">"#3e2f5b"</span>,</span>
  209. <span> orange <span class="op">=</span> <span class="st">"#ff8811"</span>,</span>
  210. <span> green <span class="op">=</span> <span class="st">"#136f63"</span>,</span>
  211. <span> white <span class="op">=</span> <span class="st">"#FFFFFF"</span></span>
  212. <span><span class="op">)</span></span></code></pre></div>
  213. <p>and creates CSS classes from the color name that set the text color —
  214. e.g. <code>.red</code> — or that set the background color —
  215. e.g. <code>.bg-red</code>. If you use custom CSS in your slides, the
  216. color name is also stored in a CSS variable —
  217. e.g. <code>var(--red)</code>.</p>
  218. <p>So slide text like this</p>
  219. <div class="sourceCode" id="cb12"><pre class="sourceCode markdown"><code class="sourceCode markdown"><span id="cb12-1"><a href="#cb12-1" tabindex="-1"></a>This **.red[simple]** .white.bg-purple<span class="co">[</span><span class="ot">demo</span><span class="co">]</span> </span>
  220. <span id="cb12-2"><a href="#cb12-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>
  221. <p>will be rendered in HTML as</p>
  222. <blockquote>
  223. This <strong><span style="color: #f34213">simple</span></strong> <span style="color:#FFFFFF;background-color:#3e2f5b;">demo</span>
  224. <em style="color:#ff8811">shows</em> the colors <span style="color:#136f63">in action</span>.
  225. </blockquote>
  226. <p>Note that the color names in <code>colors</code> need to be valid CSS
  227. names, so <code>"purple-light"</code> will work, but
  228. <code>"purple light"</code> will not.</p>
  229. </div>
  230. </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
  231. </nav></aside>
  232. </div>
  233. <footer><div class="pkgdown-footer-left">
  234. <p>Developed by <a href="https://www.garrickadenbuie.com" class="external-link">Garrick Aden-Buie</a>.</p>
  235. </div>
  236. <div class="pkgdown-footer-right">
  237. <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.0.</p>
  238. </div>
  239. </footer>
  240. </div>
  241. <script src="../doc-versions.js"></script>
  242. </body>
  243. </html>