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)))
}
EmilHvitfeldt/prismatic documentation built on April 15, 2024, 3:24 p.m.