Skip to main content
Geppetto Luis
Braniac
November 24, 2018
Question

Create gradient map from swatches

  • November 24, 2018
  • 3 replies
  • 3864 views

I have a need and I do not know if it's possible

I would like to create a gradient map from swatches

This topic has been closed for replies.

3 replies

Braniac
November 26, 2018

I accidentally found a way to get color from color swatches.

But I do not think that this will help in this incomprehensible task.

Do not press Ctrl-key before and during the execution of the script.

var c1 = app.foregroundColor;

for (var i = 1;;i++)

    {

    var d = new ActionDescriptor();

    var r = new ActionReference();

    r.putIndex(stringIDToTypeID("colors"), i);

    d.putReference(stringIDToTypeID("null"), r);

    try { executeAction(stringIDToTypeID("select"), d, DialogModes.NO); } catch(e) { break; }

    var c = app.foregroundColor;

    app.foregroundColor = c1;

    alert("Swatch " + i+ "\n\n#" + c.rgb.hexValue);

    }

   

alert(i + " Done!")

Geppetto Luis
Braniac
November 27, 2018

Sig r-bin

the script gives me the numerical value of each color

I would like the colors to create a gradient map

with the values created as in the figure

Tom Winkelmann
Inspiring
November 27, 2018

I think everyone has understood what you want.

You got the relevant informations and all you have to do is join them together.

The task of this forum isn't to create finished scripts on request (that would be the function for a paid job).

Geppetto Luis
Braniac
November 24, 2018

If I can choose and better.

pixxxelschubser
Braniac
November 24, 2018

probably minimum and possible maximum?

Geppetto Luis
Braniac
November 24, 2018

minimum 3 maximum 10,

pixxxelschubser
Braniac
November 24, 2018

from two, three, four, five … swatches - or from all swatches?

Can you show/give an example file?