Color picker

Custom Color Picker

  • Custom color picker converts a select element into a dropdown:
     
    
     $('#mycolor').ace_colorpicker()
     .on('change', function() {
        alert(this.value);
        alert(this.selectedIndex);
     });
    
  • Color picker has two functions:
    1. pick which selects a color. Argument can be a string(color) or an integer(index)
    2.  $('#mycolor').ace_colorpicker('pick', '#FFAA77');//select '#FFAA77' color
       $('#mycolor').ace_colorpicker('pick', 3);//select 3rd index
       //or
       var color_picker = $('#mycolor').data('ace_colorpicker');
       color_picker.pick('#EE6699', true);
       //"true" means select #EE6699 and insert it if it doesn't exist
      
    3. destroy which destroys color picker and shows select element
      					
       $('#mycolor').ace_colorpicker('destroy');