R/SetTextContrastColor.r

Defines functions SetTextContrastColor

Documented in SetTextContrastColor

#' Sets contrasting color for text
#'
#' @param color A color
#' @return Returns either "black" or "white"
#' @description Sets color for text that effectively contrasts with the background color specified. Used by the \code{\link{Colors}} function.  
#'

SetTextContrastColor = function(color)
                        {
                          ifelse( mean(grDevices::col2rgb(color)) > 127, "black", "white")
                        }

Try the poliscidata package in your browser

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

poliscidata documentation built on July 8, 2020, 6:23 p.m.