i use this function :
/* divColor : div for show ColorPicker
obj: div for the selected color
obj2: input hidden for selected Color
*/
function initColorPicker(divColor,obj,obj2){
var red=0;
var green=0;
var blue=0;
var str = obj.style.background;
if (str.length ==0) str="rgb(255,255,255)";
str = str.replace(/rgb\(|\)/g, "").split(",");
red = parseInt(str[0]);
green = parseInt(str[1]);
blue = parseInt(str[2]);
var myCP1 = new dhtmlXColorPicker(divColor);
myCP1.setImagePath("dhtmlx/codebase/imgs/");
myCP1.init();
myCP1.setColor([red,green,blue]);
myCP1.setOnSelectHandler(function (color) {
obj.style.background=color;
obj2.value = color;
})
}
This function works properly only if the start color is not black (‘#000000’), the ‘cs_EndColor_Mini’ of ColorPicker don’t change when setColor is define #000000 & i don’t have a return color.
(Sorry for My english…)