Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
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
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:
<Color> color Required The selected color. If no color is provided, the first color from the palette is selected by default.
<Number> colorsPerRow Required The row size of the palette. Default is 13.
<Color[]> palette Required The set of available color options. By default, a palette of 78 colors is provided.
<Color[]> recentColors Required Array of recent colors to show in the recent colors row.
<Boolean> required Required Toggles color selection being required. When false, the no-color swatch is available. Default is false.
<Boolean> showRecentColors Required Toggles the recent color row. Default is true.
<Boolean> showTransparencySlider Required Toggles the transparency slider. Default is true.
Sample:
require(["esri/dijit/ColorPicker", ...
  ], function(ColorPicker, ... ) {
    var colorPicker = new ColorPicker(params, srcNodeRef);
  ...
});
Property Details

<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.