Is there viable way to swap colors in a InDesign template and export them using a batch process or script? Ideally, I would like to be able to make a CSV file with a list of hexadecimal color values, and apply them to the template in some automated way.

To give you some background on the problem, I'm creating some marketing materials for a big list (1000+) of clients. Each client has specific brand colors that need to be applied to various layers in the template. I know there is a way to batch replace text in a document, but I don't know a way to do the same for swapping colors.

If there are any solutions for either Illustrator, Photoshop, or InDesign, that will help greatly.

  • 1
    ".. a list of hexadecimal color values .." - not all swatches can be easily represented in hex. CMYK: percentages, with optionally decimals. Lab: decimals, lots of them. Tints and mixed inks need a base color. Gradients need a lot of information. So basically you seem to be talking about RGB colors only? Also, what does "swapping colors" mean?
    – Jongware
    Sep 5, 2015 at 23:32

2 Answers 2


I can see two ways of doing that:

  1. Using IDD scripting
  2. Working with the IDML format and make the substitutions inside the file with Java/PHP or any other programming language.

If you are not already familiar with the IDML format, then the first option it's probably the best option for you, given the complexity of the format itself.

I'd probably use paragraph styles in the file and then run a script which loads the file, look for the paragraph styles, change the color, save the final file and closes it. All of this can be wrapped inside a loop which iterates each line of the CSV file.

I don't have the script, but having done something similar, I'd say it's fairly easy even if you never used scripting before.


Yes, this should be possible in InDesign, using a script. This script then could read your CSV file, create the color swatches from the hexadecimal values it finds there and then apply them to the items they need to be applied to.

To be more specific you would need to be way more specific with your requirements, but generally such a task can certainly be automated with scripting.

The same might be possible to script in Photoshop, however, I am not so well-versed in Photoshop scripting, so I cannot be sure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.