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
Hi Stefan,
see this post and the following:
Re: Coloring a Font with a RGB etc. without adding the color to the document swatches.
Regards,
Uwe
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
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...)
Copy link to clipboard
Copied
Hi Stefan,
see this post and the following:
Re: Coloring a Font with a RGB etc. without adding the color to the document swatches.
Regards,
Uwe
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
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
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?)
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
Copy link to clipboard
Copied
Thanks Uwe! I'll keep that in mind!