Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: ColorPicker

require(["esri/dijit/ColorPicker"], function(ColorPicker) { /* code goes here */ });

Description

(Added at v3.13)
A widget to assist choosing a color from a color palette.

Samples

Search for samples that use this class.

Constructors

NameSummary
new ColorPicker(params, srcNodeRef)Creates a new ColorPicker widget.

CSS

esri/dijit/ColorPicker | Download source

Properties

NameTypeSummary
collapsedBooleanIndicates whether the widget displays collapsed.
collapsibleBooleanIndicates whether the widget is collapsible.
colorColorThe selected color.
paletteColor[]The set of available color options.
recentColorsColor[]An array of recent colors to show in the recent colors row.

Methods

NameReturn typeSummary
startup()NoneFinalizes the creation of the widget.

Events

[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.

Events

NameEvent ObjectSummary
color-changeFires when the selected color has changed.
Constructor Details

new ColorPicker(params, srcNodeRef)

Creates a new ColorPicker widget.
Parameters:
<Object> params Required Set of parameters used to specify the ColorPicker widget options.
<Node | String> srcNodeRef Required Reference or ID of the HTMLElement where the widget should be rendered.
params properties:
<Boolean> collapsed Optional Indicates whether the widget displays collapsed. Default value is false.
<Boolean> collapsible Optional Indicates whether the widget can be collapsed. Default value is false.
<Color> color Required The selected color. If no color is provided, the first color from the palette is selected by default.
<Number> colorsPerRow Optional The row size of the palette. Default is 13.
<Color[]> palette Optional The set of available color options. By default, a palette of 78 colors is provided.
<Color[]> recentColors Optional Array of recent colors to show in the recent colors row.
<Boolean> required Optional Toggles color selection being required. When false, the no-color swatch is available. Default is false.
<Boolean> showRecentColors Optional Toggles the recent color row. Default is true.
<Boolean> showTransparencySlider Optional Toggles the transparency slider. Default is true.
Sample:
require(["esri/dijit/ColorPicker", ...
  ], function(ColorPicker, ... ) {
    var colorPicker = new ColorPicker(params, srcNodeRef);
  ...
});
Property Details

<Boolean> collapsed

Indicates whether the widget displays collapsed. (Added at v3.22)
Default value: false

<Boolean> collapsible

Indicates whether the widget is collapsible. (Added at v3.22)
Default value: false

<Color> color

The selected color.

<Color[]> palette

The set of available color options.

<Color[]> recentColors

An array of recent colors to show in the recent colors row.
Method Details

startup()

Finalizes the creation of the widget.
Event Details
[ On Style Events | Connect Style Event ]

color-change

Fires when the selected color has changed.
Show Modal