How to get the color of the color table? I have one that is not perfect

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

fwfkun4037
Posts: 3
Joined: Tue Apr 21, 2020 4:21 am

How to get the color of the color table? I have one that is not perfect

Post by fwfkun4037 »

You can only access the color table in manual mode, run this script and change at least one color in the table, and then you can get both the counter and the color.
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty( charIDToTypeID( "Clr " ), charIDToTypeID( "ClrT" ) );
d.putReference( charIDToTypeID( "null" ), r );
var ret = executeAction( charIDToTypeID( "setd" ), d, DialogModes.ALL );
if (ret.count)
{
var list = ret.getList(charIDToTypeID( "T " ));
alert ("Count:" + list.count);
var str = "";
for (var i = 0; i < list.count; i++)
{
var obj = list.getObjectValue(i);
for (var n = 0; n < obj.count; n++)
{
str += n + " " + obj.getDouble(stringIDToTypeID("red")) + " " + obj.getDouble(stringIDToTypeID("green")) + " " + obj.getDouble(stringIDToTypeID("blue")) + "\n"
}
}
}
else
{
alert("Nothing changed");
}

How to change, or have a better way? thank you!
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: How to get the color of the color table? I have one that is not perfect

Post by Kukurykus »

What do you mean by 'color table' in Photoshop and what to do 'display' it?
fwfkun4037
Posts: 3
Joined: Tue Apr 21, 2020 4:21 am

Re: How to get the color of the color table? I have one that is not perfect

Post by fwfkun4037 »

Change document color model

ChangeMode.INDEXEDCOLOR

1.jpg
1.jpg (38.72 KiB) Viewed 3542 times
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: How to get the color of the color table? I have one that is not perfect

Post by Kukurykus »

fwfkun4037
Posts: 3
Joined: Tue Apr 21, 2020 4:21 am

Re: How to get the color of the color table? I have one that is not perfect

Post by fwfkun4037 »

I need to get it automatically without modifying the color table. What I published was not perfect