R/mix_colors.R

Defines functions mix_colors

#' @importFrom grDevices rgb
mix_colors <- function(milid, milpct, milestone_colors) {
  color_rgb <- apply(milestone_colors[milid,,drop = FALSE], 2, function(x) sum(x * milpct))
  color_rgb[color_rgb < 0] <- 0
  color_rgb[color_rgb > 256] <- 256
  do.call(grDevices::rgb, as.list(c(color_rgb, maxColorValue = 256)))
}

Try the dynplot package in your browser

Any scripts or data that you put into this service are public.

dynplot documentation built on Dec. 11, 2021, 9:33 a.m.