Skip to content

[Back to Parameters]

Color

A widget used to select a color value. Value is saved as a comma-delimited string, unless componentValueType is 'hex', in which case the two-digit hex values are concatenated with no delimiter.

Specification

key type required default value description
colorSpace enum: 'rgb', 'hsv', 'cmyk', 'hsl' no 'rgb' Keyword for color representation type.
alpha boolean no false If true save an alpha band, appended as a fourth (or fifth, in the case of cmyk) element in the resulting string.
componentValueType enum: 'int' (range 0–255), 'float' (range 0.0–1.0), 'hex' (range 00–FF) no 'int' Keyword for component value types.

deprecated

key type required description
valueFormat fstring no Format string where %1 is a placeholder for the raw parameter value (should be able to remove this after tweaking MapboxStyler slightly.)

Example

{
  "name": "somecolor",
  "type": "color",
  "valueType": "string",
  "prompt": "Layer color",
  "defaultValue": "#0000ff",
  "colorSpace": "rgb",
  "alpha": false,
  "componentValueType": "hex",
  "valueFormat": "#%1"
}