Common Data Types

Color ramp objects

Overview

This is supported at ArcGIS 10.1 and later.

This topic discusses JSON colorRamp objects. A colorRamp object is used to specify a range of colors that are applied to a group of symbols.

The following colorRamp definitions are discussed here:

Algorithmic color ramp

An algorithmic color ramp is defined by two colors and the algorithm used to traverse the intervening color space between them.

JSON syntax

{
  "type": "algorithmic",
  "fromColor": <color>,
  "toColor": <color>,
  "algorithm": <"esriHSVAlgorithm" | "esriCIELabAlgorithm" | "esriLabLChAlgorithm">
}

JSON example

{
  "type": "algorithmic",
  "fromColor": [115,76,0,255],
  "toColor": [255,25,86,255],
  "algorithm": "esriHSVAlgorithm"
}

Multipart color ramp

A multipart color ramp is defined by a list of constituent color ramps.

Note:
  • A multipart color ramp cannot contain another multipart color ramp.
  • At 10.1, a multipart color ramp supports only the algorithmic color ramp.
  • At 10.6, a multipart color ramp supports the algorithmic color ramps with customized start and stop parameters in percentages numbers. These are optional parameters. Without using them, sub-colorramp will be evenly distributed in the colorRamps array’s order.

JSON syntax

{
  "type": "multipart",
  "colorRamps": [
    {
      "type": "algorithmic",
      "fromColor": <color>,
      "toColor": <color>,
      "algorithm": <"esriHSVAlgorithm" | "esriCIELabAlgorithm" | "esriLabLChAlgorithm">
      "start": <double>,
      "stop": <double>
    },      
    {
      "type": "algorithmic",
      "fromColor": <color>,
      "toColor": <color>,
      "algorithm": <"esriHSVAlgorithm" | "esriCIELabAlgorithm" | "esriLabLChAlgorithm">
      "start": <double>,
      "stop": <double>
}
  ]
}

JSON example

{
  "type": "multipart",
  "colorRamps": [
    {
      "type": "algorithmic",
      "fromColor": [255,0,0,255],
      "toColor": [255,255,0,255],
      "algorithm": "esriHSVAlgorithm">
      "start": 0,
      "stop": 33.3
},
    {
      "type": "algorithmic",
      "fromColor": [0,255,255,255],
      "toColor": [0,0,255,255],
      "algorithm": "esriHSVAlgorithm"
      "start": 33.3,
      "stop": 100
    }
  ]
}