Skip to content

Commit

Permalink
modified: README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzos committed Jan 30, 2011
1 parent 92477a2 commit eb64b37
Showing 1 changed file with 28 additions and 39 deletions.
67 changes: 28 additions & 39 deletions README.md
Expand Up @@ -11,6 +11,8 @@ How to use

JS sample:

#JS

// Create the color picker with some colors
var cp = new MooColorPicker($('cp'), {
colors: [
Expand All @@ -27,11 +29,15 @@ JS sample:

HTML code:

#HTML

<div id="cp">Color picker container</div>
<div id="current_color">No color selected</div>

CSS rules:

#CSS

div.moocolorcheckbox {
width: 24px;
height: 24px;
Expand All @@ -52,49 +58,32 @@ CSS rules:
Docs
----------

Implements:

Options, Events
**Implements:** `Options, Events`

Syntax and options:
**Syntax:**

var cp = new MooColorPicker(container, options);
#JS

container:
The <div> container (will be empty).
var cp = new MooColorPicker(container, options);

options (object, optional):
Initial options for the class. Options are:
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 selected color,
item is the selected color <div> box.
- **`container`**: The `<div>` container (will be empty).

mouseenter(div), mouseleave(div):
Fires when mouse over or leave a color <div> box.
**Options** (*object*, optional): Initial options for the class. Options are:

Methods:
- **`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'`).

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>.
**Events:**

- **`change(color, item)`**: Fires when selected color is changed. `Color` is 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>`.

0 comments on commit eb64b37

Please sign in to comment.