DHTMLX ColorPicker : How to show the selected color in the c

Hi,

I want to show the selected color in colorbox after I retrieve the value of RGB combination from say database. I am using DHTMLX Suite Commercial Version.



For example,



Suppose I get value from database like #a9b2e5, then I want to display that color in the colorbox.



How to do this ?



setColor method can be used to set current color

var cp = dhtmlXColorPickerInput(…

cp.setColor("#A9B2E5");   //to update colorpicker
cp.onSelectHandler.apply(cp,cp.getSelectedColor()); //to update data in input

Hi

Can you

dhtmlXColorPicker.setOnSelectHandler(color)
{

}

In the above code, the color is coming in the format ‘#4572A7’.
Can I get in the format of rgba values such that i can set as following…
rgba(254,0,0,1);

Руку is my little code snippets:

formData = [ {type: 'colorpicker', name: 'status.offline.textColour', width: 55, imagePath: "../dhtmlxColorPicker/codebase/imgs/", value: "#FF8C00"} ]; dhxWins = new dhtmlXWindows(); dhxWins.enableAutoViewport(false); dhxWins.attachViewportTo(document.body); w1 = dhxWins.createWindow("w1", 10, 10, 350, 300); w1.center(); myForm = w1.attachForm(formData); cp = myForm.getColorPicker("status.offline.textColour"); inp = myForm.getInput("status.offline.textColour"); inp.value = ""; inp.style.backgroundColor = myForm.getItemValue("status.offline.textColour"); cp.attachEvent("onSelect",function(color){ inp.style.backgroundColor = color; inp.value = ""; });
If you want - you can get color code in the input, if not - just comment this:

inp.value = "";