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

496 lines
39KB

  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>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. <!-- 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="Xaringan CSS Theme Generator">
  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="xaringanthemer_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>Xaringan CSS Theme Generator</h1>
  120. <small class="dont-index">Source: <a href="https://github.com/gadenbuie/xaringanthemer/blob/master/vignettes/xaringanthemer.Rmd"><code>vignettes/xaringanthemer.Rmd</code></a></small>
  121. <div class="hidden name"><code>xaringanthemer.Rmd</code></div>
  122. </div>
  123. <style type="text/css">
  124. img { max-width: 100%; }
  125. </style>
  126. <p>Jump to: <a href="#quick-intro">Quick Intro</a>, <a href="#themes">Themes</a>, <a href="#theme-settings">Theme Settings</a>, <a href="#fonts">Fonts</a>, <a href="#colors">Colors</a>, <a href="#adding-custom-css">Adding Custom CSS</a></p>
  127. <div id="quick-intro" class="section level2">
  128. <h2 class="hasAnchor">
  129. <a href="#quick-intro" class="anchor"></a>Quick Intro</h2>
  130. <!-- Set link to theme-settings, template-variables, theme functions -->
  131. <p>First, add the <code>xaringan-themer.css</code> file to the YAML header of your xaringan slides.</p>
  132. <div class="sourceCode" id="cb1"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb1-1"><a href="#cb1-1"></a><span class="fu">output</span><span class="kw">:</span></span>
  133. <span id="cb1-2"><a href="#cb1-2"></a><span class="at"> xaringan:</span><span class="fu">:moon_reader</span><span class="kw">:</span></span>
  134. <span id="cb1-3"><a href="#cb1-3"></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>
  135. <p>Then, in a hidden chunk just after the knitr setup chunk, load <strong>xaringanthemer</strong> and try one of the <a href="#themes">theme functions</a>.</p>
  136. <div class="sourceCode" id="cb2"><pre class="sourceCode markdown"><code class="sourceCode markdown"><span id="cb2-1"><a href="#cb2-1"></a><span class="bn">```{r xaringan-themer, include=FALSE, warning=FALSE}</span></span>
  137. <span id="cb2-2"><a href="#cb2-2"></a><span class="bn">library(xaringanthemer)</span></span>
  138. <span id="cb2-3"><a href="#cb2-3"></a><span class="bn">style_mono_accent(</span></span>
  139. <span id="cb2-4"><a href="#cb2-4"></a><span class="bn"> base_color = "#1c5253",</span></span>
  140. <span id="cb2-5"><a href="#cb2-5"></a><span class="bn"> header_font_google = google_font("Josefin Sans"),</span></span>
  141. <span id="cb2-6"><a href="#cb2-6"></a><span class="bn"> text_font_google = google_font("Montserrat", "300", "300i"),</span></span>
  142. <span id="cb2-7"><a href="#cb2-7"></a><span class="bn"> code_font_google = google_font("Fira Mono")</span></span>
  143. <span id="cb2-8"><a href="#cb2-8"></a><span class="bn">)</span></span>
  144. <span id="cb2-9"><a href="#cb2-9"></a><span class="bn">```</span></span></code></pre></div>
  145. <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>
  146. <div id="matching-ggplot-themes" class="section level3">
  147. <h3 class="hasAnchor">
  148. <a href="#matching-ggplot-themes" class="anchor"></a>Matching ggplot Themes</h3>
  149. <p><strong>xaringanthemer</strong> even provides a [ggplot2] theme with <code><a href="../reference/theme_xaringan.html">theme_xaringan()</a></code> that uses the colors and fonts from your slide theme. Built on the <a href="https://github.com/yixuan/showtext">showtext</a> package, and designed to work seamlessly with <a href="https://fonts.google.com">Google Fonts</a>.</p>
  150. <p>Color and fill scales are also provided for matching sequential color scales based on the primary color used in your slides. See <code><a href="../reference/scale_xaringan.html">?scale_xaringan</a></code> for more details.</p>
  151. <p>More details and examples can be found in <code><a href="../articles/ggplot2-themes.html">vignette("ggplot2-themes")</a></code>.</p>
  152. <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
  153. <code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op">)</span>
  154. <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op">(</span><span class="va">diamonds</span><span class="op">)</span> <span class="op">+</span>
  155. <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html">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>
  156. <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">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>
  157. <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op">(</span>
  158. x <span class="op">=</span> <span class="st">"Cut"</span>,
  159. y <span class="op">=</span> <span class="st">"Count"</span>,
  160. title <span class="op">=</span> <span class="st">"A Fancy diamonds Plot"</span>
  161. <span class="op">)</span> <span class="op">+</span>
  162. <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>
  163. <span class="fu"><a href="../reference/scale_xaringan.html">scale_xaringan_fill_discrete</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
  164. <p><img src="../reference/figures/index-theme_xaringan_demo-1.png"></p>
  165. </div>
  166. <div id="tab-completion" class="section level3">
  167. <h3 class="hasAnchor">
  168. <a href="#tab-completion" class="anchor"></a>Tab Completion</h3>
  169. <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 adjust in each of the themes!</p>
  170. <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>
  171. </div>
  172. <div id="r-markdown-template-in-rstudio" class="section level3">
  173. <h3 class="hasAnchor">
  174. <a href="#r-markdown-template-in-rstudio" class="anchor"></a>R Markdown Template in RStudio</h3>
  175. <p>You can also skip the above and just create a <em>Ninja Themed Presentation</em> from the New R Markdown Document menu in RStudio.</p>
  176. <center>
  177. <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">
  178. </center>
  179. </div>
  180. </div>
  181. <div id="themes" class="section level2">
  182. <h2 class="hasAnchor">
  183. <a href="#themes" class="anchor"></a>Themes</h2>
  184. <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>
  185. <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>
  186. <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>
  187. <p>If your 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>
  188. <div id="monotone" class="section level3">
  189. <h3 class="hasAnchor">
  190. <a href="#monotone" class="anchor"></a>Monotone</h3>
  191. <p>Use these functions to automatically create a consistent color palette for your slides, based around a single color.</p>
  192. <div id="style_mono_light" class="section level4">
  193. <h4 class="hasAnchor">
  194. <a href="#style_mono_light" class="anchor"></a><code>style_mono_light()</code>
  195. </h4>
  196. <p>A light theme based around a single color.</p>
  197. <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
  198. <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>
  199. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_light.png" data-external="1"></p>
  200. </div>
  201. <div id="style_mono_dark" class="section level4">
  202. <h4 class="hasAnchor">
  203. <a href="#style_mono_dark" class="anchor"></a><code>style_mono_dark()</code>
  204. </h4>
  205. <p>A dark theme based around a single color.</p>
  206. <div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
  207. <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>
  208. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_dark.png" data-external="1"></p>
  209. </div>
  210. <div id="style_mono_accent" class="section level4">
  211. <h4 class="hasAnchor">
  212. <a href="#style_mono_accent" class="anchor"></a><code>style_mono_accent()</code>
  213. </h4>
  214. <p>The default xaringan theme with a single color used for color accents on select elements (headers, bold text, etc.).</p>
  215. <div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
  216. <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>
  217. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent.png" data-external="1"></p>
  218. </div>
  219. <div id="style_mono_accent_inverse" class="section level4">
  220. <h4 class="hasAnchor">
  221. <a href="#style_mono_accent_inverse" class="anchor"></a><code>style_mono_accent_inverse()</code>
  222. </h4>
  223. <p>An “inverted” default xaringan theme with a single color used for color accents on select elements (headers, bold text, etc.).</p>
  224. <div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
  225. <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>
  226. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_mono_accent_inverse.png" data-external="1"></p>
  227. </div>
  228. </div>
  229. <div id="duotone" class="section level3">
  230. <h3 class="hasAnchor">
  231. <a href="#duotone" class="anchor"></a>Duotone</h3>
  232. <p>These themes build from two (ideally) complementary colors.</p>
  233. <div id="style_duo" class="section level4">
  234. <h4 class="hasAnchor">
  235. <a href="#style_duo" class="anchor"></a><code>style_duo()</code>
  236. </h4>
  237. <p>A two-colored theme based on a primary and secondary color.</p>
  238. <div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
  239. <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>
  240. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo.png" data-external="1"></p>
  241. </div>
  242. <div id="style_duo_accent" class="section level4">
  243. <h4 class="hasAnchor">
  244. <a href="#style_duo_accent" class="anchor"></a><code>style_duo_accent()</code>
  245. </h4>
  246. <p>The default Xaringan theme with two accent colors.</p>
  247. <div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
  248. <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>
  249. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent.png" data-external="1"></p>
  250. </div>
  251. <div id="style_duo_accent_inverse" class="section level4">
  252. <h4 class="hasAnchor">
  253. <a href="#style_duo_accent_inverse" class="anchor"></a><code>style_duo_accent_inverse()</code>
  254. </h4>
  255. <p>An “inverted” default Xaringan theme with two accent colors.</p>
  256. <div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
  257. <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>
  258. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_duo_accent_inverse.png" data-external="1"></p>
  259. </div>
  260. </div>
  261. <div id="solarized" class="section level3">
  262. <h3 class="hasAnchor">
  263. <a href="#solarized" class="anchor"></a>Solarized</h3>
  264. <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>
  265. <div id="style_solarized_light" class="section level4">
  266. <h4 class="hasAnchor">
  267. <a href="#style_solarized_light" class="anchor"></a><code>style_solarized_light()</code>
  268. </h4>
  269. <div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
  270. <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>
  271. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_light.png" data-external="1"></p>
  272. </div>
  273. <div id="style_solarized_dark" class="section level4">
  274. <h4 class="hasAnchor">
  275. <a href="#style_solarized_dark" class="anchor"></a><code>style_solarized_dark()</code>
  276. </h4>
  277. <div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
  278. <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>
  279. <p><img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example_solarized_dark.png" data-external="1"></p>
  280. <p>To do this, your YAML header should look more-or-less like this:</p>
  281. <div class="sourceCode" id="cb13"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb13-1"><a href="#cb13-1"></a><span class="fu">output</span><span class="kw">:</span></span>
  282. <span id="cb13-2"><a href="#cb13-2"></a><span class="at"> xaringan:</span><span class="fu">:moon_reader</span><span class="kw">:</span></span>
  283. <span id="cb13-3"><a href="#cb13-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>
  284. <span id="cb13-4"><a href="#cb13-4"></a><span class="at"> </span><span class="fu">nature</span><span class="kw">:</span></span>
  285. <span id="cb13-5"><a href="#cb13-5"></a><span class="at"> </span><span class="fu">highlightStyle</span><span class="kw">:</span><span class="at"> solarized-dark</span></span>
  286. <span id="cb13-6"><a href="#cb13-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>
  287. <span id="cb13-7"><a href="#cb13-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>
  288. </div>
  289. </div>
  290. </div>
  291. <div id="theme-settings" class="section level2">
  292. <h2 class="hasAnchor">
  293. <a href="#theme-settings" class="anchor"></a>Theme Settings</h2>
  294. <p>The theme functions listed above are just wrappers around the central function of this package, <code><a href="../reference/xaringanthemer_font_default.html">style_xaringan()</a></code>. If you want to start from the default <strong>xaringan</strong> theme and make a few modifications, start there.</p>
  295. <p>All of the theme template variables are repeated in each of the theme functions (instead of relying on <code>...</code>) so that you can use autocompletion to find and change the defaults for any theme function. To override the default value of any theme functions, set the appropriate argument in the theme function. A table of all template variables is included in <a href="template-variables.html"><code>vignette("template-variables", "xaringanthemer")</code></a>.</p>
  296. <p>As an example, try loading <code>xaringanthemer</code>, type out <code>style_duo_theme(</code> and then press <kbd>Tab</kbd> to see all of the theme options.</p>
  297. <p>All of the theme options are named so that you first think of the element you want to change, then the property of that element.</p>
  298. <p>Here are some of the <code>text_</code> theme options:</p>
  299. <ul>
  300. <li><code>text_color</code></li>
  301. <li><code>text_bold_color</code></li>
  302. <li><code>text_slide_number_color</code></li>
  303. <li><code>text_font_size</code></li>
  304. <li><code>text_slide_number_font_size</code></li>
  305. <li><em>and more …</em></li>
  306. </ul>
  307. <p>And here are the title slide theme options:</p>
  308. <ul>
  309. <li><code>title_slide_text_color</code></li>
  310. <li><code>title_slide_background_color</code></li>
  311. <li><code>title_slide_background_image</code></li>
  312. <li><code>title_slide_background_size</code></li>
  313. <li><code>title_slide_background_position</code></li>
  314. </ul>
  315. </div>
  316. <div id="fonts" class="section level2">
  317. <h2 class="hasAnchor">
  318. <a href="#fonts" class="anchor"></a>Fonts</h2>
  319. <!-- Need to set [adding-custom-css] -->
  320. <p><link href="https://fonts.googleapis.com/css2?family=Cabin:wght@600&amp;family=Noto+Sans&amp;display=swap" rel="stylesheet"></p>
  321. <style type="text/css">
  322. .cabin {
  323. font-family: Cabin;
  324. font-weight: 600
  325. }
  326. .noto-sans {
  327. font-family: 'Noto Sans';
  328. }
  329. .font-preview {
  330. padding: 1em;
  331. margin-top: 1em;
  332. margin-bottom: 1em;
  333. border: 1px solid #dddddd;
  334. border-radius: 3px;
  335. font-size: 1.25em;
  336. }
  337. </style>
  338. <div id="default-fonts" class="section level3">
  339. <h3 class="hasAnchor">
  340. <a href="#default-fonts" class="anchor"></a>Default Fonts</h3>
  341. <p>The default heading and body fonts used in <strong>xaringanthemer</strong> are different than the xaringan default fonts. In xaringanthemer, <a href="https://fonts.google.com/specimen/Cabin">Cabin</a> is used for headings and <a href="https://fonts.google.com/specimen/Noto+Sans">Noto Sans</a> for body text.</p>
  342. <div class="font-preview">
  343. <p style="font-size: 1.5em" class="cabin">
  344. A Cabin in the Clearing
  345. </p>
  346. <p class="noto-sans">
  347. Pack my box with five dozen liquor jugs. Amazingly few discotheques provide jukeboxes.
  348. </p>
  349. </div>
  350. <p>These fonts are easier to read on screens and at a distance during presentations, and they support a wide variety of languages and weights. Another reason for the change is that the xaringan (remarkjs) default body font, <em>Droid Serif</em>, is no longer officially included in Google Fonts.</p>
  351. <p>If you would like to use the fonts from the <a href="https://slides.yihui.org/xaringan/">default xaringan theme</a>, you can use the following arguments in your style function.</p>
  352. <div class="sourceCode" id="cb14"><pre class="downlit sourceCode r">
  353. <code class="sourceCode R"><span class="fu"><a href="../reference/xaringanthemer_font_default.html">style_xaringan</a></span><span class="op">(</span>
  354. text_font_family <span class="op">=</span> <span class="st">"Droid Serif"</span>,
  355. text_font_url <span class="op">=</span> <span class="st">"https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic"</span>,
  356. 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>
  357. <span class="op">)</span></code></pre></div>
  358. </div>
  359. <div id="custom-and-google-font-fonts" class="section level3">
  360. <h3 class="hasAnchor">
  361. <a href="#custom-and-google-font-fonts" class="anchor"></a>Custom and <em>Google Font</em> Fonts</h3>
  362. <p><strong>xaringanthemer</strong> makes it easy to use <a href="https://fonts.google.com">Google Fonts</a> in your presentations (provided you have an internet connection during the presentation) or to fully specify your font files.</p>
  363. <p>To use <a href="https://fonts.google.com">Google Fonts</a>, set the <code>&lt;type&gt;_font_google</code> theme arguments – <code>text_font_google</code>, <code>header_font_google</code>, <code>code_font_google</code> — using the <code><a href="../reference/google_font.html">google_font()</a></code> helper. The help documentation in <code><a href="../reference/google_font.html">?google_font</a></code> provides more info.</p>
  364. <div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
  365. <code class="sourceCode R"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>
  366. 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>,
  367. 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>,
  368. 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>
  369. <span class="op">)</span></code></pre></div>
  370. <p>If you set an <code>&lt;type&gt;_font_google</code> theme arguments, then <code>&lt;type&gt;_font_family</code>, <code>&lt;type&gt;_font_weight</code> and <code>&lt;type&gt;_font_url</code> are overwritten – where <code>&lt;type&gt;</code> is one of <code>header</code>, <code>text</code>, or <code>code</code>.</p>
  371. <p>To use a font hosted outside of Google fonts, you need to provide both <code>&lt;type&gt;_font_family</code> and <code>&lt;type&gt;_font_url</code>. For example, suppose you want to use a code font with ligatures for your code chunks, such as <a href="https://github.com/tonsky/FiraCode">Fira Code</a>, which would be declared with <code>code_font_family</code>. The <a href="https://github.com/tonsky/FiraCode#browser-support">browser usage</a> section of the Fira Code README provides a CSS URL to be used with an <code>@import</code> statement that you can use with the <code>code_font_url</code> argument.</p>
  372. <div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
  373. <code class="sourceCode R"><span class="fu"><a href="../reference/style_solarized_dark.html">style_solarized_dark</a></span><span class="op">(</span>
  374. code_font_family <span class="op">=</span> <span class="st">"Fira Code"</span>,
  375. code_font_url <span class="op">=</span> <span class="st">"https://cdn.jsdelivr.net/gh/tonsky/FiraCode@2/distr/fira_code.css"</span>
  376. <span class="op">)</span></code></pre></div>
  377. <p>Remember that you need to supply either <code>&lt;type&gt;_google_font</code> using the <code><a href="../reference/google_font.html">google_font()</a></code> helper <em>or both</em> <code>&lt;type&gt;_font_family</code> and <code>&lt;type&gt;_font_url</code>.</p>
  378. </div>
  379. <div id="using-additional-fonts" class="section level3">
  380. <h3 class="hasAnchor">
  381. <a href="#using-additional-fonts" class="anchor"></a>Using Additional Fonts</h3>
  382. <p>If you want to use additional fonts for use in <a href="#adding-custom-css">custom CSS definitions</a>, use the <code>extra_fonts</code> argument to pass a list of URLs or <code><a href="../reference/google_font.html">google_font()</a></code>s. Notice that you will need to add custom CSS (for example, via <code>extra_css</code>) to use the fonts imported in <code>extra_fonts</code>.</p>
  383. <div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
  384. <code class="sourceCode R"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>
  385. extra_fonts <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>
  386. <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>,
  387. <span class="co"># Young Serif by uplaod.fr</span>
  388. <span class="st">"https://cdn.jsdelivr.net/gh/uplaod/YoungSerif/fonts/webfonts/fontface.css"</span>,
  389. <span class="op">)</span>,
  390. extra_css <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>
  391. <span class="st">".title-slide h2"</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">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>,
  392. blockquote <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">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>
  393. <span class="op">)</span>
  394. <span class="op">)</span></code></pre></div>
  395. </div>
  396. </div>
  397. <div id="colors" class="section level2">
  398. <h2 class="hasAnchor">
  399. <a href="#colors" class="anchor"></a>Colors</h2>
  400. <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>
  401. <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>
  402. <div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
  403. <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>
  404. red <span class="op">=</span> <span class="st">"#f34213"</span>,
  405. purple <span class="op">=</span> <span class="st">"#3e2f5b"</span>,
  406. orange <span class="op">=</span> <span class="st">"#ff8811"</span>,
  407. green <span class="op">=</span> <span class="st">"#136f63"</span>,
  408. white <span class="op">=</span> <span class="st">"#FFFFFF"</span>
  409. <span class="op">)</span></code></pre></div>
  410. <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>
  411. <p>So slide text like this</p>
  412. <div class="sourceCode" id="cb19"><pre class="sourceCode markdown"><code class="sourceCode markdown"><span id="cb19-1"><a href="#cb19-1"></a>This **.red[simple]** .white.bg-purple[demo] </span>
  413. <span id="cb19-2"><a href="#cb19-2"></a>_.orange[shows]_ the colors .green[in action].</span></code></pre></div>
  414. <p>will be rendered in HTML as</p>
  415. <blockquote>
  416. 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>.
  417. </blockquote>
  418. <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>
  419. </div>
  420. <div id="adding-custom-css" class="section level2">
  421. <h2 class="hasAnchor">
  422. <a href="#adding-custom-css" class="anchor"></a>Adding Custom CSS</h2>
  423. <p>You can also add custom CSS classes using the <code>extra_css</code> argument in the theme functions. This argument takes a named list of CSS definitions each containing a named list of CSS property-value pairs.</p>
  424. <div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
  425. <code class="sourceCode R"><span class="va">extra_css</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>
  426. <span class="st">".small"</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">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>,
  427. <span class="st">".full-width"</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>
  428. display <span class="op">=</span> <span class="st">"flex"</span>,
  429. width <span class="op">=</span> <span class="st">"100%"</span>,
  430. flex <span class="op">=</span> <span class="st">"1 1 auto"</span>
  431. <span class="op">)</span>
  432. <span class="op">)</span></code></pre></div>
  433. <p>If you would rather keep your additional css definitions in a separate file, you can call <code><a href="../reference/style_extra_css.html">style_extra_css()</a></code> separately. Just be sure to include your new CSS file in the list of applied files in your YAML header.</p>
  434. <div class="sourceCode" id="cb21"><pre class="downlit sourceCode r">
  435. <code class="sourceCode R"><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></code></pre></div>
  436. <div class="sourceCode" id="cb22"><pre class="sourceCode css"><code class="sourceCode css"><span id="cb22-1"><a href="#cb22-1"></a><span class="co">/* Extra CSS */</span></span>
  437. <span id="cb22-2"><a href="#cb22-2"></a><span class="fu">.small</span> {</span>
  438. <span id="cb22-3"><a href="#cb22-3"></a> <span class="kw">font-size</span>: <span class="dv">90</span><span class="dt">%</span><span class="op">;</span></span>
  439. <span id="cb22-4"><a href="#cb22-4"></a>}</span>
  440. <span id="cb22-5"><a href="#cb22-5"></a><span class="fu">.full-width</span> {</span>
  441. <span id="cb22-6"><a href="#cb22-6"></a> <span class="kw">display</span>: flex<span class="op">;</span></span>
  442. <span id="cb22-7"><a href="#cb22-7"></a> <span class="kw">width</span>: <span class="dv">100</span><span class="dt">%</span><span class="op">;</span></span>
  443. <span id="cb22-8"><a href="#cb22-8"></a> <span class="kw">flex</span>: <span class="dv">1</span> <span class="dv">1</span> <span class="bu">auto</span><span class="op">;</span></span>
  444. <span id="cb22-9"><a href="#cb22-9"></a>}</span></code></pre></div>
  445. <p>This is most helpful when wanting to define helper classes to work with the <a href="https://github.com/gnab/remark">remark.js</a> <code>.class[]</code> syntax. Using the above example, we could add slide text <code>.small[in smaller font size]</code>.</p>
  446. <hr>
  447. <p><strong>xaringanthemer</strong> was built by <a href="https://www.garrickadenbuie.com">Garrick Aden-Buie</a> (<a href="https://twitter.com/grrrck">@grrrck</a>).</p>
  448. <p>Big thank you to <a href="https://yihui.org">Yihui Xie</a>, especially for <a href="https://github.com/yihui/xaringan">xaringan</a>. Also thanks to <a href="http://www.gnab.org/">Ole Petter Bang</a> for <a href="https://github.com/gnab/remark">remark.js</a>.</p>
  449. <p>Feel free to <a href="https://github.com/gadenbuie/xaringanthemer/issues">file an issue</a> if you find a bug or have a theme suggestion – or better yet, submit a pull request!</p>
  450. </div>
  451. </div>
  452. <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
  453. <nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
  454. </nav>
  455. </div>
  456. </div>
  457. <footer><div class="copyright">
  458. <p>Developed by <a href="https://www.garrickadenbuie.com">Garrick Aden-Buie</a>.</p>
  459. </div>
  460. <div class="pkgdown">
  461. <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
  462. </div>
  463. </footer>
  464. </div>
  465. </body>
  466. </html>