mix_col() simulates subtractive (pigment) color mixing by converting
input colors to Munsell notation via aqp::col2Munsell(), mixing them with
aqp::mixMunsell(), and converting the result back to an R color string
via aqp::parseMunsell().
Arguments
- ...
Colors to mix. Can be individual color strings or character vectors; all are combined into a single vector.
- w
A numeric vector of weights or proportions the same length as the combined color vector. Defaults to equal weights.
- mixingMethod
Mixing method passed to
aqp::mixMunsell().
See also
mean_col() for a simpler quadratic-mean RGB approach (no extra packages required).
Examples
should_run_ex <- requireNamespace("aqp", quietly = TRUE) &&
(interactive() || identical(Sys.getenv("IN_PKGDOWN"), "true"))
if (should_run_ex) {
mix_col(c("red", "blue"))
}
#> [1] "#C2008FFF"
if (should_run_ex) {
mix_col("red", "yellow", "blue", w = c(2, 1, 1))
}
#> [1] "#F46666FF"