0 Replies Latest reply: Apr 16, 2012 12:21 PM by JLGJeanLouis RSS

    How to create a custom color?

    JLGJeanLouis Community Member



      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.