MATHEMATICA HOW TO

How to | Use Colors in Mathematica

As well as being able to specify colors in several color spaces, Mathematica 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 Mathematica 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:

 Out[1]=

You can convert to other color spaces by using :

 Out[2]=

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 :

 Out[3]=

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

 Out[4]=

This can be used directly in a graphics expression

 Out[5]=

You can also create a variable index by using Manipulate:

 Out[5]= Play Animation ▪

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

 Out[7]=