Skip to main content
Participant
September 8, 2023
Answered

A script to look at one group og swatches and replace with another group of swatches

  • September 8, 2023
  • 1 reply
  • 483 views

Hello! I'm looking for a script or a way to script a little productivity matter for work. 

 

Let me provide a little context - I create social media graphics. I have a template file in Illustrator for some graphic design overlays to go. I have assigned all the objects a text a swatch and given that swatch a name. I have also created groups that will allow me to alt-drag swatches to recolour the artwork in the template I need.

 

 

When I wish to change the colour scheme of a graphic, I alt-drag the swatches from one theme (e.g. HCA 3 > Working Pallet.) This recolours the artwork to the template style I need.

 

So this; 

 

Becomes this;

 

My question is this-

Is there a way to automate this process with a script? 


I don't mind if the script switches out colours from one group to another or if I have to assign a new RGB value to the working pallet group swatch for each individual swatch. Any input on this would be greatly appreciated. Thank you for your time. 🙂 

This topic has been closed for replies.
Correct answer Sergey Osokin

Check the script https://gist.github.com/creold/50165f03645376365df782b60269c326. Optionally, I added the ability to replace spot colors by their order in the group, rather than by matching part of the name string

1 reply

Sergey Osokin
Sergey OsokinCorrect answer
Inspiring
September 10, 2023

Check the script https://gist.github.com/creold/50165f03645376365df782b60269c326. Optionally, I added the ability to replace spot colors by their order in the group, rather than by matching part of the name string

Sergey Osokin
Inspiring
October 8, 2023

Created a more flexible version of the script - ColorGroupReplacer