#' Convert RGB to hex
#'
#' Create hex value of colour based on RGB value
#' @param rgb Vector with \% RGB values [0;1]
#' @keywords ggplot, themes
#' @export
#' @return string
#' @examples
#' rgb(1,1,1) # returns #FFFFFF
rgb2col <- function(rgb) {
rgb <- as.integer(rgb)
class(rgb) <- "hexmode"
rgb <- as.character(rgb)
rgb <- matrix(rgb, nrow=3)
paste("#", apply(rgb, MARGIN=2, FUN=paste, collapse=""), sep="")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.