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.
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.
Copy link to clipboard
Copied
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.