Chose black vs. white color based on weighted mean of RGB channels
Source:R/color-chart.R
black_or_white.Rd
Chose black or white color based on a color to be used as background.
Usefull when using geom_text
on top of tiles or bars, or
geom_label
with a variable fill.
Examples
black_or_white("red")
#> [1] "white"
black_or_white(colors()[1:10])
#> [1] "black" "black" "black" "black" "black" "black" "black" "black" "black"
#> [10] "black"