colorConversions {plotwidgets}R Documentation

Convert colors from and to RGB and HSL formats

Description

Convert colors from and to RGB and HSL formats

Usage

col2rgb.2(col)

col2hsl(col)

hsl2col(hsl)

rgb2col(rgb)

rgb2hsl(rgb)

hsl2rgb(hsl)

Arguments

col

a character vector with colors to convert (palette)

hsl

a numeric matrix with three or four rows (hue, saturation, luminosity and alpha)

rgb

a numeric matrix with three or four rows (red, green, blue and alpha)

Details

These functions convert between RGB and HSL color spaces, and character vectors which contain color names or hash-encoded RGB values ("#FFCC00").

All functions support an alpha channel. For example, unlike the grDevices::col2rgb, col2rgb.2 returns a matrix with four rows: three for R, G and B channels and one for the alpha channel.

Value

col2rgb.2 and col2hsl return a four-row matrix. rgb2col and hsl2col return a character vector.

Functions

See Also

modCol, modhueCol, darkenCol, saturateCol

Examples

haze <- plotPals("haze")
col2rgb(haze)
col2hsl(haze)

[Package plotwidgets version 0.5.1 Index]