Learn R Programming

painter (version 0.1.0)

Palette: Generates a color palette (a vector of colors) between two specified colors.

Description

Generates a vector of n colors that ramp between the two specified colors, evenly spaced in either RGB space (mode = "RGB") or HSV space (mode = "HSV")

Usage

Palette(color1, color2, n, mode = "RGB",circular = TRUE)

Arguments

color1

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

color2

A second color

n

The number of colors to produce

mode

Either "RGB" or "HSV", specifies whether to ramp between the colors 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), but produces results with a clear break if the span of hues covers more than half of the circle.

Value

A vector of n colors.

Examples

Run this code
# NOT RUN {
TestPalette(Palette("Green","Red",100))
TestPalette(Palette("Green","Red",100,"HSV"))
# }

Run the code above in your browser using DataLab