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

create a color in a color group

New Here ,
Oct 05, 2016 Oct 05, 2016

Copy link to clipboard

Copied

Hello

I 've create a color in swatch panel, that ok, i've create a group of color (colorGroups in JS), that ok to. But i want create a color in a color group and don't find a js code for that. Maybe i must create a color and remove it inside a color group after ?

Somebody can help ?

Thant a lot.

TOPICS
Scripting

Views

553

Translate

Translate

Report

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

correct answers 1 Correct answer

Contributor , Oct 05, 2016 Oct 05, 2016

Hi, try this example.

//@target "indesign-10"

var doc = app.documents.add();

var color_group = doc.colorGroups.add({name:"CG"});

var ref_swatch = doc.colors.add({

  model: ColorModel.PROCESS,

  space: ColorSpace.CMYK,

  colorValue: [100,50,0,0],

  name: "ref_swatch"}

);

var color_group_swatch = color_group.colorGroupSwatches.add(ref_swatch);

$.writeln([

  color_group_swatch.swatchItemRef.colorValue,

  color_group_swatch.swatchItemRef.name

]);

// => [[100,50,0,0],"ref_swatch"]

thank you

mg.

Votes

Translate

Translate
Contributor ,
Oct 05, 2016 Oct 05, 2016

Copy link to clipboard

Copied

LATEST

Hi, try this example.

//@target "indesign-10"

var doc = app.documents.add();

var color_group = doc.colorGroups.add({name:"CG"});

var ref_swatch = doc.colors.add({

  model: ColorModel.PROCESS,

  space: ColorSpace.CMYK,

  colorValue: [100,50,0,0],

  name: "ref_swatch"}

);

var color_group_swatch = color_group.colorGroupSwatches.add(ref_swatch);

$.writeln([

  color_group_swatch.swatchItemRef.colorValue,

  color_group_swatch.swatchItemRef.name

]);

// => [[100,50,0,0],"ref_swatch"]

thank you

mg.

Votes

Translate

Translate

Report

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