ColorData

ColorData["scheme"]

gives a function that generates colors in the named color scheme when applied to parameter values.

ColorData["scheme","property"]

gives the specified property of a color scheme.

ColorData["collection"]

gives a list of color schemes in a named collection.

ColorData[]

gives a list of named collections of color schemes.

Details

  • ColorData["scheme"][par] or ColorData["scheme",par] gives the RGBColor object corresponding to parameter value par in the specified scheme.
  • Typical collections of schemes include:
  • "Gradients"continuous normalized color gradients
    "Indexed"colors indexed by successive integers
    "Named"collections of named colors
    "Physical"colors determined by physical parameters
  • By default, color gradients have a single parameter that ranges from 0 to 1.
  • ColorData[{"gradient","Reverse"}] gives a color gradient that ranges from 0 to 1 with the order of colors reversed.
  • ColorData[{"gradient",{min,max}}] gives a color gradient that ranges from min to max.
  • ColorData[n,] uses the n^(th) indexed color palette.
  • Possible properties in ColorData["scheme","property"] include:
  • "ColorFunction"a color function to be applied to parameters
    "ColorList"list of colors for finite indexed color schemes
    "ColorRules"color rules for discrete color schemes
    "Image"a graphics image showing colors in the scheme
    "Name"English name for the color scheme
    "Panel"a clickable panel showing colors in the scheme
    "ParameterCount"the number of parameters used in the scheme
    "Range"range of possible values for the first parameter
    {"Range",i}range of possible values for the ^(th) parameter
  • Ranges are specified as they would be for a slider:
  • {xmin,xmax}continuous values from xmin to xmax
    {xmin,xmax,dx}discrete values in steps dx
    {{x1,x2,}}specific discrete values
  • ColorData["scheme"] gives a ColorDataFunction object.

Examples

open allclose all

Basic Examples  (5)

Return a function that generates colors:

Plot a surface with gradient colors:

Reverse the order of gradient colors:

Use an indexed color scheme for plot styles:

Use an indexed color scheme for contour shading:

Scope  (23)

Schemes and Collections  (6)

Obtain the list of collections:

Find the schemes that belong to each collection:

Gradients are continuous color functions that are suitable for ColorFunction:

ColorData[{"gradient","Reverse"}] returns a gradient color function with the reversed color order:

Indexed schemes consist of lists of colors associated with discrete values:

Named schemes are sets of well-known named colors:

Physical schemes return colors based on physical values:

Properties  (10)

Find all the properties of color schemes:

"ColorFunction" returns the ColorDataFunction object:

Get the list of colors in a discrete color scheme:

Gradients and physical schemes cannot return color lists:

Get the color replacement rules from a discrete color scheme:

Get a representative image of a scheme:

Get a color scheme name:

Get a clickable panel of a scheme:

Get a number of parameters required in a scheme:

Get a range of possible values for the first parameter:

The range value can be directly used in controls, such as Slider:

Property Values  (7)

Property values can be any valid Wolfram Language expression:

Each scheme returns a ColorDataFunction object:

ColorDataFunction returns RGB colors when applied to values within a specific range:

Gradients and physical schemes are defined on continuous intervals:

Indexed schemes are defined on discrete values:

An indexed range can turn into a list by applying Range:

Named schemes are defined on specific sets of values:

A property that is not applicable returns Missing["NotApplicable"]:

Generalizations & Extensions  (2)

Some schemes have specialized images and panels:

Some indexed schemes are defined on whole numbers:

In these cases, only parts of lists and rules are returned:

Applications  (9)

Use gradients to define color function:

Use gradients to represent population:

Combine various surface properties with ColorData using Directive:

Use color lists of indexed schemes in ContourShading:

Use partition of a color list in MeshShading:

Replace HTML color names with RGB values using color rules:

Use color names combined with color rules in ArrayPlot:

Represent atoms with appropriate colors:

Use physical schemes to represent various spectra:

The integrated spectrum color for different temperatures:

Properties & Relations  (5)

Gradients can be referred to by their names only in ColorFunction:

Gradients and physical schemes clip values outside of the ranges:

Indexed schemes repeat the colors periodically:

Indexed schemes take floors of noninteger numbers:

ChemicalData uses ColorData["Atoms"] for element colors:

Possible Issues  (3)

Named schemes return a list of names as the "Range":

First can be used to take the list of names:

In a plot with multiple ColorFunction slots, the first slot is chosen, if not specified:

Specify a pure function so that the plot is colored by height values:

Certain gradients may produce artifacts due to undersampling:

Increasing PlotPoints may reduce the problem:

Neat Examples  (4)

Generate grainy texture from random noise:

Random bumpy pattern using rainbow colors:

Thumbnails of all the gradients:

Thumbnails of all the indexed schemes:

Wolfram Research (2007), ColorData, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorData.html (updated 2010).

Text

Wolfram Research (2007), ColorData, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorData.html (updated 2010).

CMS

Wolfram Language. 2007. "ColorData." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/ColorData.html.

APA

Wolfram Language. (2007). ColorData. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColorData.html

BibTeX

@misc{reference.wolfram_2024_colordata, author="Wolfram Research", title="{ColorData}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/ColorData.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_colordata, organization={Wolfram Research}, title={ColorData}, year={2010}, url={https://reference.wolfram.com/language/ref/ColorData.html}, note=[Accessed: 21-November-2024 ]}