Mobile app version of vmapp.org
Login or Join
Ann6370331

: Can a photoshop action or script load/save swatch, and choose color from it I was wondering if it is possible for a photoshop action to choose foreground or background color from the swatch.

@Ann6370331

Posted in: #Actions #AdobePhotoshop #PhotoshopScripting #Swatches

I was wondering if it is possible for a photoshop action to choose foreground or background color from the swatch.
I have tried doing it, but instead of picking from swatch it is always taking a fixed value.
I am trying the script to pick color from the swatch sequentially. For example, if there are 5 colors in the swatch, it should pick 1st, 2nd ...upto 5th color.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ann6370331

1 Comments

Sorted by latest first Latest Oldest Best

 

@Hamaas979

You should be able to do this in script. Tom Krcha has a script which you may be able to adapt (Add A Color To Swatches Panel In Photoshop Using ExtendScript/JSX):

var red = 255;
var green = 0;
var blue = 0;
var name = "Red";

var addColorDescriptor = new ActionDescriptor();
// Get reference to Swatches panel
var swatchesPanelReference = new ActionReference();
swatchesPanelReference.putClass(stringIDToTypeID('colors'));
addColorDescriptor.putReference(stringIDToTypeID('null'), swatchesPanelReference);
// Setup a swatch and give it a name
var descriptorSwatch = new ActionDescriptor();
descriptorSwatch.putString( stringIDToTypeID('name'), name);
// Add RGB color information to the swatch
var descriptorColor = new ActionDescriptor();
descriptorColor.putDouble(stringIDToTypeID('red'), red);
descriptorColor.putDouble(stringIDToTypeID('grain'), green); // grain = green
descriptorColor.putDouble(stringIDToTypeID('blue'), blue);
// Add RGB to the swatch
descriptorSwatch.putObject( stringIDToTypeID('color'), stringIDToTypeID('RGBColor'), descriptorColor);
// Add swatch to the color descriptor
addColorDescriptor.putObject( stringIDToTypeID('using'), stringIDToTypeID('colors'), descriptorSwatch);
// Send to Photoshop
executeAction( stringIDToTypeID('make'), addColorDescriptor, DialogModes.NO);


ref: tomkrcha.com/?p=3890

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme