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

Merge color swatch using script

Community Beginner ,
Sep 27, 2022 Sep 27, 2022

Copy link to clipboard

Copied

Hi everyone,

How can I use script to merge color swatches in Illustrator? I want to be able to select 1 color, cmd click and send a 2nd (or more) colors and merge it using script.

 

There was an older post about this but the link no longer works. Thanks!

 

 

TOPICS
Scripting

Views

200

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
Adobe
Community Expert ,
Sep 27, 2022 Sep 27, 2022

Copy link to clipboard

Copied

Hi @Ekin21787927xsfk, I couldn't find a built-in way to merge swatches. In the absence of a simple API, a script could conceivably iterate over every page item in the document and swap all instances of color A with color B, and then remove color A. It wouldn't be 100% robust though, because we don't have access via scripting API to all the properties of appearance. For simple 1 fill, 1 stroke appearances it would be fine.

 

Instead, perhaps an Action could achieve this?

- Mark

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 ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

LATEST

I was actually looking at the links from the user posted below and it might be a way? But it wouldn't work when I tried it. 

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 ,
Sep 27, 2022 Sep 27, 2022

Copy link to clipboard

Copied

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 ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

Thanks for the links. It seems like these were the ones I've looked at and tried. My understanding is that you have to declare the swatch name (ex. var replaceColor = swatches.getByName('PANTONE 101 C').color; ) so it wont work on swatch that does not have a name? 

 

I'm just trying to click any color from my swatch panel and select a 2nd one and merged them together. So I dont think they would have a name or cmyk to hardcode in. 

 

Maybe I need a script to find the selected color swatch and then have a 2nd code block to merge?

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