Learn R Programming

painter (version 0.1.0)

Mix: Create mixtures of color pairs, in either RGB or HSV mode.

Description

Creates a mixture between pairs of colors by averaging their red/green/blue components (RGB mode), or hue/saturation/value components (HSV mode)

Usage

Mix(color1, color2, mode = "RGB",circular = TRUE)

Arguments

color1

A color or vector of colors, either specified by name (e.g. "red") or hex code (e.g. "FF0000")

color2

A second color or vector of colors. If color1 and color2 are not the same length, but one is an integer multiple of the other, the shorter one will be recycled.

mode

Either "RGB" or "HSV", specifies whether to find the intermediate color in RGB space or HSV space.

circular

If using mode = "HSV", specifies whether to ramp between hues using circular means. This is usually a good idea because hues are essentially circular (a hue of 0.01 is very similar to 0.99).

Value

A color

Examples

Run this code
# NOT RUN {
TestPalette(Mix("Red","Yellow"))

TestPalette(c("Red",Mix("Red","Yellow"),"Yellow"))
TestPalette(c("salmon",Mix("salmon","turquoise"),"turquoise"))
TestPalette(c("salmon",Mix("salmon","turquoise",mode = "HSV"),"turquoise"))
TestPalette(Mix(rainbow(10),terrain.colors(10)))
# }

Run the code above in your browser using DataLab