Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

color-class

Class "color"


Description

Objects from the class color represent colors in a number of color spaces. In particular, there are subclasses of color which correspond to RGB, HSV, HLS, CIEXYZ, CIELUV, CIELAB and polar versions of the last two spaces.

Objects from the Class

Objects can be created by calls to the functions RGB, sRGB, HSV, HLS, XYZ, LUV, LAB, polarLUV, and polarLAB. These are all subclasses of the virtual class color.

Slots

coords:

An object of class "matrix".

Methods

[

signature(x = "color"): This method makes it possible to take subsets of a vector of colors.

coerce

signature(from = "color", to = "RGB"): convert a color vector to RGB.

coerce

signature(from = "color", to = "sRGB"): convert a color vector to sRGB.

coerce

signature(from = "color", to = "XYZ"): convert a color vector to XYZ.

coerce

signature(from = "color", to = "LAB"): convert a color vector to LAB.

coerce

signature(from = "color", to = "polarLAB"): convert a color vector to polarLAB.

coerce

signature(from = "color", to = "HSV"): convert a color vector to HSV.

coerce

signature(from = "color", to = "HLS"): convert a color vector to HLS.

coerce

signature(from = "color", to = "LUV"): convert a color vector to LUV.

coerce

signature(from = "color", to = "polarLUV"): convert a color vector to polarLUV.

coords

signature(color = "color"): extract the color coordinates from a color vector.

plot

signature(x = "color"): plot a color vector

show

signature(object = "color"): show a color vector.

Author(s)

Ross Ihaka

See Also

Examples

x <- RGB(runif(1000), runif(1000), runif(1000))
plot(as(x, "LUV"))

colorspace

A Toolbox for Manipulating and Assessing Colors and Palettes

v2.0-1
BSD_3_clause + file LICENSE
Authors
Ross Ihaka [aut], Paul Murrell [aut] (<https://orcid.org/0000-0002-3224-8858>), Kurt Hornik [aut] (<https://orcid.org/0000-0003-4198-9911>), Jason C. Fisher [aut] (<https://orcid.org/0000-0001-9032-8912>), Reto Stauffer [aut] (<https://orcid.org/0000-0002-3798-5507>), Claus O. Wilke [aut] (<https://orcid.org/0000-0002-7470-9261>), Claire D. McWhite [aut] (<https://orcid.org/0000-0001-7346-3047>), Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>)
Initial release
2021-05-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.