2 Replies Latest reply on Aug 24, 2016 2:15 PM by mohameds30135418

    i want to make fill color based on foreground color

    mohameds30135418 Level 1

      i want to make fill color based on foreground color and thanks alot

       

      makeSolidFill (255,255,255)

      removeMask () 

       

      function makeSolidFill(redC,greenC,blueC){ 

        // ======================================================= 

          var idMk = charIDToTypeID( "Mk  " ); 

              var desc15 = new ActionDescriptor(); 

              var idnull = charIDToTypeID( "null" ); 

                  var ref4 = new ActionReference(); 

                  var idcontentLayer = stringIDToTypeID( "contentLayer" ); 

                  ref4.putClass( idcontentLayer ); 

              desc15.putReference( idnull, ref4 ); 

              var idUsng = charIDToTypeID( "Usng" ); 

                  var desc16 = new ActionDescriptor(); 

                  var idType = charIDToTypeID( "Type" ); 

                      var desc17 = new ActionDescriptor(); 

                      var idClr = charIDToTypeID( "Clr " ); 

                          var desc18 = new ActionDescriptor(); 

                          var idRd = charIDToTypeID( "Rd  " ); 

                          desc18.putDouble( idRd, redC);//Red variable 

                          var idGrn = charIDToTypeID( "Grn " ); 

                          desc18.putDouble( idGrn, greenC);//green variable 

                          var idBl = charIDToTypeID( "Bl  " ); 

                          desc18.putDouble( idBl, blueC );//blue variable 

                      var idRGBC = charIDToTypeID( "RGBC" ); 

                      desc17.putObject( idClr, idRGBC, desc18 ); 

                  var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" ); 

                  desc16.putObject( idType, idsolidColorLayer, desc17 ); 

              var idcontentLayer = stringIDToTypeID( "contentLayer" ); 

              desc15.putObject( idUsng, idcontentLayer, desc16 ); 

          executeAction( idMk, desc15, DialogModes.NO );   

          } 

       

      function removeMask(){ 

          var idDlt = charIDToTypeID( "Dlt " ); 

              var desc21 = new ActionDescriptor(); 

              var idnull = charIDToTypeID( "null" ); 

                  var ref5 = new ActionReference(); 

                  var idChnl = charIDToTypeID( "Chnl" ); 

                  var idChnl = charIDToTypeID( "Chnl" ); 

                  var idMsk = charIDToTypeID( "Msk " ); 

                  ref5.putEnumerated( idChnl, idChnl, idMsk ); 

              desc21.putReference( idnull, ref5 ); 

          executeAction( idDlt, desc21, DialogModes.NO ); 

          }