Skip to contents

Mix color into color(s)

Usage

clr_mix(col, mix_in, ratio = 0.5)

Arguments

col

A colors object (see color()) or a vector of any of the three kinds of R color specifications, i.e., either a color name (as listed by grDevices::colors()), a hexadecimal string (see col2rgb()), or a positive integer i meaning grDevices::palette()[i].

mix_in

Same as col.

ratio

Numeric between 0 and 1. 0 will result in col. 1 results in all the colors turning to mix_in. Must be of length 1 or the same length as col.

Value

A colors object of the same length as col.

Examples

plot(clr_mix(rainbow(10), "blue"))


plot(clr_mix(rainbow(10), "red"))


plot(clr_mix(rainbow(10), "#5500EE"))


plot(clr_mix(rainbow(10), "black", seq(1, 0, length.out = 10)))