Skip to main content
tinyl3716644
Participant
June 10, 2019
Question

how to use extendscript to get colorsampler infomation like the Info Panel?

  • June 10, 2019
  • 1 reply
  • 671 views

I learned cep extension of Photoshop recently and wrote a simple cep extension for showing HSL color.

I know the basic use of app.activeDocument.colorSamplers, but there are 2 problems I couldn't solve or find any related stuff:

1. how to get the color under current cursor?

2. how to get the before and after colorsampler value when selecting an adjustment layer? (colorSamplers just return the before color value)

The Info panel have both information as following screenshot shows.

Here's the extension code if you are interested in it:

GitHub - XiaoXiaoLui/photoshop_hsl_plugin: html extension for showing hsl color in photoshop

By the way, why doesn't photoshop support HSL color just in the color picker which I think is more commonly used than HSB? And I can't believe it that I coundn't even find a plugin to do it.

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
June 10, 2019

There are a couple of basic problem there is no interface to get the  current location of the mouse cursor in a Photoshop script  and the cursor could be moving.  If you can get the cursor location  from your OS it would need to be mapped the your computers displays and you would need to determine if it is in Photoshop image window.

There is no way as far as I know to do what you want to do.  You can use Photoshop color sampler tool to place color sample points in up to 10 location in a documents image and get the location color.  But you need to know the locations of the colors you want to get.

In other words you need to know the locations the mouse location is not available to your script.

JJMack