R/colour_brighten.R

Defines functions colour_brighten

colour_brighten <- function(cols, pcts) {
  rgb_mat <- 1 - grDevices::col2rgb(cols) / 255
  mat <- (1 - sweep(rgb_mat, 2, pcts, "*"))
  grDevices::rgb(mat[1,], mat[2,], mat[3,])
}

Try the dyngen package in your browser

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

dyngen documentation built on Oct. 12, 2022, 5:06 p.m.