This function can be used to compute the result of color mixing, assuming additive mixing (e.g., as appropriate for RGB or XYZ).

mixcolor(alpha, color1, color2, where = class(color1))

Arguments

alpha

The mixed color is obtained by combining an amount 1 - alpha of color1 with an amount alpha of color2.

color1

The first color.

color2

The second color.

where

The color space where the mixing is to take place.

Value

The mixed color. This is in the color space specified by where.

See also

Author

Ross Ihaka

Examples

mixcolor(0.5, sRGB(1, 0, 0), sRGB(0, 1, 0))
#>        R   G B
#> [1,] 0.5 0.5 0