Skip navigation
Currently Being Moderated

How to create a custom color?

Apr 16, 2012 12:21 PM



I know how to create a custom color in CMYK mode and in RGB mode but not in gray level mode.


If tried this without any success.


AICustomColor MyColor;

AICustomColorHandle MyColorHandle;

AISwatchRef MyColorRef;

AIColor MyAIColor;


//Name of the swatch color.

const char *SwatchColorName="MYCOLOR";

ai::UnicodeString SwatchUnicodeColorName=ai::UnicodeString(SwatchColorName);


//For a CMYK custom color.







//For a RGB custom color.






//For a gray level custom color.



//To create the custom color.

error=sAICustomColor->NewCustomColor(&MyColor, NomCouleurTraitsUnicode, & MyColorHandle);


//NULL to insert the new swatch in the current document's swatch list

//-1 to insert the new swatch at the end of the general swatches group

MyColorRef =sAISwatchList->InsertNthSwatch(NULL, -1);


//To set the color definition for the swatch.




error=sAISwatchList->SetAIColor(MyColorRef, &CouleurTraits);


//To set the name of the swatch.

error=sAISwatchList->SetSwatchName(MyColorRef, SwatchUnicodeColorName);



If somebody knows how to create a gray level custom color, it would be great.


Any help would be appreciated, thank you in advance.




More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points