jsPalette is a mootools plugin designed to make it easy for a user to select a color from a preset palette.
It can be embedded inline, or used as a popup.
Given an element:
<div id='palette'></div>
To turn this into a palette with the default colors, just run this:
var jsp = new jsPalette('palette');
You can get and set the currently selected color programmatically with getColor, and setColor.
You can also use jsPalette.Popup to automatically load the palette into a simple dialog. Use it the same as the normal jsPalette:
<div id='color-preview' style='height:50px; width:50px'></div> var jsp = new jsPalette.Popup('color-preview');
Except this time the element passed should be the thing you want the user to click on to open the palette. The palette element is created automatically.
jsPalette is mobile friendly, and will automatically restyle when it detects that it is running on a small display.
Thanks to syronex for the inspiration and default color palette used in jsPalette.
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