Skip to content

Instantly share code, notes, and snippets.

@lm913
Created December 23, 2015 15:27
Show Gist options
  • Save lm913/1d1403aed216db289da1 to your computer and use it in GitHub Desktop.
Save lm913/1d1403aed216db289da1 to your computer and use it in GitHub Desktop.
Creates a Colour Fill Adjustment Layer within a pre-processing script
function psAdjColourFill(layerName,r,g,b){
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
psNewLayer(layerName,null,null,null);
var descACF1 = new ActionDescriptor();
var refACF1 = new ActionReference();
refACF1.putClass(sTID("contentLayer"));
descACF1.putReference(cTID("null"), refACF1);
var descACF2 = new ActionDescriptor();
descACF2.putString(cTID("Nm "), """background""");
var descACF3 = new ActionDescriptor();
var descACF4 = new ActionDescriptor();
descACF4.putDouble(cTID("Rd "), r);
descACF4.putDouble(cTID("Grn "), g);
descACF4.putDouble(cTID("Bl "), b);
descACF3.putObject(cTID("Clr "), cTID("RGBC"), descACF4);
descACF2.putObject(cTID("Type"), sTID("solidColorLayer"), descACF3);
descACF1.putObject(cTID("Usng"), sTID("contentLayer"), descACF2);
executeAction(cTID("Mk "), descACF1, DialogModes.NO);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment