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

Make a color hidden.

Community Beginner ,
Jan 20, 2017 Jan 20, 2017

Copy link to clipboard

Copied

Hello!

Does anyone know if it's possible to make a color with scripting that doesn't show up in the swatches panel of indesign?

greetings,

Stefan

TOPICS
Scripting

Views

761

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 , Jan 20, 2017 Jan 20, 2017

Votes

Translate

Translate
People's Champ ,
Jan 20, 2017 Jan 20, 2017

Copy link to clipboard

Copied

I ma not sure about that lthough I was told (and checked) that there was (is it still there ?) a bug that when you did something in the swatch panel (maybe add a swatch or something like that), then extra colors were added without showing up. I mean you could have 10 swatches visually in the panel but 12 colors in the collection of colors.

But anyway, I doubt you could reproduce this per scripting (unless I am wrong) but if you intend to use a color only for a temporary purpose, the, you could create it, use it, save/export or whatever operation, then remove the color.

FWIW

Loic

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 20, 2017 Jan 20, 2017

Copy link to clipboard

Copied

Yes true, there are hidden colors in the indesign model (indeed more colors in the color-collection than in the swatch-panel)...

The thing is: I was adding a gradient to indesign. To make the colorstops i have to make colors first and then assign them to the colorstops. And now the colorstops show up in the swatches panel (which i don't want... i only want the gradient to show up).

But if i remove the colors after having completed the gradient, the gradient goes wrong (all colorstops go to black...)

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 20, 2017 Jan 20, 2017

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 Expert ,
Jan 20, 2017 Jan 20, 2017

Copy link to clipboard

Copied

You could use insertLabel(), extractLabel() for the added unnamed colors to get control by labeling the unnamed colors with a string that could be the substitute for a name value.

Regards,
Uwe

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 20, 2017 Jan 20, 2017

Copy link to clipboard

Copied

No. That's not strange at all. Not with InDesign ExtendScript.

Colors is a collection (something like an array) and index number -1 denotes the last element of that collection.

Are there alternatives to get what you want?

Another way—more cleaner if you want to use a named, but also invisible color—would be to edit an IDML file or even better to edit an exported IDMS snippet (that's easier) with an object that has a fillColor applied.

In IDML / IDMS there is the property "Visible" for Color that can be set from "true" to "false". Unfortunately that is not in InDesign's DOM for ExtendScript.

With IDML / IDMS if you leave out property "AlternateColor" empty, set "Name" not to an empty string and use "false" as value for "Visible" you could create a snippet, that will import the invisble, named color, if the named color is not already in the document.

Regards,
Uwe

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 20, 2017 Jan 20, 2017

Copy link to clipboard

Copied

Great Uwe!!!

Thanks a lot! I've been banging my head on this problem for days!

This does the trick:

var myUnnamedColor = app.activeDocument.colors[-1].duplicate();

(kind of strange though... an index of -1?)

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 20, 2017 Jan 20, 2017

Copy link to clipboard

Copied

studio172 wrote:

… This does the trick:

var myUnnamedColor = app.activeDocument.colors[-1].duplicate();

(kind of strange though... an index of -1?)

Hi Stefan,

before you get too excited, that would only work if not all unnamed colors were removed.
There is a slim chance for that, if e.g. a scripter has played around too much 😉

For a more secure method to add an unnamed color with a dedicated color model—RGB, CMYK or LAB—see my post # 30 in the same thread here where I first add an unnamed color by using different menu commands of the Color panel (not the Swatches panel!):

Re: Coloring a Font with a RGB etc. without adding the color to the document swatches.

Regards,
Uwe

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 20, 2017 Jan 20, 2017

Copy link to clipboard

Copied

LATEST

Thanks Uwe! I'll keep that in mind!

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