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

28 lines
693B

  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/color.R
  3. \name{apply_alpha}
  4. \alias{apply_alpha}
  5. \title{Add alpha to hex color}
  6. \usage{
  7. apply_alpha(color_hex, opacity = 0.5)
  8. }
  9. \arguments{
  10. \item{color_hex}{A character string representing a hex color}
  11. \item{opacity}{Desired opacity of the output color}
  12. }
  13. \description{
  14. Applies alpha (or opacity) to a color in hexadecimal form by
  15. converting opacity in the \verb{[0, 1]} range to hex in the \verb{[0, 255]} range
  16. and appending to the hex color.
  17. }
  18. \examples{
  19. blue <- "#0e6ba8"
  20. blue_transparent <- apply_alpha(blue)
  21. if (requireNamespace("scales", quietly = TRUE)) {
  22. scales::show_col(c(blue, blue_transparent))
  23. }
  24. }