Learn R Programming

barsurf (version 0.5.0)

13_other_supporting_functions_3: Utility Functions for Color Conversion

Description

Convert a color vector from sRGB space to HSV/HCL space, or vice versa.

Usage

rgb2hsv (colv)
hsv2rgb (colv)

rgb2hcl (colv) hcl2rgb (colv, correction=FALSE)

Arguments

colv

A length-3 numeric vector of sRGB, HSV or HCL values.

correction

Logical, correct the sRGB values, if they're outside the interval [0, 1].

Value

A length-3 vector.

Details

These functions are wrappers for functions in the colorspace package.

Note that these functions support single length-3 vectors only, however, other functions in this package support length-4 vectors with an alpha component.

Examples

Run this code
# NOT RUN {
rgb2hcl (c (0, 0, 1) )
# }

Run the code above in your browser using DataLab