Skip to content
This repository

For an usage example see HowTo or a complete Demo.

Implements:

  • 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').

Events:

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

Methods:

  • 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>.
Something went wrong with that request. Please try again.