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 like:

  • A string with 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 got by the method getSelectedColor():

var colorSelected = myColorPicker.getSelectedColor();

Setting Custom Colors

Custom Colors palette can be shown by setting custom colors parameter to true. This palette can be used to keep colors that are most used or popular with the user. The colors can be added there by the end-users in the following way:

  • Selecting the necessary color;
  • Pressing "Add To Custom Colors" button.

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


The parameter colors is the array of predefined colors written in hex color format:

Back to top