cr_choose_bw.Rd
Selects whether black or white has the greater contrast with a user-
supplied color. Useful for choosing a text color to overlay on a block-color
background, like value labels over the bars of a bar chart. Calculated as per
cr_get_ratio
. Defaults to black in the case of a tie.
cr_choose_bw(col_bg)
col_bg | A character vector of colors against which to select either
black or white, whichever has maximum contrast. Supply colors as
six-digit hex values preceded by '#', or named colors from
|
---|
A character vector of values "black" or "white". The length matches the input.
#> [1] "black" "black" "black" "white" "white"