Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Re: Create Layer with BG Color

$
0
0

You really need to read the scripting guide.

 

Application is a Photoshop Class. To reference that class you use app. So the first line in the function should be app.activeDocument. Even then that line does not do anything except return a document object. If you do not store the returned object in a variable you might as well delete that line.

 

app.backgroundColor is an app property, not a method. So the () are not used. That property either returns a SolidColor object that is the current background color or you can assign it a new color something like this

 

var myColor = new SolidColor();

myColor.rgb.red = 1;

myColor.rgb.green = 12;

myColor.rgb.blue - 34;

app.backgroundColor = myColor;

 

But that does not create a new layer and I am not sure what kind of layer you want. Do you want to create a new artLayer then fill it with your color or do you want to create a new SolidFill adjustment layer using that color.

 

To create a new artLayer you do something like

 

app.activeDocument.artLayers.add();

 

To create a new adjustment layer you would need to use Action Manager( scriptlistener ).


Viewing all articles
Browse latest Browse all 27456

Trending Articles