Lorenzo Stanco edited this page Jun 25, 2015 · 4 revisions
Clone this wiki locally

For an usage example see HowTo or a complete Demo.


  • Options
  • Events

Syntax and options:

   var cp = new MooColorPicker(container, options);
  • container: The <div> container (will be empty).
  • options (object, optional): Initial options for the class.
    • colors: An array of strings, like ["#0123456", "#789ABC"].
    • defaultColor: Index of preselected color (default -1, none).
    • className: CSS class for single color <div> boxes (default 'moocolorcheckbox').
    • selectedClassName: CSS class for selected color <div> box (default 'moocolorcheckbox_selected').


  • change(color, item): Fires when selected color is changed. color is the selected color, item is the selected color <div> box.
  • mouseenter(div), mouseleave(div): Fires when mouse over or leave a color <div> box.


  • addColor(color): Adds a color to the list.
  • removeColor(color): Removes a color from the list.
  • selectColor(color): Select a color if it is in the list.
  • getCurrentColor(): Returs current color as "#HHHHHH" string.
  • getContainer(): Return container <div>.