Check documentation for the latest version of dhtmlxSuite Manipulating Colors DHTMLX Docs

Manipulating Colors

Setting/Getting Color

The user can set the initial color for the Color Picker using the setColor method:


The parameter color can be set as:

  • a string with the Hex color format;
  • an array of decimal values of Red, Green, and Blue;
  • a string with decimal values of Red, Green, and Blue.

The color currently selected in the Color Picker can be easily returned by the getSelectedColor method:

var colorSelected = myColorPicker.getSelectedColor();

Setting Custom Colors

A custom colors palette can be shown by setting the custom_colors parameter to true. This palette can be used to keep colors that are most used by a user. The colors can be added there by end-users in the following way:

  • selecting the necessary color;
  • pressing the "Add To Custom Colors" button.

Custom colors can be also set by script through the setCustomColors method:


The colors parameter is an array of predefined colors in the Hex color format:

Back to top