black_or_white {ggspectra} | R Documentation |
Chose black vs. white color based on weighted mean of RGB channels
Description
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.
Usage
black_or_white(colors, threshold = 0.45)
Arguments
colors |
character A vector of color definitions. |
threshold |
numeric in range 0 to 1. |
Examples
black_or_white("red")
black_or_white(colors()[1:10])
[Package ggspectra version 0.3.12 Index]