ryb | R Documentation |
Create a vector of colors from red, yellow, and blue.
ryb(red = 0, yellow = 0, blue = 0)
red, yellow, blue |
numbers in [0,1]: the color components. |
The first argument can also be a data.frame or a matrix. In that case, its columns are considered as the color components, taken in order, and the other color components arguments are ignored.
When separate arguments are used for the color components and are vectors, values in shorter arguments are recycled to match the length of the longest argument. If the lengths are not compatible, an error is output.
Red, yellow, and blue are the primary colors in historical color theory. This is often what is taught in art schools, for paint. Nowadays, for print work, cyan, magenta, and yellow are considered to be the best set of three colorants to combine, for the widest range of high-chroma colors.
Technically, the RYB components are interpolated to RGB channels using trilinear interpolation on a cube defined by the R,Y, and B primaries, following Gosset and Chen (2004) with a slight modification so that ryb(1,1,1)
returns black. The reverse conversion, from a color to its RYB components, uses the same approach but on a cube defined by the R,G, and B "primary" channels. This is very approximate however, because many colors in the RGB cube cannot be represented in RYB; indeed many colors displayed on screens have no equivalent on paper (all the more flashy ones in particular).
A vector of colors specified as hex codes
Gossett, N. and Chen, B. (2004). Paint inspired color mixing and compositing for visualization. In IEEE Symposium on Information Visualization, 2004. (pp. 113-118).
Itten, J. (1961). Kunst der Farbe. Reinhold Pub. Corp.
Other color specifications:
cmyk()
,
css()
,
hcl()
,
hex()
,
hsi()
,
hsl()
,
hsv()
,
lab()
,
parse_color()
,
rgb()
,
temperature()
,
wavelength()
# Primaries show_col(ryb(1,0,0), ryb(0,1,0), ryb(0,0,1)) # Mixing primaries gives secondaries show_col( # primary 1 primary 2 secondary c(ryb(1,0,0), ryb(0,1,0), ryb(1,1,0)), c(ryb(0,0,1), ryb(1,0,0), ryb(1,0,1)), c(ryb(0,1,0), ryb(0,0,1), ryb(0,1,1)) ) # Some RGB colors have RYB equivalents but some do not x <- c(rgb(1,0,0), rgb(1,1,0), rgb(0,0,1), rgb(1,0,1), rgb(0,1,1)) show_col( x, ryb(as.ryb(x)) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.