😎 Give your xaringan slides some style
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

132 lines
3.1KB

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