Photoshop script - set multiple text color values
Hi everyone,
Here is the thing:
1) Bunch of psd files. Each file has 1 text layer inside. Each file is named after a hex color code (example: #111111.psd, #00ff00.psd, #ab6fe2.psd etc., there are about 300 of them)
2) The script below is to colorize all the text layers at ones. I found it from other discussion here
The problem:
- I need all psd files to have the text inside colored according to the file name of each psd. How to set the text color to be "taken" from the file name of each psd and not just set as one specific color? This script makes all text in all psd to have the same color, which is not what is needed.
Thanks in advance
var textColor = new SolidColor();
textColor.rgb.hexValue = "111111"; //set color
//select folder where PSDs are held
var selectFolder = Folder.selectDialog( "Please select folder of PSDs");
var files = selectFolder.getFiles("*.psd");
//get an array of all PSDs in the folder
var fileList = selectFolder.getFiles("*.psd");
//iterate through file list
for (var i = 0; i < files.length; i++) {
var doc = app.open(files[i]);
for (var j= 0; j < doc.artLayers.length; j++) {
var lyr = doc.artLayers[j];
if (lyr.kind == LayerKind.TEXT) {
var lyr = doc.artLayers[j];
lyr.textItem.color = textColor;
}
}
doc.close(SaveOptions.SAVECHANGES)
}
