Skip To ContentArcGIS for DevelopersSign In Dashboard
require(["esri/renderers/smartMapping/symbology/color"], function(colorSchemes) { /* code goes here */ });
Object: esri/renderers/smartMapping/symbology/color
Since: ArcGIS API for JavaScript 4.2

Object containing helper methods for generating optimal symbols for data-driven color visualizations. The getSchemes() method is used to generate symbol properties best suited to the given geometry type and basemap.

Method Overview

NameReturn TypeSummaryObject
ColorScheme

Clones a color scheme object.

more details
more detailscolor
ColorScheme

Flips the colors in reverse order of the input color scheme.

more details
more detailscolor
ColorScheme[]

Returns all schemes matching the given color ramp.

more details
more detailscolor
ColorScheme

Returns a color scheme with the provided name.

more details
more detailscolor
ColorSchemes

Returns a primary scheme and secondary schemes defining symbol properties for data-driven color visualizations in a FeatureLayer.

more details
more detailscolor
ColorScheme[]

Returns an array of color schemes with the provided tags.

more details
more detailscolor
Theme[]

Returns metadata for the available themes.

more details
more detailscolor

Method Details

cloneScheme(scheme){ColorScheme}

Clones a color scheme object.

Parameter:

The color scheme object to clone.

Returns:
TypeDescription
ColorSchemeReturns a clone of the given color scheme object.
Example:
// clones the primary scheme returned from the getSchemes() method
var colorScheme = primaryScheme.clone();
flipColors(scheme){ColorScheme}

Flips the colors in reverse order of the input color scheme.

Parameter:

The color scheme to reverse.

Returns:
TypeDescription
ColorSchemeReturns the input color scheme with its colors in reverse order.
Example:
// reverses the order of colors in a primary scheme
// obtained from the getSchemes() method
var flippedScheme = colorSchemes.flipColors(primaryScheme);
getMatchingSchemes(params){ColorScheme[]}
Since: ArcGIS API for JavaScript 4.9

Returns all schemes matching the given color ramp.

Parameters:
Specification:
params Object

See the table below for details of each parameter that may be passed to this function.

Specification:
theme String

The name of the theme from which to get color schemes.

colors Color[]

An array of colors used to match with schemes for the given theme.

geometryType String

The geometry type of the layer for which the color scheme will be applied.

worldScale Boolean
optional

Indicates whether 3D volumetric symbols will be used in the visualization.

optional

The SceneView instance used to calculate the suggested sizes of the symbols. This is required for 3D visualizations.

Returns:
TypeDescription
ColorScheme[]An array of color schemes that match the given colors.
getSchemeByName(params){ColorScheme}
Since: ArcGIS API for JavaScript 4.12

Returns a color scheme with the provided name.

Parameters:
Specification:
params Object

See the table below for details of each parameter that may be passed to this function.

Specification:
name String

The name of the scheme to retrieve.

basemap String|Basemap

The basemap to pair with the visualization. This value indicates the best symbol colors for visualizing features against the given basemap.

geometryType String

The geometry type of the features to visualize.

Possible Values: point | multipoint | polyline | polygon | mesh

theme String

The theme determines which values will be emphasized in the continuous ramp and the map. Possible values are listed below.

ValueDescriptionExample
high-to-lowHigh values are emphasized with strong colors.high-to-low
above-and-belowValues centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors.above-and-below
centered-onValues centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors.centered-on
extremesHigh and low values are emphasized with strong colors. All others are visualized with weak colors.extremes
optional

The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols.

worldScale Boolean
optional

Indicates if the size units of the scheme will be in meters. This should be true when the scheme is intended for 3D volumetric symbology. A view must be provided if this property is set to true.

Returns:
TypeDescription
ColorSchemeReturns the color scheme with the given name.
Example:
// Returns the Galaxy Berries scheme
var galaxyBerriesScheme = colorSchemes.getSchemeByName({
  basemap: map.basemap,
  geometryType: featureLayer.geometryType,
  theme: "extremes",
  name: "Galaxy Berries"
});
getSchemes(params){ColorSchemes}

Returns a primary scheme and secondary schemes defining symbol properties for data-driven color visualizations in a FeatureLayer. The basemap parameter determines the color schemes of the graphics used to visualize each feature. The geometryType determines which type of symbol to return.

Parameters:
Specification:
params Object

See the table below for details of each parameter that may be passed to this function.

Specification:
basemap String|Basemap

The basemap to pair with the visualization. This value indicates the best symbol colors for visualizing features against the given basemap.

geometryType String

The geometry type of the features to visualize.

Possible Values: point | multipoint | polyline | polygon | mesh

theme String

The theme determines which values will be emphasized in the continuous ramp and the map. Possible values are listed below.

ValueDescriptionExample
high-to-lowHigh values are emphasized with strong colors.high-to-low
above-and-belowValues centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors.above-and-below
centered-onValues centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors.centered-on
extremesHigh and low values are emphasized with strong colors. All others are visualized with weak colors.extremes
optional

The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols.

worldScale Boolean
optional

Indicates if the size units of the scheme will be in meters. This should be true when the scheme is intended for 3D volumetric symbology. A view must be provided if this property is set to true.

Returns:
TypeDescription
ColorSchemesReturns an object containing the optimal color scheme to use for the given basemap and secondary schemes that may also be used.
Example:
// gets the primary scheme for the features of the given geometry type and basemap
var schemes = colorSchemes.getSchemes({
  basemap: map.basemap,
  geometryType: featureLayer.geometryType,
  theme: "extremes"
});

// the best default scheme for the layer, basemap, and theme
var primaryScheme = schemes.primaryScheme;
getSchemesByTag(params){ColorScheme[]}
Since: ArcGIS API for JavaScript 4.12

Returns an array of color schemes with the provided tags. These schemes define symbol properties for data-driven color visualizations in any layer that can be rendered with a Renderer.

Parameters:
Specification:
params Object

See the table below for details of each parameter that may be passed to this function.

Specification:
includedTags String[]
optional

When provided, only schemes containing all the matching tags will be returned.

Known Tags: light | dark | reds | yellows | oranges | greens | blues | purples | pinks | browns | grays | bright | subdued | deuteranopia | protanopia | tritanopia | grayscale | types | dot-density

excludedTags String[]
optional

When provided, only schemes missing all the provided tags will be returned.

Known Tags: light | dark | reds | yellows | oranges | greens | blues | purples | pinks | browns | grays | bright | subdued | deuteranopia | protanopia | tritanopia | grayscale | types | dot-density

basemap String|Basemap

The basemap to pair with the visualization. This value indicates the best symbol colors for visualizing features against the given basemap.

geometryType String

The geometry type of the features to visualize.

Possible Values: point | multipoint | polyline | polygon | mesh

theme String

The theme determines which values will be emphasized in the continuous ramp and the map. Possible values are listed below.

ValueDescriptionExample
high-to-lowHigh values are emphasized with strong colors.high-to-low
above-and-belowValues centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors.above-and-below
centered-onValues centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors.centered-on
extremesHigh and low values are emphasized with strong colors. All others are visualized with weak colors.extremes
optional

The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols.

worldScale Boolean
optional

Indicates if the size units of the scheme will be in meters. This should be true when the scheme is intended for 3D volumetric symbology. A view must be provided if this property is set to true.

Returns:
TypeDescription
ColorScheme[]Returns an array of color schemes either including or excluding the provided tags.
Example:
// Returns all the red color schemes that are color-blind friendly
var schemes = colorSchemes.getSchemesByTag({
  basemap: map.basemap,
  geometryType: featureLayer.geometryType,
  theme: "extremes",
  includedTags: [ "reds", "deuteranopia", "protanopia", "tritanopia" ]
});
getThemes(basemap){Theme[]}

Returns metadata for the available themes. If a basemap is provided, returns themes that work best with the given basemap.

Parameter:
basemap String|Basemap
optional

The Esri basemap string or object that will be used with the returned theme(s).

Returns:
TypeDescription
Theme[]Returns an object containing information about the available themes for the given basemap.

Type Definitions

Properties defining the symbology scheme used to visualize features with attribute data-driven color.

ColorSchemeForMesh

Properties defining the symbology scheme used to visualize mesh features with attribute data-driven color.

Properties:
name String

The unique name of the scheme.

Tags associated with the scheme.

The unique id of the color scheme to usee in the visualization. The id is assigned based on the following template: <themeName>/<basemapName>/<schemeName>.

theme String

Indicates which values will be emphasized in the continuous ramp and the map. Possible values are listed below.

ValueDescriptionExample
high-to-lowHigh values are emphasized with strong colors.high-to-low
above-and-belowValues centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors.above-and-below
centered-onValues centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors.centered-on
extremesHigh and low values are emphasized with strong colors. All others are visualized with weak colors.extremes
colors Color[]

The continuous color ramp that will be applied to the visualization.

noDataColor Color

The color of the symbol used to indicate features with no data and features that are out of range.

colorsForClassBreaks Object[]

Predefined classed color schemes to use for the visualization.

Specification:
colors Color[]

An array of hex color strings. Each color is assigned to a specific break in classed color visualizations.

numClasses Number

The number of classes used in the classed color visualization.

opacity Number

The opacity of the symbol.

ColorSchemeForPoint

Properties defining the symbology scheme used to visualize point features with attribute data-driven color.

Properties:
name String

The unique name of the scheme.

Tags associated with the scheme.

The unique id of the color scheme to usee in the visualization. The id is assigned based on the following template: <themeName>/<basemapName>/<schemeName>.

theme String

Indicates which values will be emphasized in the continuous ramp and the map. Possible values are listed below.

ValueDescriptionExample
high-to-lowHigh values are emphasized with strong colors.high-to-low
above-and-belowValues centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors.above-and-below
centered-onValues centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors.centered-on
extremesHigh and low values are emphasized with strong colors. All others are visualized with weak colors.extremes
colors Color[]

The continuous color ramp that will be applied to the visualization.

noDataColor Color

The color of the symbol used to indicate features with no data and features that are out of range.

colorsForClassBreaks Object[]

Predefined classed color schemes to use for the visualization.

Specification:
colors Color[]

An array of hex color strings. Each color is assigned to a specific break in classed color visualizations.

numClasses Number

The number of classes used in the classed color visualization.

outline Object

Properties for defining the outline of the symbol.

Specification:
color Color

The outline color of the symbol.

width Number

The width of the symbol in pixels or points.

size Number

The default size of the symbol in pixels or points.

opacity Number

The opacity of the symbol.

ColorSchemeForPolygon

Properties defining the symbology scheme used to visualize polygon features with attribute data-driven color.

Properties:
name String

The unique name of the scheme.

Tags associated with the scheme.

The unique id of the color scheme to usee in the visualization. The id is assigned based on the following template: <themeName>/<basemapName>/<schemeName>.

theme String

Indicates which values will be emphasized in the continuous ramp and the map. Possible values are listed below.

ValueDescriptionExample
high-to-lowHigh values are emphasized with strong colors.high-to-low
above-and-belowValues centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors.above-and-below
centered-onValues centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors.centered-on
extremesHigh and low values are emphasized with strong colors. All others are visualized with weak colors.extremes
colors Color[]

The continuous color ramp that will be applied to the visualization.

noDataColor Color

The color of the symbol used to indicate features with no data and features that are out of range.

colorsForClassBreaks Object[]

Predefined classed color schemes to use for the visualization.

Specification:
colors Color[]

An array of hex color strings. Each color is assigned to a specific break in classed color visualizations.

numClasses Number

The number of classes used in the classed color visualization.

outline Object

Properties for defining the outline of the symbol.

Specification:
color Color

The outline color of the symbol.

width Number

The width of the symbol in pixels or points.

opacity Number

The opacity of the symbol.

ColorSchemeForPolyline

Properties defining the symbology scheme used to visualize polyline features with attribute data-driven color.

Properties:
name String

The unique name of the scheme.

Tags associated with the scheme.

The unique id of the color scheme to usee in the visualization. The id is assigned based on the following template: <themeName>/<basemapName>/<schemeName>.

theme String

Indicates which values will be emphasized in the continuous ramp and the map. Possible values are listed below.

ValueDescriptionExample
high-to-lowHigh values are emphasized with strong colors.high-to-low
above-and-belowValues centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors.above-and-below
centered-onValues centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors.centered-on
extremesHigh and low values are emphasized with strong colors. All others are visualized with weak colors.extremes
colors Color[]

The continuous color ramp that will be applied to the visualization.

noDataColor Color

The color of the symbol used to indicate features with no data and features that are out of range.

colorsForClassBreaks Object[]

Predefined classed color schemes to use for the visualization.

Specification:
colors Color[]

An array of hex color strings. Each color is assigned to a specific break in classed color visualizations.

numClasses Number

The number of classes used in the classed color visualization.

width Number

The default width of the symbol in pixels or points.

opacity Number

The opacity of the symbol.

ColorSchemes

The return object of the getSchemes() method.

Properties:
primaryScheme ColorScheme

The color scheme best suited for the given basemap and geometry type.

secondarySchemes ColorScheme[]

Additional color schemes that may be used to visualize data of the given geometry type overlaid on the given basemap.

basemapId String

The ID of the basemap associated with the given schemes.

Theme

Describes a theme that pairs well with the given basemaps. See the table below for more details of the properties in this object.

Properties:
name String

The name of the theme.

label String

The label identifying the theme in UI elements.

description String

Text describing the theme in the UI.

basemaps String[]

The Esri basemaps that pair well with the given theme.

API Reference search results

NameTypeModule
Loading...