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

Adding Lab colors to swatch - not implemented - Workaround?

Guest
Jan 14, 2013 Jan 14, 2013

Dear all

I tried to add a LabColor with an Illustrator script.

function addLabColorToSwatch(L,a,b,swatchName){

var color = new LabColor();

color.l = L;

color.a = a;

color.b = b;

var swatchgroup = app.activeDocument.swatchGroups.add();

swatchgroup.name = "test swatchgroup from jsx script";

var swatch = app.activeDocument.swatches.add();

swatch.name =  swatchName;

swatch.color = color;

swatchgroup.addSwatch(swatch);

return true;

addLabColorToSwatch(1,2,3,"test");

The script crashes on the Line  'swatch.color = color;' with "Error 1202: Not implemented"

This seems to a bug. I allready filed it. I'm asking if anybody has a workaround.

Thank you very much

best regards,

Alexander

PS: Original discussion: http://forums.adobe.com/message/4986457#4986457

TOPICS
Scripting
1.7K
Translate
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
Adobe
Community Expert ,
Jan 14, 2013 Jan 14, 2013

you can add it as a spot

function addLabColorToSwatch(L,a,b,swatchName){

    var color = new LabColor();

    color.l = L;

    color.a = a;

    color.b = b;

    var swatchgroup = app.activeDocument.swatchGroups.add();

    swatchgroup.name = "test swatchgroup from jsx script";

    var newSpot = app.activeDocument.spots.add();

    newSpot.name = swatchName;

    newSpot.colorType = ColorModel.SPOT;

    newSpot.spotKind = SpotColorKind.SPOTLAB;

    newSpot.color = color;

    var newSpotColor = new SpotColor();

    newSpotColor.spot = newSpot;

    swatchgroup.addSpot(newSpot);

    return true;

}

addLabColorToSwatch(72,-38,52,"test");

Translate
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 14, 2013 Jan 14, 2013

That's right. Only a spot color can be LAB. The same in the UI.

Translate
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
Guest
Jan 15, 2013 Jan 15, 2013

@CarlosCanto:

I know  one can add spot colors based on Lab. But I would also like to add normal Process colors based on Lab values.

@pixxxel schubser

On the UI:

Go to Swatches. Add a new Swatch. Choose 'Process Color' and choose Color Mode 'Lab'. So you have added a swatch base on Lab values. That's what a try to do in code.

So basicaly I want to to add a 'Process Color' based on Lab Values.

Thanks

Translate
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
Guru ,
Jan 15, 2013 Jan 15, 2013

And have you looked at…

Array of number convertSampleColor (sourceColorSpace: ImageColorSpace, sourceColor: Array of number, destColorSpace: ImageColorSpace, colorConvertPurpose: ColorConvertPurpose[, sourceHasAlpha:bool=false][, destHasAlpha: bool=false])
Converts a sample-component color from one color space to another.

ParameterTypeDescription
sourceColorSpaceImageColorSpace:
ImageColorSpace.GrayScale
ImageColorSpace.RGB
ImageColorSpace.CMYK
ImageColorSpace.LAB
ImageColorSpace.Separation
ImageColorSpace.DeviceN
ImageColorSpace.Indexed
The source color space.
sourceColorArray of numberThe color to convert, an array of color components. First location of the array should contain alpha if source-has-alpha is true.
destColorSpaceImageColorSpace:
ImageColorSpace.GrayScale
ImageColorSpace.RGB
ImageColorSpace.CMYK
ImageColorSpace.LAB
ImageColorSpace.Separation
ImageColorSpace.DeviceN
ImageColorSpace.Indexed
The destination color space.
colorConvertPurposeColorConvertPurpose:
ColorConvertPurpose.defaultpurpose
ColorConvertPurpose.previewpurpose
ColorConvertPurpose.exportpurpose
ColorConvertPurpose.dummypurpose
The parameter which passes the purpose of conversion.
sourceHasAlphaboolTrue if alpha channel is present in source color. (default: false) (Optional)
destHasAlphaboolTrue if alpha channel is present in destination color. (default: false) (Optional)
Translate
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
Guest
Jan 17, 2013 Jan 17, 2013
LATEST

Process colors added on the UI based on Lab will become spot colors.

So for Process color based on Lab values, use convertSampleColor as mentioned by Muppet Mark, will do the thing.

But generaly of course Lab colors are spot colors.

Thank you all for your answers

Translate
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