R/textContrastColor.R

#' Choose a white or black plot background for a particular color of text 
#' @param x A color value
#' @param ... Other arguments (not used)
#' @export

textContrastColor <- function(x, ...) {
    ifelse( mean(col2rgb(x)) > 127, "black", "white")
}

Try the tlocoh package in your browser

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

tlocoh documentation built on May 2, 2019, 5:27 p.m.