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)))
}
dynverse/dynplot documentation built on Dec. 12, 2021, 9:39 p.m.