😎 Give your xaringan slides some style
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

297 lines
19KB

  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. <!-- 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. <!-- 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">
  16. <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">
  17. <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">
  18. <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">
  19. <!-- 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">
  20. <script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
  21. <meta property="og:title" content="Themes">
  22. <meta property="og:description" content="xaringanthemer">
  23. <meta property="og:image" content="https://pkg.garrickadenbuie.com/xaringanthemer/logo.png">
  24. <meta name="twitter:card" content="summary">
  25. <meta name="twitter:creator" content="@grrrck">
  26. <meta name="twitter:site" content="@grrrck">
  27. <meta name="robots" content="noindex">
  28. <!-- 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]>
  29. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  30. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  31. <![endif]-->
  32. </head>
  33. <body data-spy="scroll" data-target="#toc">
  34. <div class="container template-article">
  35. <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  36. <div class="container">
  37. <div class="navbar-header">
  38. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
  39. <span class="sr-only">Toggle navigation</span>
  40. <span class="icon-bar"></span>
  41. <span class="icon-bar"></span>
  42. <span class="icon-bar"></span>
  43. </button>
  44. <span class="navbar-brand">
  45. <a class="navbar-link" href="../index.html">xaringanthemer</a>
  46. <span class="version label label-danger" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.4.0.9000</span>
  47. </span>
  48. </div>
  49. <div id="navbar" class="navbar-collapse collapse">
  50. <ul class="nav navbar-nav">
  51. <li>
  52. <a href="../articles/xaringanthemer.html">Features</a>
  53. </li>
  54. <li>
  55. <a href="../reference/index.html">Reference</a>
  56. </li>
  57. <li>
  58. <a href="../articles/themes.html">Themes</a>
  59. </li>
  60. <li>
  61. <a href="../articles/ggplot2-themes.html">ggplot2 Themes</a>
  62. </li>
  63. <li class="dropdown">
  64. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
  65. More
  66. <span class="caret"></span>
  67. </a>
  68. <ul class="dropdown-menu" role="menu">
  69. <li>
  70. <a href="../articles/fonts.html">Fonts</a>
  71. </li>
  72. <li>
  73. <a href="../articles/template-variables.html">Template Variables</a>
  74. </li>
  75. </ul>
  76. </li>
  77. </ul>
  78. <ul class="nav navbar-nav navbar-right">
  79. <li class="dropdown">
  80. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
  81. <span class="far fa-newspaper fa-lg"></span>
  82. <span class="caret"></span>
  83. </a>
  84. <ul class="dropdown-menu" role="menu">
  85. <li>
  86. <a href="https://garrickadenbuie.com/blog/xaringanthemer-v0-3-0/">xaringanthemer 0.3.0</a>
  87. </li>
  88. <li class="divider">
  89. <li>
  90. <a href="../news/index.html">Changelog</a>
  91. </li>
  92. </ul>
  93. </li>
  94. <li>
  95. <a href="https://github.com/gadenbuie/xaringanthemer">
  96. <span class="fab fa-github fa-lg"></span>
  97. </a>
  98. </li>
  99. <li>
  100. <a href="https://twitter.com/grrrck">
  101. <span class="fab fa-twitter fa-lg"></span>
  102. </a>
  103. </li>
  104. <li>
  105. <a href="https://www.garrickadenbuie.com">
  106. <span class="fas fa-home fa-lg"></span>
  107. </a>
  108. </li>
  109. </ul>
  110. </div>
  111. <!--/.nav-collapse -->
  112. </div>
  113. <!--/.container -->
  114. </div>
  115. <!--/.navbar -->
  116. </header><script src="themes_files/accessible-code-block-0.0.1/empty-anchor.js"></script><div class="row">
  117. <div class="col-md-9 contents">
  118. <div class="page-header toc-ignore">
  119. <h1 data-toc-skip>Themes</h1>
  120. <small class="dont-index">Source: <a href="https://github.com/gadenbuie/xaringanthemer/blob/master/vignettes/themes.Rmd"><code>vignettes/themes.Rmd</code></a></small>
  121. <div class="hidden name"><code>themes.Rmd</code></div>
  122. </div>
  123. <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>
  124. <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>
  125. <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>
  126. <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>
  127. <div id="monotone" class="section level3">
  128. <h3 class="hasAnchor">
  129. <a href="#monotone" class="anchor"></a>Monotone</h3>
  130. <p>Use these functions to automatically create a consistent color palette for your slides, based around a single color.</p>
  131. <div id="style_mono_light" class="section level4">
  132. <h4 class="hasAnchor">
  133. <a href="#style_mono_light" class="anchor"></a><code>style_mono_light()</code>
  134. </h4>
  135. <p>A light theme based around a single color.</p>
  136. <div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
  137. <code class="sourceCode R"><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></code></pre></div>
  138. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_light.png" data-external="1"></p>
  139. </div>
  140. <div id="style_mono_dark" class="section level4">
  141. <h4 class="hasAnchor">
  142. <a href="#style_mono_dark" class="anchor"></a><code>style_mono_dark()</code>
  143. </h4>
  144. <p>A dark theme based around a single color.</p>
  145. <div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
  146. <code class="sourceCode R"><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></code></pre></div>
  147. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_dark.png" data-external="1"></p>
  148. </div>
  149. <div id="style_mono_accent" class="section level4">
  150. <h4 class="hasAnchor">
  151. <a href="#style_mono_accent" class="anchor"></a><code>style_mono_accent()</code>
  152. </h4>
  153. <p>The default xaringan theme with a single color used for color accents on select elements (headers, bold text, etc.).</p>
  154. <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
  155. <code class="sourceCode R"><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></code></pre></div>
  156. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent.png" data-external="1"></p>
  157. </div>
  158. <div id="style_mono_accent_inverse" class="section level4">
  159. <h4 class="hasAnchor">
  160. <a href="#style_mono_accent_inverse" class="anchor"></a><code>style_mono_accent_inverse()</code>
  161. </h4>
  162. <p>An “inverted” default xaringan theme with a single color used for color accents on select elements (headers, bold text, etc.).</p>
  163. <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
  164. <code class="sourceCode R"><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></code></pre></div>
  165. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent_inverse.png" data-external="1"></p>
  166. </div>
  167. </div>
  168. <div id="duotone" class="section level3">
  169. <h3 class="hasAnchor">
  170. <a href="#duotone" class="anchor"></a>Duotone</h3>
  171. <p>These themes build from two (ideally) complementary colors.</p>
  172. <div id="style_duo" class="section level4">
  173. <h4 class="hasAnchor">
  174. <a href="#style_duo" class="anchor"></a><code>style_duo()</code>
  175. </h4>
  176. <p>A two-colored theme based on a primary and secondary color.</p>
  177. <div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
  178. <code class="sourceCode R"><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></code></pre></div>
  179. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo.png" data-external="1"></p>
  180. </div>
  181. <div id="style_duo_accent" class="section level4">
  182. <h4 class="hasAnchor">
  183. <a href="#style_duo_accent" class="anchor"></a><code>style_duo_accent()</code>
  184. </h4>
  185. <p>The default Xaringan theme with two accent colors.</p>
  186. <div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
  187. <code class="sourceCode R"><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></code></pre></div>
  188. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent.png" data-external="1"></p>
  189. </div>
  190. <div id="style_duo_accent_inverse" class="section level4">
  191. <h4 class="hasAnchor">
  192. <a href="#style_duo_accent_inverse" class="anchor"></a><code>style_duo_accent_inverse()</code>
  193. </h4>
  194. <p>An “inverted” default Xaringan theme with two accent colors.</p>
  195. <div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
  196. <code class="sourceCode R"><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></code></pre></div>
  197. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent_inverse.png" data-external="1"></p>
  198. </div>
  199. </div>
  200. <div id="solarized" class="section level3">
  201. <h3 class="hasAnchor">
  202. <a href="#solarized" class="anchor"></a>Solarized</h3>
  203. <p>There are also two themes based around the <a href="https://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>
  204. <div id="style_solarized_light" class="section level4">
  205. <h4 class="hasAnchor">
  206. <a href="#style_solarized_light" class="anchor"></a><code>style_solarized_light()</code>
  207. </h4>
  208. <div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
  209. <code class="sourceCode R"><span class="fu"><a href="../reference/style_solarized_light.html">style_solarized_light</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
  210. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_light.png" data-external="1"></p>
  211. </div>
  212. <div id="style_solarized_dark" class="section level4">
  213. <h4 class="hasAnchor">
  214. <a href="#style_solarized_dark" class="anchor"></a><code>style_solarized_dark()</code>
  215. </h4>
  216. <div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
  217. <code class="sourceCode R"><span class="fu"><a href="../reference/style_solarized_dark.html">style_solarized_dark</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
  218. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_dark.png" data-external="1"></p>
  219. <p>To do this, your YAML header should look more-or-less like this:</p>
  220. <div class="sourceCode" id="cb10"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb10-1"><a href="#cb10-1"></a><span class="fu">output</span><span class="kw">:</span></span>
  221. <span id="cb10-2"><a href="#cb10-2"></a><span class="at"> xaringan:</span><span class="fu">:moon_reader</span><span class="kw">:</span></span>
  222. <span id="cb10-3"><a href="#cb10-3"></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>
  223. <span id="cb10-4"><a href="#cb10-4"></a><span class="at"> </span><span class="fu">nature</span><span class="kw">:</span></span>
  224. <span id="cb10-5"><a href="#cb10-5"></a><span class="at"> </span><span class="fu">highlightStyle</span><span class="kw">:</span><span class="at"> solarized-dark</span></span>
  225. <span id="cb10-6"><a href="#cb10-6"></a><span class="at"> </span><span class="fu">highlightLines</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
  226. <span id="cb10-7"><a href="#cb10-7"></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>
  227. </div>
  228. </div>
  229. <div id="colors" class="section level2">
  230. <h2 class="hasAnchor">
  231. <a href="#colors" class="anchor"></a>Colors</h2>
  232. <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>
  233. <p>The <code>style*()</code> functions in xaringanthemer include a <code>colors</code> argument that lets you quickly define additional colors to use in your slides. This argument takes a vector of named colors</p>
  234. <div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
  235. <code class="sourceCode R"><span class="va">colors</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span>
  236. red <span class="op">=</span> <span class="st">"#f34213"</span>,
  237. purple <span class="op">=</span> <span class="st">"#3e2f5b"</span>,
  238. orange <span class="op">=</span> <span class="st">"#ff8811"</span>,
  239. green <span class="op">=</span> <span class="st">"#136f63"</span>,
  240. white <span class="op">=</span> <span class="st">"#FFFFFF"</span>
  241. <span class="op">)</span></code></pre></div>
  242. <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>var(--red)</code>.</p>
  243. <p>So slide text like this</p>
  244. <div class="sourceCode" id="cb12"><pre class="sourceCode markdown"><code class="sourceCode markdown"><span id="cb12-1"><a href="#cb12-1"></a>This **.red[simple]** .white.bg-purple[demo] </span>
  245. <span id="cb12-2"><a href="#cb12-2"></a>_.orange[shows]_ the colors .green[in action].</span></code></pre></div>
  246. <p>will be rendered in HTML as</p>
  247. <blockquote>
  248. 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>.
  249. </blockquote>
  250. <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>
  251. </div>
  252. </div>
  253. <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
  254. <nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
  255. </nav>
  256. </div>
  257. </div>
  258. <footer><div class="copyright">
  259. <p>Developed by <a href="https://www.garrickadenbuie.com">Garrick Aden-Buie</a>.</p>
  260. </div>
  261. <div class="pkgdown">
  262. <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
  263. </div>
  264. </footer>
  265. </div>
  266. </body>
  267. </html>