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

48 lines
1.3KB

  1. When designing your xaringan theme,
  2. you may have additional colors in your desired color palette
  3. beyond those used in the accent colors of the mono and duotone styles.
  4. The `style*()` functions in xaringanthemer
  5. include a `colors` argument that lets you
  6. quickly define a additional colors to use in your slides.
  7. This argument takes a vector of named colors
  8. ```r
  9. colors = c(
  10. red = "#f34213",
  11. purple = "#3e2f5b",
  12. orange = "#ff8811",
  13. green = "#136f63",
  14. white = "#FFFFFF",
  15. )
  16. ```
  17. and creates CSS classes from the color name
  18. that set the text color — e.g. `.red` —
  19. or that set the background color — e.g. `.bg-red`.
  20. If you use custom CSS in your slides,
  21. the color name is also stored in a CSS variable —
  22. e.g. `var(--red)`.
  23. So slide text like this
  24. ```markdown
  25. This **.red[simple]** .white.bg-purple[demo]
  26. _.orange[shows]_ the colors .green[in action].
  27. ```
  28. will be rendered in HTML as
  29. <blockquote>
  30. This <strong><span style="color: #f34213">simple</span></strong>
  31. <span style="color:#FFFFFF;background-color:#3e2f5b;">demo</span>
  32. <em style="color:#ff8811">shows</em>
  33. the colors
  34. <span style="color:#136f63">in action</span>.
  35. </blockquote>
  36. Note that the color names in `colors`
  37. need to be valid CSS names,
  38. so `"purple-light"` will work,
  39. but `"purple light"` will not.