EVOLUTION-MANAGER
Edit File: rgb.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: RGB Color Specification</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for rgb {grDevices}"><tr><td>rgb {grDevices}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>RGB Color Specification</h2> <h3>Description</h3> <p>This function creates colors corresponding to the given intensities (between 0 and <code>max</code>) of the red, green and blue primaries. The colour specification refers to the standard sRGB colorspace (IEC standard 61966). </p> <p>An alpha transparency value can also be specified (as an opacity, so <code>0</code> means fully transparent and <code>max</code> means opaque). If <code>alpha</code> is not specified, an opaque colour is generated. </p> <p>The <code>names</code> argument may be used to provide names for the colors. </p> <p>The values returned by these functions can be used with a <code>col=</code> specification in graphics functions or in <code><a href="../../graphics/html/par.html">par</a></code>. </p> <h3>Usage</h3> <pre> rgb(red, green, blue, alpha, names = NULL, maxColorValue = 1) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>red, blue, green, alpha</code></td> <td> <p>numeric vectors with values in <i>[0, M]</i> where <i>M</i> is <code>maxColorValue</code>. When this is <code>255</code>, the <code>red</code>, <code>blue</code>, <code>green</code>, and <code>alpha</code> values are coerced to integers in <code>0:255</code> and the result is computed most efficiently.</p> </td></tr> <tr valign="top"><td><code>names</code></td> <td> <p>character vector. The names for the resulting vector.</p> </td></tr> <tr valign="top"><td><code>maxColorValue</code></td> <td> <p>number giving the maximum of the color values range, see above.</p> </td></tr> </table> <h3>Details</h3> <p>The colors may be specified by passing a matrix or data frame as argument <code>red</code>, and leaving <code>blue</code> and <code>green</code> missing. In this case the first three columns of <code>red</code> are taken to be the <code>red</code>, <code>green</code> and <code>blue</code> values. </p> <p>Semi-transparent colors (<code>0 < alpha < 1</code>) are supported only on some devices: at the time of writing on the <code><a href="pdf.html">pdf</a></code>, <code>windows</code>, <code>quartz</code> and <code>X11(type = "cairo")</code> devices and associated bitmap devices (<code>jpeg</code>, <code>png</code>, <code>bmp</code>, <code>tiff</code> and <code>bitmap</code>). They are supported by several third-party devices such as those in packages <a href="https://CRAN.R-project.org/package=Cairo"><span class="pkg">Cairo</span></a>, <a href="https://CRAN.R-project.org/package=cairoDevice"><span class="pkg">cairoDevice</span></a> and <a href="https://CRAN.R-project.org/package=JavaGD"><span class="pkg">JavaGD</span></a>. Only some of these devices support semi-transparent backgrounds. </p> <p>Most other graphics devices plot semi-transparent colors as fully transparent, usually with a warning when first encountered. </p> <p><code>NA</code> values are not allowed for any of <code>red</code>, <code>blue</code>, <code>green</code> or <code>alpha</code>. </p> <h3>Value</h3> <p>A character vector with elements of 7 or 9 characters, <code>"#"</code> followed by the red, blue, green and optionally alpha values in hexadecimal (after rescaling to <code>0 ... 255</code>). The optional alpha values range from <code>0</code> (fully transparent) to <code>255</code> (opaque). </p> <p><span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> does <strong>not</strong> use ‘premultiplied alpha’. </p> <h3>See Also</h3> <p><code><a href="col2rgb.html">col2rgb</a></code> for translating <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> colors to RGB vectors; <code><a href="palettes.html">rainbow</a></code>, <code><a href="hsv.html">hsv</a></code>, <code><a href="hcl.html">hcl</a></code>, <code><a href="gray.html">gray</a></code>. </p> <h3>Examples</h3> <pre> rgb(0, 1, 0) rgb((0:15)/15, green = 0, blue = 0, names = paste("red", 0:15, sep = ".")) rgb(0, 0:12, 0, max = 255) # integer input ramp <- colorRamp(c("red", "white")) rgb( ramp(seq(0, 1, length = 5)), max = 255) </pre> <hr /><div style="text-align: center;">[Package <em>grDevices</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>