R/makeTransparent.R

Defines functions makeTransparent

Documented in makeTransparent

#' Function  to make transparent versions of R colors.

#' @param someColor takes a vector of color as `col` in `col2rgb`
#' @param alpha determines the transparency on a 0-255 scale
#'
#' @export

makeTransparent <- function(someColor, alpha = 100) {
  newColor <- col2rgb(someColor)
  apply(newColor, 2, function(curcoldata){
    rgb(red=curcoldata[1], green=curcoldata[2],
        blue=curcoldata[3], alpha=alpha, maxColorValue=255)
  })
}
CeresBarros/ToolsCB documentation built on Aug. 23, 2024, 4:22 p.m.