RGBColor

RGBColor[red,green,blue]

is a graphics directive specifying that objects that follow are to be displayed in the color given.

RGBColor[r,g,b,a]

specifies opacity a.

RGBColor["string"]

evaluates to a normal RGBColor object.

Details

  • RGBColor is a color space defined by three additive primaries, red, green, and blue, typically used in electronic display devices.
  • Red, green, and blue color intensities outside the range 0 to 1 will be clipped, as will opacities. »
  • On monochrome output devices, a gray level based on the average of the color intensities is used.
  • ColorConvert can be used to convert RGBColor to other color spaces.
  • The alternative forms RGBColor[{r,g,b}] and RGBColor[{r,g,b,a}] can also be used. »
  • In RGBColor["string"], "string" can be any of the following:
  • "#rrggbb"six-digit hexadecimal
    "#rgb"three-digit (shorthand) hexadecimal form
    "htmlcolor"HTML color
  • Style[expr,RGBColor]] specifies that expr should be displayed with the specified color. »
  • For 3D surfaces, explicit RGBColor directives define surface colors; the final shading depends on lighting and contributions from specularity and glow. »
  • Glow[RGBColor[]] specifies color independent of lighting. »
  • RGBColor[r,g,b,a] is equivalent to Directive[RGBColor[r,g,b],Opacity[α]]. »
  • If no opacity has been specified, RGBColor[r,g,b] is equivalent to RGBColor[r,g,b,1].

Examples

open all close all

Basic Examples  (4)

Specify the color of graphics primitives:

In[8]:=
Click for copyable input
Out[8]=

Specify the color with opacity:

In[1]:=
Click for copyable input
Out[1]=

Specify the output color of expressions:

In[1]:=
Click for copyable input
Out[1]=

Specify the color of plots:

In[1]:=
Click for copyable input
Out[1]=

Scope  (6)

Generalizations & Extensions  (2)

Applications  (1)

Properties & Relations  (3)

Possible Issues  (1)

Neat Examples  (2)

Introduced in 1988
(1.0)
|
Updated in 2015
(10.1)