Skip to main content
btempleton1982
Inspiring
September 20, 2016
Question

Changing AIColor "Black" to AICustomColor "Black"

  • September 20, 2016
  • 1 reply
  • 377 views

I've been dealing with this issue for quite awhile, and while I've found some work-arounds, nothing seems to consistently work in every case.

My document has a kFourColor definition for "Black."

I want to change the definition to a kCustomFourColor "Black."

So, I can create all the color definitions, etc. but when it comes time to create my AICustomColorHandle, the only way I can find to get a valid one is by using AICustomColorSuite->NewCustomColor(...).

That function takes a name for the custom color as a parameter. When I pass the name "Black", I get the "NAM2" error because "Black" is a reserved name.

I have worked around this in some cases by using a dummy name when creating the custom color, then changing the name to "Black" later with AICustomColorSuite->SetCustomColorName(...). As I said, this doesn't always seem to work.

It feels like we're just not supposed to be able to create "Black" as a custom spot color​ Global Process Color, but that's what my workflow here wants. And it does work in some cases.

Anyone have any ideas? Is there some other way to get a valid AICustomColorHandle that I'm missing?

This topic has been closed for replies.

1 reply

Inspiring
September 20, 2016

well, I'm not good at CustomColorSuite, but anyway...

Did some tests. Seems that "Black" is a reserved name for spot colors only, not for global process colors.

At least this string works without errors:

error  = sAICustomColor -> NewCustomColor (&customData, ai::UnicodeString("Black"), &newColor);

"without errors" means that after GetCustomColorName (newcolor)  I get unicode string containing "Black" :-)

but I noticed that Illustrator crashes if  flag for customdata is set to kCustomSpotColor and color is applied afterwards to some object with:

MyAIColor.kind=kCustomColor;

MyAIColor.c.c.color = newColor;

So if you need global process color, you shoud avoid this flag.

btempleton1982
Inspiring
September 21, 2016

I have had very similar results. I may not be actually naming the type of color I'm looking to achieve correctly. I know that in Illustrator, I can get Black to appear in the swatches with the "Spot" indicator next to it, and in the color settings viewable through the swatch panel, it is a Global Process color.

I remember doing some testing with an older SDK, and I had a hard time corresponding the CustomColorSuite settings to what would show up in Illustrator, but I did eventually get there.

I've had to use a couple different workarounds to get Black to work the way I want, but I do have it working 99% of the time.

I just get the occasional crash on trying to modify Black, which prompted me to post the other day, since it seems like there should be a "right" way to do it, instead of what I'm doing which has a sort of smell.