R/aaa.R

Defines functions has_names pro_transform rgb_norm rgb2col

rgb2col <- function(x, alpha = FALSE) {
  if (alpha) {
    rgb(x[1, ], x[2, ], x[3, ], alpha = x[4, ], maxColorValue = 255)
  } else {
    rgb(x[1, ], x[2, ], x[3, ], maxColorValue = 255)
  }
}

rgb_norm <- function(x) {
  x[x > 255] <- 255
  x[x < 0] <- 0
  x
}

pro_transform <- function(data, value, ratio) {
  value * ratio + data * (1 - ratio)
}

has_names <- function(x) {
  !is.null(names(x)) || any(nzchar(names(x)))
}

Try the prismatic package in your browser

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

prismatic documentation built on May 29, 2024, 6:04 a.m.