node package manager


Simple color picker component


Simple color picker component. Chuck it on a page, in a Dialog, in a Popover etc.

$ component install component/color-picker
var ColorPicker = require('color-picker');
var picker = new ColorPicker;
picker.on('change', function(color){
  $('.rgb').text(color.toString()).css('background', color);
  • change (color) when the color selection changes

Define the color picker width / height.

Define the color picker width.

Define the color picker height.

Get the current selected color object with .r, .g, and .b values. The .toString() method on these color objects is the string representation such as "rgb(255,0,0)".

Set the color value to str.