1 Reply Latest reply on Oct 5, 2016 6:32 PM by milligramme

    create a color in a color group

    RemyGraphiste

      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.

        • 1. Re: create a color in a color group
          milligramme Level 3

          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.