• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Randomise high contrast swatches

Community Beginner ,
Jan 26, 2024 Jan 26, 2024

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!

TOPICS
How-to , Scripting , Tools

Views

389

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 01, 2024 Feb 01, 2024

the script will process any number of swatches as long as source and destination swatch groups have the same number of swatches

Votes

Translate

Translate
Adobe
Community Expert ,
Jan 26, 2024 Jan 26, 2024

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 29, 2024 Jan 29, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2024 Jan 29, 2024

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

CarlosCanto_0-1706551990567.png

 

would that work for you?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

Yep, that'd work a treat! Amazing how you can do this sort of thing!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

here you go

CarlosCanto_0-1706717245574.png

// 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());
	}
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 01, 2024 Feb 01, 2024

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 01, 2024 Feb 01, 2024

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

LATEST

Appreciated, thanks loads Carlos!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines