find_color_spread | R Documentation |
Find a spread of colors with minimum distance between them
find_color_spread(
x,
n = 2,
min_distance = 11.5,
step_distance = 0,
method = "cie2000",
use_white = "F5",
byCols = c("-met_n", "-d", "-found_n"),
first_only = TRUE,
verbose = FALSE,
...
)
x |
|
n |
|
min_distance |
|
step_distance |
|
method |
|
use_white |
|
byCols |
|
first_only |
|
... |
additional arguments are passed to |
Intended to be called internally by add_colors()
, this function
takes a vector of colors x
, and finds a subset of
at least n
colors that each have color distance min_distance
using the method
and use_white
white reference.
It is intended to solve the problem when M colors are available,
very close to a neighboring color, but a subset N colors are
requested which each have at least min_distance
from each other.
This function is currently not very optimized, although it does avoid repeating combinations of color tests.
It currently iterates each color, then each secondary color with
at least min_distance
, and so on, until at least n
colors
in a set have at least min_distance
distance between them.
It then runs all combinations and sorts for the set with the
highest minimum distance, thereby the "most distinctive subset".
find_color_spread(colorspace::rainbow_hcl(12), n=5, min_distance=20, step_distance=-1, first_only=TRUE)
find_color_spread(colorspace::rainbow_hcl(30), n=12, min_distance=20, step_distance=-1, first_only=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.