represents a color in the RGB color space with red, blue and green components.


specifies opacity a.


returns a color from an HTML color name, etc.


returns the RGB representation of color.


  • 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[spec], spec can be any of the following:
  • "#rrggbb"six-digit hexadecimal
    "#rgb"three-digit (shorthand) hexadecimal form
    "#rrggbbαα"hexadecimal form with opacity
    "htmlcolor"HTML color
    colora color directive
  • RGBColor[color] can be used to convert any ColorQ expression to RGB.
  • 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[a]]. »
  • If no opacity has been specified, RGBColor[r,g,b] is equivalent to RGBColor[r,g,b,1].


open allclose all

Basic Examples  (4)

Specify the color of graphics primitives:

Specify the color with opacity:

Specify the output color of expressions:

Specify the color of plots:

Scope  (6)

Color Specification  (3)

An RGB color:

An RGBA color:

An RGB color from its hexadecimal representation:

Use the short hexadecimal color representation:

An RGB color from a named HTML color:

Colors in 3D  (1)

Use diffuse surface color:

Use diffuse and specular surface color:

Use glow color, setting the diffuse surface color to black:

Color Operations  (2)

Use Blend to mix two or more colors:

Use Lighter and Darker to mix with white and black, respectively:

Generalizations & Extensions  (2)

RGBColor[{r,g,b}] is equivalent to RGBColor[r,g,b]:

Use Opacity with RGBColor:

Use the opacity argument in RGBColor directly:

Applications  (1)

Define a one-dimensional color function:

Properties & Relations  (3)

Use ColorData for named color gradients:

Use ColorData for named color schemes:

Use ColorSetter to get a simple color selector (click the color rectangle):

Or use ColorSlider to directly select colors:

Possible Issues  (1)

Values outside of the 0, 1 range will be clipped:

In plot functions, use ColorFunctionScaling to control global scaling of variables:

Neat Examples  (2)

Visualizing the RGB color space:

RGB noise with opacity:

Wolfram Research (1988), RGBColor, Wolfram Language function, https://reference.wolfram.com/language/ref/RGBColor.html (updated 2021).


Wolfram Research (1988), RGBColor, Wolfram Language function, https://reference.wolfram.com/language/ref/RGBColor.html (updated 2021).


Wolfram Language. 1988. "RGBColor." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/RGBColor.html.


Wolfram Language. (1988). RGBColor. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RGBColor.html


@misc{reference.wolfram_2022_rgbcolor, author="Wolfram Research", title="{RGBColor}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/RGBColor.html}", note=[Accessed: 08-June-2023 ]}


@online{reference.wolfram_2022_rgbcolor, organization={Wolfram Research}, title={RGBColor}, year={2021}, url={https://reference.wolfram.com/language/ref/RGBColor.html}, note=[Accessed: 08-June-2023 ]}