😎 Give your xaringan slides some style
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

257 lines
17KB

  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.0">
  8. <title>Themes • xaringanthemer</title>
  9. <!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
  10. <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
  11. <script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
  12. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
  13. <!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
  14. <script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
  15. <meta property="og:title" content="Themes">
  16. <meta property="og:description" content="xaringanthemer">
  17. <meta name="twitter:card" content="summary">
  18. <meta name="twitter:creator" content="@grrrck">
  19. <meta name="twitter:site" content="@grrrck">
  20. <meta name="robots" content="noindex">
  21. <!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
  22. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  23. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  24. <![endif]-->
  25. </head>
  26. <body data-spy="scroll" data-target="#toc">
  27. <div class="container template-article">
  28. <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  29. <div class="container">
  30. <div class="navbar-header">
  31. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
  32. <span class="sr-only">Toggle navigation</span>
  33. <span class="icon-bar"></span>
  34. <span class="icon-bar"></span>
  35. <span class="icon-bar"></span>
  36. </button>
  37. <span class="navbar-brand">
  38. <a class="navbar-link" href="../index.html">xaringanthemer</a>
  39. <span class="version label label-danger" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.2.0.9100</span>
  40. </span>
  41. </div>
  42. <div id="navbar" class="navbar-collapse collapse">
  43. <ul class="nav navbar-nav">
  44. <li>
  45. <a href="../articles/xaringanthemer.html">Get started</a>
  46. </li>
  47. <li>
  48. <a href="../reference/index.html">Reference</a>
  49. </li>
  50. <li>
  51. <a href="../articles/themes.html">Themes</a>
  52. </li>
  53. <li>
  54. <a href="../articles/fonts.html">Fonts</a>
  55. </li>
  56. <li>
  57. <a href="../articles/template-variables.html">Template Variables</a>
  58. </li>
  59. </ul>
  60. <ul class="nav navbar-nav navbar-right">
  61. <li>
  62. <a href="../news/index.html">
  63. <span class="fa fa fa fa-newspaper-o fa-lg"></span>
  64. </a>
  65. </li>
  66. <li>
  67. <a href="https://github.com/gadenbuie/xaringanthemer">
  68. <span class="fa fa-github fa-lg"></span>
  69. </a>
  70. </li>
  71. <li>
  72. <a href="https://twitter.com/grrrck">
  73. <span class="fa fa-twitter fa-lg"></span>
  74. </a>
  75. </li>
  76. <li>
  77. <a href="https://www.garrickadenbuie.com">
  78. <span class="fa fa-home fa-lg"></span>
  79. </a>
  80. </li>
  81. </ul>
  82. </div>
  83. <!--/.nav-collapse -->
  84. </div>
  85. <!--/.container -->
  86. </div>
  87. <!--/.navbar -->
  88. </header><div class="row">
  89. <div class="col-md-9 contents">
  90. <div class="page-header toc-ignore">
  91. <h1 data-toc-skip>Themes</h1>
  92. <small class="dont-index">Source: <a href="https://github.com/gadenbuie/xaringanthemer/blob/master/vignettes/themes.Rmd"><code>vignettes/themes.Rmd</code></a></small>
  93. <div class="hidden name"><code>themes.Rmd</code></div>
  94. </div>
  95. <p><strong>xaringanthemer</strong> includes a number of functions that provide themed <strong>xaringan</strong> styles. All of the styling functions start with the <code>style_</code> prefix.</p>
  96. <p>The goal of each style function is to quickly set up a coordinated color palette for your slides based on one or two starter colors. Styles based on one color start with <code>style_mono_</code> and styles based on two colors start with <code>style_duo_</code>. How the starter colors are used is described in the final portion of the style function name. For example, <code><a href="../reference/style_mono_accent.html">style_mono_accent()</a></code> uses a single color as an accent color.</p>
  97. <p>Note that the colors used below are for demonstration only, the point of the <code>style_</code> functions is for you to choose your own color palette!</p>
  98. <p>If you color palette uses more than two colors, you can add additional colors with the <code>colors</code> argument. See the <a href="#colors">Colors</a> section for more information.</p>
  99. <div id="monotone" class="section level3">
  100. <h3 class="hasAnchor">
  101. <a href="#monotone" class="anchor"></a>Monotone</h3>
  102. <p>Use these functions to automatically create a consistent color palette for your slides, based around a single color.</p>
  103. <div id="style_mono_light" class="section level4">
  104. <h4 class="hasAnchor">
  105. <a href="#style_mono_light" class="anchor"></a><code>style_mono_light()</code>
  106. </h4>
  107. <p>A light theme based around a single color.</p>
  108. <div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span>(<span class="kw">base_color</span> <span class="kw">=</span> <span class="st">"#23395b"</span>)</pre></body></html></div>
  109. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_light.png"></p>
  110. </div>
  111. <div id="style_mono_dark" class="section level4">
  112. <h4 class="hasAnchor">
  113. <a href="#style_mono_dark" class="anchor"></a><code>style_mono_dark()</code>
  114. </h4>
  115. <p>A dark theme based around a single color.</p>
  116. <div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="fu"><a href="../reference/style_mono_dark.html">style_mono_dark</a></span>(<span class="kw">base_color</span> <span class="kw">=</span> <span class="st">"#cbf7ed"</span>)</pre></body></html></div>
  117. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_dark.png"></p>
  118. </div>
  119. <div id="style_mono_accent" class="section level4">
  120. <h4 class="hasAnchor">
  121. <a href="#style_mono_accent" class="anchor"></a><code>style_mono_accent()</code>
  122. </h4>
  123. <p>The default xaringan theme with a single color used for color accents on select elements (headers, bold text, etc.).</p>
  124. <div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="fu"><a href="../reference/style_mono_accent.html">style_mono_accent</a></span>(<span class="kw">base_color</span> <span class="kw">=</span> <span class="st">"#43418A"</span>)</pre></body></html></div>
  125. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent.png"></p>
  126. </div>
  127. <div id="style_mono_accent_inverse" class="section level4">
  128. <h4 class="hasAnchor">
  129. <a href="#style_mono_accent_inverse" class="anchor"></a><code>style_mono_accent_inverse()</code>
  130. </h4>
  131. <p>An “inverted” default xaringan theme with a single color used for color accents on select elements (headers, bold text, etc.).</p>
  132. <div class="sourceCode" id="cb4"><html><body><pre class="r"><span class="fu"><a href="../reference/style_mono_accent_inverse.html">style_mono_accent_inverse</a></span>(<span class="kw">base_color</span> <span class="kw">=</span> <span class="st">"#3C989E"</span>)</pre></body></html></div>
  133. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent_inverse.png"></p>
  134. </div>
  135. </div>
  136. <div id="duotone" class="section level3">
  137. <h3 class="hasAnchor">
  138. <a href="#duotone" class="anchor"></a>Duotone</h3>
  139. <p>These themes build from two (ideally) complementary colors.</p>
  140. <div id="style_duo" class="section level4">
  141. <h4 class="hasAnchor">
  142. <a href="#style_duo" class="anchor"></a><code>style_duo()</code>
  143. </h4>
  144. <p>A two-colored theme based on a primary and secondary color.</p>
  145. <div class="sourceCode" id="cb5"><html><body><pre class="r"><span class="fu"><a href="../reference/style_duo.html">style_duo</a></span>(<span class="kw">primary_color</span> <span class="kw">=</span> <span class="st">"#1F4257"</span>, <span class="kw">secondary_color</span> <span class="kw">=</span> <span class="st">"#F97B64"</span>)</pre></body></html></div>
  146. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo.png"></p>
  147. </div>
  148. <div id="style_duo_accent" class="section level4">
  149. <h4 class="hasAnchor">
  150. <a href="#style_duo_accent" class="anchor"></a><code>style_duo_accent()</code>
  151. </h4>
  152. <p>The default Xaringan theme with two accent colors.</p>
  153. <div class="sourceCode" id="cb6"><html><body><pre class="r"><span class="fu"><a href="../reference/style_duo_accent.html">style_duo_accent</a></span>(<span class="kw">primary_color</span> <span class="kw">=</span> <span class="st">"#006747"</span>, <span class="kw">secondary_color</span> <span class="kw">=</span> <span class="st">"#CFC493"</span>)</pre></body></html></div>
  154. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent.png"></p>
  155. </div>
  156. <div id="style_duo_accent_inverse" class="section level4">
  157. <h4 class="hasAnchor">
  158. <a href="#style_duo_accent_inverse" class="anchor"></a><code>style_duo_accent_inverse()</code>
  159. </h4>
  160. <p>An “inverted” default Xaringan theme with two accent colors.</p>
  161. <div class="sourceCode" id="cb7"><html><body><pre class="r"><span class="fu"><a href="../reference/style_duo_accent_inverse.html">style_duo_accent_inverse</a></span>(<span class="kw">primary_color</span> <span class="kw">=</span> <span class="st">"#006747"</span>, <span class="kw">secondary_color</span> <span class="kw">=</span> <span class="st">"#CFC493"</span>)</pre></body></html></div>
  162. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent_inverse.png"></p>
  163. </div>
  164. </div>
  165. <div id="solarized" class="section level3">
  166. <h3 class="hasAnchor">
  167. <a href="#solarized" class="anchor"></a>Solarized</h3>
  168. <p>There are also two themes based around the <a href="http://ethanschoonover.com/solarized">solarized color palette</a>, <code><a href="../reference/style_solarized_light.html">style_solarized_light()</a></code> and <code><a href="../reference/style_solarized_dark.html">style_solarized_dark()</a></code>. For both themes, it is advisted to change the syntax highlighting theme to <code>solarized-light</code> or <code>solarized-dark</code> (looks great paired or constrasted).</p>
  169. <div id="style_solarized_light" class="section level4">
  170. <h4 class="hasAnchor">
  171. <a href="#style_solarized_light" class="anchor"></a><code>style_solarized_light()</code>
  172. </h4>
  173. <div class="sourceCode" id="cb8"><html><body><pre class="r"><span class="fu"><a href="../reference/style_solarized_light.html">style_solarized_light</a></span>()</pre></body></html></div>
  174. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_light.png"></p>
  175. </div>
  176. <div id="style_solarized_dark" class="section level4">
  177. <h4 class="hasAnchor">
  178. <a href="#style_solarized_dark" class="anchor"></a><code>style_solarized_dark()</code>
  179. </h4>
  180. <div class="sourceCode" id="cb9"><html><body><pre class="r"><span class="fu"><a href="../reference/style_solarized_dark.html">style_solarized_dark</a></span>()</pre></body></html></div>
  181. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_dark.png"></p>
  182. <p>To do this, your YAML header should look more-or-less like this:</p>
  183. <div class="sourceCode" id="cb10"><pre class="sourceCode yaml"><code class="sourceCode yaml"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="fu">output:</span></a>
  184. <a class="sourceLine" id="cb10-2" data-line-number="2"> <span class="fu">xaringan:</span><span class="at">:moon_reader:</span></a>
  185. <a class="sourceLine" id="cb10-3" data-line-number="3"> <span class="fu">css:</span><span class="at"> </span><span class="kw">[</span><span class="st">"xaringan-themer.css"</span><span class="kw">]</span></a>
  186. <a class="sourceLine" id="cb10-4" data-line-number="4"> <span class="fu">nature:</span></a>
  187. <a class="sourceLine" id="cb10-5" data-line-number="5"> <span class="fu">highlightStyle:</span><span class="at"> solarized-dark</span></a>
  188. <a class="sourceLine" id="cb10-6" data-line-number="6"> <span class="fu">highlightLines:</span><span class="at"> true</span></a>
  189. <a class="sourceLine" id="cb10-7" data-line-number="7"> <span class="fu">countIncrementalSlides:</span><span class="at"> false</span></a></code></pre></div>
  190. </div>
  191. </div>
  192. <div id="colors" class="section level2">
  193. <h2 class="hasAnchor">
  194. <a href="#colors" class="anchor"></a>Colors</h2>
  195. <p>When designing your xaringan theme, you may have additional colors in your desired color palette beyond those used in the accent colors of the mono and duotone styles.</p>
  196. <p>The <code>style*()</code> functions in xaringanthemer include a <code>colors</code> argument that lets you quickly define a additional colors to use in your slides. This argument takes a vector of named colors</p>
  197. <div class="sourceCode" id="cb11"><html><body><pre class="r"><span class="no">colors</span> <span class="kw">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(
  198. <span class="kw">red</span> <span class="kw">=</span> <span class="st">"#f34213"</span>,
  199. <span class="kw">purple</span> <span class="kw">=</span> <span class="st">"#3e2f5b"</span>,
  200. <span class="kw">orange</span> <span class="kw">=</span> <span class="st">"#ff8811"</span>,
  201. <span class="kw">green</span> <span class="kw">=</span> <span class="st">"#136f63"</span>,
  202. <span class="kw">white</span> <span class="kw">=</span> <span class="st">"#FFFFFF"</span>,
  203. )</pre></body></html></div>
  204. <p>and creates CSS classes from the color name that set the text color — e.g. <code>.red</code> — or that set the background color — e.g. <code>.bg-red</code>. If you use custom CSS in your slides, the color name is also stored in a CSS variable — e.g. <code><a href="https://rdrr.io/r/stats/cor.html">var(--red)</a></code>.</p>
  205. <p>So slide text like this</p>
  206. <div class="sourceCode" id="cb12"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb12-1" data-line-number="1">This **.red[simple]** .white.bg-purple[demo] </a>
  207. <a class="sourceLine" id="cb12-2" data-line-number="2">_.orange[shows]_ the colors .green[in action].</a></code></pre></div>
  208. <p>will be rendered in HTML as</p>
  209. <blockquote>
  210. This <strong><span style="color: #f34213">simple</span></strong> <span style="color:#FFFFFF;background-color:#3e2f5b;">demo</span> <em style="color:#ff8811">shows</em> the colors <span style="color:#136f63">in action</span>.
  211. </blockquote>
  212. <p>Note that the color names in <code>colors</code> need to be valid CSS names, so <code>"purple-light"</code> will work, but <code>"purple light"</code> will not.</p>
  213. </div>
  214. </div>
  215. <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
  216. <nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
  217. </nav>
  218. </div>
  219. </div>
  220. <footer><div class="copyright">
  221. <p>Developed by <a href="https://www.garrickadenbuie.com">Garrick Aden-Buie</a>.</p>
  222. </div>
  223. <div class="pkgdown">
  224. <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
  225. </div>
  226. </footer>
  227. </div>
  228. </body>
  229. </html>