How to | Use Colors in the Wolfram Language

As well as being able to specify colors in several color spaces, the Wolfram Language also contains a variety of predefined colors and aesthetically pleasing color spectrums. These colors can be applied to just about anything.

Selected examples from the video:

The quickest way to access all the colors in the Wolfram System is through the Color Schemes palette, which can be found in the Palettes menu:

The palette lists the colors in collections such as Gradients, Physical, Named, and Indexed. Each collection contains a spectrum of colors. The value or range of values corresponding to the selected color is given above the Insert button for the collection.

Here, Red was inserted from the Named collection. Evaluating a named color returns the RGB value of that color:

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

You can convert to other color spaces by using :

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

The Gradients collection on the palette provides a spectrum of colors with a range of indices. Here, the Dark Rainbow color gradient was inserted using the palette.

Evaluating this reveals the underlying ColorData function structure, with the acceptable range of indices listed. In this case, the indices can range from to :

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

To retrieve the specific color value, the index can be specified as the second argument to ColorData:

In[88]:=
Click for copyable input
Out[88]=
Out[89]//InputForm=

This can be used directly in a graphics expression

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

You can also create a variable index by using Manipulate:

Here is an example of a 3D plot from the ColorData documentation page. Notice how the values closer to 0 appear in cool colors (blue), while the values closer to 1 appear in warm colors (red):

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