R/utils.R

Defines functions tint shade

shade <- function(x, steps, crop) {
  shade <- rev(grDevices::colorRampPalette(c(x, "black"))(steps + 1))
  if (crop == 0) {
    return(rev(shade))
  }
  rev(shade[-(seq_len(crop))])
}

tint <- function(x, steps, crop) {
  tint <- rev(grDevices::colorRampPalette(c(x, "white"))(steps + 1))
  if (crop == 0) {
    return(tint)
  }
  tint[-(seq_len(crop))]
}

Try the tinter package in your browser

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

tinter documentation built on April 19, 2020, 4:15 p.m.