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.

This page requires that JavaScript be enabled in your browser.
Learn how »

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:

Click for copyable input

You can convert to other color spaces by using ToColor:

Click for copyable input

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 0 to 1:

Click for copyable input

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

Click for copyable input

This can be used directly in a graphics expression

Click for copyable input

You can also create a variable index by using Manipulate:

Click for copyable input

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

Click for copyable input


Related Demonstrations

See Also

ColorData  ColorDataFunction  RGBColor  Hue