Try now in the
Open Cloud »
(no sign-in required)

Make Colors

Specify colors by their color components.

Run the code to make the color red:

SHOW/HIDE DETAILS

RGBColor makes colors from red, green, and blue color component values. The component values range from 0 (none) to 1 (full). This gives red, because only the red component is non-zero:

In[1]:=
X
Out[1]=

When all of the components are 0, you get black:

In[2]:=
X
Out[2]=

When all of the components are 1, you get white:

In[3]:=
X
Out[3]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Make a shade of blue. Try other color component values:

SHOW/HIDE DETAILS

Mix different amounts of red, green, and blue to get different colors:

In[1]:=
X
Out[1]=
In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Make a color in a different color space. Try other color component values:

SHOW/HIDE DETAILS

There are color spaces other than RGBColor that specify colors in different ways.

Hue makes colors from a hue value (the color), saturation value (how intense the color is), and a brightness value (how dark or light the color is).

Here is red in the Hue color space (also called HSB):

In[1]:=
X
Out[1]=

Use a smaller saturation value to get pink:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Make red text. Try other colors:

SHOW/HIDE DETAILS

Use colors to style text or color graphical elements. This makes red text:

In[1]:=
X
Out[1]=

This makes a blue disk:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=