Color Picker
The latest rendition of the Color Picker âClassicâ, themed after Photoshop, GIMP, and other image editorsâthere are no frills here, itâs a basic Hue, Saturation, Luminance, and Alpha (HSVA) color selector. It works in browsers that support the <canvas> element; Firefox 2+, Safari 3+, Opera 9+, Google Chrome, IE9+.
Configuration:
- sizeâhow large the saturation/luminance area is.
- hueWidthâhow large the alpha/hue area is.
- autocloseâmakes picker self closing when clicking outside the box.
- colorâinput rgba() or #hex.
- callbackâsends your color to your custom function.
- toggle()âtrue or false, to display and hide.
- update()âto change the color externally.
- eyeDropLayerâlayer to grab colors from.
- eyeDropMouseLayerâlayer to get events from when grabbing colors.
Basic implementation:
picker = new Color.Picker({
color: "#643263", // accepts rgba(), or #hex
callback: function(rgba, state, type) {
document.body.style.background = Color.Space(rgba, "RGBA>W3");
}
});
picker.element.style.top = 220 + "px";
picker.element.style.left = 270 + "px";
You can find this project on Github.
Licensed under the MIT.