These palette functions transform all-numeric colour_spec vectors into colours.

rgb_palette(x, min = 0, max = 1)

hsv_palette(x, min = 0, max = 1)

hsl_palette(x, min = 0, max = 1)

hcl_palette(x, min = 0, max = 1)

cmyk_palette(x, min = 0, max = 1)

cmy_palette(x, min = 0, max = 1)

Arguments

x

An colour_spec vector with a numeric vector in every channel.

min, max

A numeric(1) specifying the lower and upper limits respectively.

Value

A character vector of the same length as the x argument with hexadecimal colour notation.

Details

The conversion from colour_spec vectors to colour is powered by the farver::encode_colour() function.

Functions

  • rgb_palette: Red, Green and Blue colour space.

  • hsv_palette: Hue, Saturation and Value colour space.

  • hsl_palette: Hue, Saturation and Lightness colour space.

  • hcl_palette: Hue, Chroma and Luminance colour space.

  • cmyk_palette: Cyan, Magenta, Yellow and Key (black) colour space.

  • cmy_palette: Cyan, Magenta and Yellow colour space.

See also

The colour_spec page for building colour space vectors. The scale_chromatic page for the scales wherein these palettes are used.

Examples

# Getting the colour "red" in different colour spaces rgb_palette(rgb_spec(1, 0, 0))
#> [1] "#FF0000"
hsv_palette(hsv_spec(0, 1, 1))
#> [1] "#FF0000"
hsl_palette(hsl_spec(0, 1, 0.5))
#> [1] "#FF0000"
hcl_palette(hcl_spec(0.034, 0.995, 0.532))
#> [1] "#FF0000"
cmyk_palette(cmyk_spec(0, 1, 1, 0))
#> [1] "#FF0000"
cmy_palette(cmy_spec(0, 1, 1))
#> [1] "#FF0000"