JS sample:
// Create the color picker with some colors var cp = new MooColorPicker($('cp'), { colors: [ "#001B2E", "#479096", "#4A7390", "#036564", "#4F2634", "#B6BFAD", "#2D0D10"], defaultColor: 3 // Select #4A7390 }); // Display current color $('current_color').set('html', 'Current color is: ' + cp.getCurrentColor()); cp.addEvent('change', function(col, box) { $('current_color').set('html', 'Current color is: ' + col); });
HTML code:
<div id="cp">Color picker container</div> <div id="current_color">No color selected</div>
CSS rules:
div.moocolorcheckbox { width: 24px; height: 24px; margin: 4px 2px 4px 0px; border: 1px solid white; border-radius: 4px; -moz-border-radius: 4px; -moz-box-shadow: 1px 1px 5px #cccccc; overflow: hidden; } div.moocolorcheckbox_selected { width: 32px; height: 32px; margin: 0px 2px 0px 0px; }
Implements: Options, Events
Syntax:
var cp = new MooColorPicker(container, options);
Options (object, optional): Initial options for the class. Options are:
Events:
Methods:
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus