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 nonzero:

RGBColor[1, 0, 0]

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

RGBColor[0, 0, 0]

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

RGBColor[1, 1, 1]

HIDE DETAILS
RGBColor[1, 0, 0]

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:

RGBColor[.2, 1, .8]
RGBColor[.2, .8, 1]

HIDE DETAILS
RGBColor[.2, .8, 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), a 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):

Hue[1, 1, 1]

Use a smaller saturation value to get pink:

Hue[1, .2, 1]

HIDE DETAILS
Hue[1, .2, 1]

Make red text. Try other colors:

SHOW/HIDE DETAILS

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

Style["the cat in the hat", RGBColor[1, 0, 0]]

This makes a blue disk:

Graphics[{Hue[.66, 1, 1], Disk[]}]

HIDE DETAILS
Style["the cat in the hat", RGBColor[1, 0, 0]]