Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
Photoshop script - set the textColor.rgb.hexValue to be equal to a file name

Ok, here is the thing: there are many .psd files, each file has 1 text layer inside, also, each file is named after a hex color code (example: #111111.psd). I have a code that can change font color of multiple layers in multiple files, BUT, I can only specify 1 hex color in that code.

Here is the code (not mine, found it on adobe discussions):

The thing is to set the textColor.rgb.hexValue to be equal to the filename of a .psd file (as a result I need to have the text colored with the color in the file name)

var textColor = new SolidColor();
textColor.rgb.hexValue = "57a878"

function colorTextLayer(layerCol)
{
    var layerCount = layerCol.length;
    for (var j = layerCount - 1; j >= 0; j--)
    {
        var l = layerCol[j]
        if(l.typename == "LayerSet")
            colorTextLayer(layerCol[j].layers)
        else
        {
            if (l.kind == LayerKind.TEXT)
                l.textItem.color = textColor;           
        }
    }
}

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]);
    colorTextLayer(doc.layers)
    doc.close(SaveOptions.SAVECHANGES)
}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!