sRGB: Create sRGB Colors

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/colorspace.R

Description

This function creates colors of class sRGB; a subclass of the virtual color-class class.

Usage

1
sRGB(R, G, B, names)

Arguments

R, G, B

these arguments give the red, green and blue intensities of the colors (the values should lie between 0 and 1). The values can be provided in separate R, G and B vectors or in a three-column matrix passed as R.

names

A vector of names for the colors (by default the row names of R are used).

Details

This function creates colors in the standard sRGB color space (IEC standard 61966).

Value

An object of class sRGB which inherits from class color.

Author(s)

Ross Ihaka

See Also

RGB, HSV, XYZ, LAB, polarLAB, LUV, polarLUV.

Examples

1
2
3
# Create a random set of colors
set.seed(1)
sRGB(R = runif(20), G = runif(20), B = runif(20))

Example output

               R          G          B
 [1,] 0.26550866 0.93470523 0.82094629
 [2,] 0.37212390 0.21214252 0.64706019
 [3,] 0.57285336 0.65167377 0.78293276
 [4,] 0.90820779 0.12555510 0.55303631
 [5,] 0.20168193 0.26722067 0.52971958
 [6,] 0.89838968 0.38611409 0.78935623
 [7,] 0.94467527 0.01339033 0.02333120
 [8,] 0.66079779 0.38238796 0.47723007
 [9,] 0.62911404 0.86969085 0.73231374
[10,] 0.06178627 0.34034900 0.69273156
[11,] 0.20597457 0.48208012 0.47761962
[12,] 0.17655675 0.59956583 0.86120948
[13,] 0.68702285 0.49354131 0.43809711
[14,] 0.38410372 0.18621760 0.24479728
[15,] 0.76984142 0.82737332 0.07067905
[16,] 0.49769924 0.66846674 0.09946616
[17,] 0.71761851 0.79423986 0.31627171
[18,] 0.99190609 0.10794363 0.51863426
[19,] 0.38003518 0.72371095 0.66200508
[20,] 0.77744522 0.41127443 0.40683019

colorspace documentation built on May 2, 2019, 12:49 p.m.