colorsToRGB.Colors: Converts colors to RGB values

Description Usage Arguments Details Value See Also Examples

Description

Convert any [R] color to RGB (red, green, blue) values. Accepted color values are 1) a color name (an element of colors()), 2) a a hexadecimal string of the form "#rrggbb", or 3) an integer i meaning palette()[i].

Usage

1

Arguments

col

vector of any of the three kind of [R] colors described in the description section.

...

Not used.

Details

This method is just a wrapper for col2rgb() in the [R] base package and included to collect color functions at one place.

Value

Returns an integer matrix with the three rows red, green, and blue. The columns contains the RGB value for each color.

See Also

*rgbToColors(). col2rgb, rgb. For more information see Colors.

Examples

1
2
3
4
5
6
  Colors$colorsToRGB(c(6, "blue", "#3366ff"))

  #        [,1] [,2] [,3]
  #  red    255    0   51
  #  green    0    0  102
  #  blue   255  255  255

HenrikBengtsson/R.graphics documentation built on May 6, 2019, 11:53 p.m.