Sample: dhtmlxColorPicker Using dhtmlxColorPicker to set element properties dhtmlxColorPicker main page
X
Select attribute :

Change attributes with dhtmlxColorPicker

     You can change any color-attribute of any html element on page with dhtmlxColorPicker using setOnSelectHandler event and your function.

 
 
Select attribute : 
<select id="colorType">
    <option value="text">Text color</option>
    <option value="bg">Background color</option>
    <option value="border">Border color</option>
</select>
 
<div id="testInput" style="border:2px black solid;width:300px;height:420px;";>...</div>
<div id="CPcont"></div>
 
<script>
 
var z=new dhtmlXColorPicker("CPcont",false,true);
z.setCustomColors("#ff00ff,#00aabb,#6633ff");//set predefined custom colors
z.setOnSelectHandler(setColor); //set on select handler function
z.hideOnSelect(false); //colorpicker will will be kept visible when color selected
 
function setColor(color) {
    var ct = document.getElementById("colorType");
    var inp = document.getElementById("testInput");
    switch (ct.value) {
      case "text":
          inp.style.color =  '#'+color;
          break;
      case "bg":
          inp.style.backgroundColor =  '#'+color;
          break;
      case "border":
          inp.style.borderColor =  '#'+color;
          break;                                    
    }
}
</script>