Using UXP and Batchplay I’m able to get and set the foreground color. I’m also able to get the new foreground color when it just got changed. But I would like to get the live color before finally setting the foreground color. For example when using the eyedropper the sampling ring shows the live new color in comparison to the current foreground color. Or when you have the color swatches panel open, the most recent color changes even before finally setting the foreground color (when using any color changing method). Here are two screenshots to clarify:
I used Alchemist but could not find a way to inspect the color changing event. I only get the “set event” of the foreground color. Can anyone help me or point me in a direction?
I think the logic for that color display lives only on the “UI Layer” and is not propagated down to the layer that’s accessible through scripting. If the interaction doesn’t fire any events, there’s probably nothing you can do to access or inspect the whole process.
oh no… I was hoping the live color is accessible. Especially since the foreground color already updates before finally setting the color (when using eyedropper etc)…
Can you think of a workaround? Reading the pixel color at cursor position? Or constantly reading the foreground color when eyedropper tool is in use? Can you read the first recent color swatch?
When using the info panel it always shows the rgb-color under the cursor, even without the eyedropper tool selected. Maybe there is a way to read the info panel?
Thank you @simonhenke for the reply! And also thank you very much for your uxp introduction videos on youtube
You could save the current foreground color as a variable before you begin your live color sampling and reset the foreground color to that color when you finish your live color sampling or at some appropriate time further along in your code, saving your live color sample as another variable to be used later. The foreground color image on the toolbar in Ps will still change as you live sample colors, but can then be reset to the original foreground color when you tell it to.
Ah thank you @AnthonyK
Maybe I misunderstand. I don’t want to reset my foregroundcolor to my previous color. I want to get the live sampling color, while holding down the eyedropper, to show the live sampling color bigger in an extra panel. So that I can better decide wether I finally want this eyedropped color or not (in comparison to the previous foreground color).
For now I already get and save my foreground color. I also get the new foreground color after I used the eyedropper. But I want the live sampling color while holding down the eyedropper before releasing the mousebutton.