Question
eye dropper not select color with this code
I have this code and I want to choose the color using the eye dropper, but it doesn't work. What's the problem?
I want to choose the color using the eye dropper when closing the dialogue
// Create the dialog
var dlg = new Window("dialog", "Select Color from Layers");
dlg.size = { width: 200, height: 100 };
// Add a button to the dialog
var selectColorButton = dlg.add("button", undefined, "Select Color");
// Define the button action
selectColorButton.onClick = function () {
// Close the dialog
dlg.close();
// Use a delay to ensure the dialog closes before opening the color picker
// Open the color picker
var pickedColor = app.showColorPicker(); // This allows the eyedropper to work
// Now you can do something with the selected color
if (pickedColor) {
// Process the selected color here
}
};
// Show the dialog
dlg.show();