how to create a color picker with extendscript
Hi, I'm trying to analyze the following code for creating a simple dialog window with 2 black icon buttons.
These buttons call the color picker and selecting a new color the button should change its color with the new one.
The problem is that the button changes its color only when you move the mouse pointer over the button.
I would like to understand how to modify this code in order to change the button color when I confirm the new color through the color picker.
The original code is a script for Photoshop so I've just replaced the app.refresh() command with w.update() but maybe it is not necessary.
Please help me.
try replace you colorpicker() function with this one:
and the onClick callbacks for buttons by this:
It should work, but beware, there are a few bugs with ScriptUI and onDraw now (in CC2014 and later i think).
It Works!!! thank you very much for your support!
Thanks so much for posting this code. I appreciate it was a while ago, but i'm struggling to make this work on a dockable UI panel. The swatch appears in the correct default color, but after clicking and selecting a new color, the swatch fails to update. Is it possible to get this working or is there a limitation that's causing the color to revert to the default? Really appreciate any help to get this working, look forward to your reply :)