😎 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.

131 lines
3.1KB

  1. ### Monotone
  2. ```{r include=FALSE}
  3. IS_README <- exists("IS_README") && IS_README
  4. include_graphic <- function(img_path) {
  5. glue::glue("![](https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/{img_path})")
  6. }
  7. ```
  8. Use these functions to automatically create a consistent color palette for your slides, based around a single color.
  9. #### `style_mono_light()`
  10. A light theme based around a single color.
  11. ```{r style_mono_light}
  12. demo_function_call <- function(f, n_params = 1) {
  13. cat(sep = "",
  14. "```r\n",
  15. paste(substitute(f)), "(",
  16. if (n_params > 0) paste(collapse = ", ",
  17. sapply(1:n_params, function(i) {
  18. paste0(names(formals(f))[i], ' = "', formals(f)[[i]], '"')})),
  19. ")\n```"
  20. )
  21. }
  22. demo_function_call(style_mono_light, 1)
  23. ```
  24. `r include_graphic("example_mono_light.png")`
  25. #### `style_mono_dark()`
  26. A dark theme based around a single color.
  27. ```{r style_mono_dark}
  28. demo_function_call(style_mono_dark, 1)
  29. ```
  30. `r include_graphic("example_mono_dark.png")`
  31. #### `style_mono_accent()`
  32. The default xaringan theme with a single color used for color accents on select elements (headers, bold text, etc.).
  33. ```{r style_mono_accent}
  34. demo_function_call(style_mono_accent, 1)
  35. ```
  36. `r include_graphic("example_mono_accent.png")`
  37. #### `style_mono_accent_inverse()`
  38. An "inverted" default xaringan theme with a single color used for color accents on select elements (headers, bold text, etc.).
  39. ```{r style_mono_accent_inverse}
  40. demo_function_call(style_mono_accent_inverse, 1)
  41. ```
  42. `r include_graphic("example_mono_accent_inverse.png")`
  43. ### Duotone
  44. These themes build from two (ideally) complementary colors.
  45. #### `style_duo()`
  46. A two-colored theme based on a primary and secondary color.
  47. ```{r style_duo}
  48. demo_function_call(style_duo, 2)
  49. ```
  50. `r include_graphic("example_duo.png")`
  51. #### `style_duo_accent()`
  52. The default Xaringan theme with two accent colors.
  53. ```{r style_duo_accent}
  54. demo_function_call(style_duo_accent, 2)
  55. ```
  56. `r include_graphic("example_duo_accent.png")`
  57. #### `style_duo_accent_inverse()`
  58. An "inverted" default Xaringan theme with two accent colors.
  59. ```{r style_duo_accent_inverse}
  60. demo_function_call(style_duo_accent_inverse, 2)
  61. ```
  62. `r include_graphic("example_duo_accent_inverse.png")`
  63. ### Solarized
  64. There are also two themes based around the [solarized color palette](http://ethanschoonover.com/solarized), `style_solarized_light()` and `style_solarized_dark()`.
  65. For both themes, it is advisted to change the syntax highlighting theme to `solarized-light` or `solarized-dark` (looks great paired or constrasted).
  66. #### `style_solarized_light()`
  67. ```{r style_solarized_light}
  68. demo_function_call(style_solarized_light, 0)
  69. ```
  70. `r include_graphic("example_solarized_light.png")`
  71. #### `style_solarized_dark()`
  72. ```{r style_solarized_dark}
  73. demo_function_call(style_solarized_dark, 0)
  74. ```
  75. `r include_graphic("example_solarized_dark.png")`
  76. To do this, your YAML header should look more-or-less like this:
  77. ```yaml
  78. output:
  79. xaringan::moon_reader:
  80. lib_dir: libs
  81. css: ["xaringan-themer.css"]
  82. nature:
  83. highlightStyle: solarized-dark
  84. highlightLines: true
  85. countIncrementalSlides: false
  86. ```