Copy link to clipboard
Copied
Here's a weird and very specific query you may be able to help with...
I have a page of text, with each text box coloured spot colour grey 1, 2, 3 and 4, all slightly different tones of grey.. So it is very tricky to see where each grey is used when the page is printed.
I want to run a script or something that will remix all swatches without renaming them, so that those 4 'grey' swatches are each boldly coloured... perhaps one pure red, one blue, one magenta etc. Something to make identifying the usage easy. Is there a way that I'm not finding?
Appreciate help in advance!
the script will process any number of swatches as long as source and destination swatch groups have the same number of swatches
Copy link to clipboard
Copied
Here's one way,
- deselect all
- click and drag any bright swatch, press Alt key while you drag, drop it on top of one of the Gray swatches.
- repeat for all other Gray swatches
Copy link to clipboard
Copied
Thanks Carlos, but as this is for every job I'm looking for something I can automate, with an eye to have my Esko workflow then action this as part of a larger workflow.
Copy link to clipboard
Copied
ok, I can put something together. A script can change the grey spot color values.
I would create two color groups before running the script, one with your gray colors and another with the colors you want to replace them with. Then the script will replace the color values from the "source" to the "destination" color groups
would that work for you?
Copy link to clipboard
Copied
Yep, that'd work a treat! Amazing how you can do this sort of thing!
Copy link to clipboard
Copied
here you go
// replace spot swatch colors
// CarlosCanto - 1/31/24
// https://community.adobe.com/t5/illustrator-discussions/randomise-high-contrast-swatches/m-p/14381477#M395131
function main() {
var idoc = app.activeDocument;
var sourceSwatchGrp = idoc.swatchGroups['source'];
var destSwatchGrp = idoc.swatchGroups['destination'];
var sSwatches = sourceSwatchGrp.getAllSwatches();
var sswatchcount = sSwatches.length;
var dSwatches = destSwatchGrp.getAllSwatches();
var dswatchcount = dSwatches.length;
var swKeep, swDiscard, a, replacementSwatch;
for (a=0; a<dswatchcount; a++) {
swKeep = sSwatches[a];
swDiscard = dSwatches[a]; // discard has to be spot in order to change the colors in the artboard
mergeSwatches(swKeep, swDiscard);
}
alert('Done!');
}
main ();
function mergeSwatches(keep, discard) {
var colorkeep = getSwatchColor(keep);
var colordiscard = getSwatchColor(discard);
colordiscard.cyan = colorkeep.cyan;
colordiscard.magenta = colorkeep.magenta;
colordiscard.yellow = colorkeep.yellow;
colordiscard.black = colorkeep.black;
//discard.remove();
}
function getSwatchColor(sw) {
if (sw.color.typename == "CMYKColor")
return sw.color;
else if (sw.color.typename == "SpotColor") {
//$.writeln(sw.color.spot.getInternalColor());
return sw.color.spot.color;
//$.writeln(sw.color.spot.getInternalColor());
}
}
Copy link to clipboard
Copied
Cool! I assume I can add as many colours in as required as long as I update the 'colordiscard' lines?
Copy link to clipboard
Copied
the script will process any number of swatches as long as source and destination swatch groups have the same number of swatches
Copy link to clipboard
Copied
Appreciated, thanks loads Carlos!