# Layer Methods

# Layer

The Layer method can be used to add, duplicate, edit, and remove layers.
The action performed is set by the mode property value, which can be add, addEdit, duplicate, edit, or remove.
For convenience, you can use the addLayer, addEditLayer, duplicateLayer, editLayer, and removeLayer methods which automatically set the mode.
The default layer mode is addEdit this mode will edit a layer if it exists and if it does not exist it will add the layer.
Besides the properties available in Layer Options, the layer can be moved relative to other layers, or tagged artwork.

# Layer Options

Layer Options

Layer Options

Use the name or number properties to target which layer to edit, duplicate or remove.
Set the layer's options using the name, newName, template, locked, visible, print, preview, dim and dimPercent properties.
When adding a new layer you can use the name property to set its name. When editing or duplicating a layer, use newName to set the new name.
See layer color for details on setting the layers color.

# Location

Layers are by default added and duplicated above existing layers or, if provided above a targetLayer or targetTagSearch.
You can set the layer's exact location, by providing a targetLayerName, targetLayerNumber and / or a targetTagSearch.
Set the location property's value to aboveAll or belowAll to place the layer at the top or bottom of the document.
Set the location property's value to top and bottom to place the layer at the top or bottom of a layer or group.
Set the location property's value to above and below to place the layer above or below a tagged target artwork or a layer.
The default value of location is above.

# Layer Color

Use the color property to set the color of the layer, i.e. the color that shows next to the layer on the layer panel and the paths of the panel's artwork.
Hex, decimal values and named values can be provided to set the layer. #ff0000, ff0000, f00 (6 or 3 digit hex values), 255, 0, 0, (rgb values), 0 100 100 0 (cmyk) 50 127 50 lab lab, red (CSS named color or custom color name) all would set the layer color to red.
Named colors can be enabled and disabled in the settings tab. Named colors with spaces like, light blue should be either quoted "light blue" or written as lightBlue (Not case sensitive), light-blue or light_blue.

# Removing Layers

To remove a layer, use the remove mode or the removeLayer method.
Set the number or name of the layer to be removed. The layer's sublayers and artwork will be deleted.

# Layer Properties

Property Modes used with Description
color 
addEdit add duplicate edit The layer color as shown in the layers panel and the layers artwork paths.
Sample Values:
#ff0000, ff0000, f00 (6 or 3 digit hex values), 255, 0, 0, (rgb values), 0 100 100 0 (cmyk) 50 127 50 lab lab, red (CSS named color or custom color name)
dimPercent 
addEdit add duplicate edit The percentage that images should be dimmed, if set to -1 the images will not be dimmed.
Valid Values: -1 10, 50, 70
location 
addEdit add duplicate edit The location where the layer should be relative to the target.
Sample Values:
aboveAll or belowAll to place the layer at the top or bottom of the document
top and bottom place the layer at the top or bottom of a layer or group.
above and below to place the layer at the above or below artwork or a layer.
locked 
addEdit add duplicate edit Whether or not the layer is locked.
Valid Values: true or false
mode 
addEdit add duplicate edit remove When using the layer method, the mode, which sets the process to be done to the layers, must be set.
When using addLayer, addEditLayer, duplicateLayer, editLayer, or removeLayer methods, the mode is set automatically.
Valid Values: add addEdit [Default] duplicate edit remove
name / layerName 
addEdit add duplicate edit remove The case sensitive name of the layer to be processed. Use either name or number and not both.
Sample Values: Layer 1, Images
newName 
addEdit add duplicate edit The new name the layer should be called.
Valid Values: true or false
number / layerNumber 
addEdit add duplicate edit remove The index of the layer to be processed. Use either layerName or layerNumber and not both.
Sample Values: 1, 4
preview 
addEdit add duplicate edit Whether or not the layer should preview.
Valid Values: true or false
print 
addEdit add duplicate edit Whether or not the layer should print.
Valid Values: true or false
targetLayerName / parent 
addEdit add duplicate edit The name of the target layer, relative to which the location of the new or edited layer is given.
Sample Values: Layer 1, Images
targetLayerNumber 
addEdit add duplicate edit The number of the target layer, relative to which the location of the new or edited layer is given.
Sample Values: 1, 4
targetTagSearch 
addEdit add duplicate edit The tagSearch relative to which the location of the new or edited layer is given. If a target layer is also provided, then the artwork matching the tagSearch in the given layer will be used.
Sample Values: Layer 1, Images
template 
addEdit add duplicate edit Whether or not the layer is a template.
Valid Values: true or false
visible 
addEdit add duplicate edit Whether or not the layer is visible.
Valid Values: true or false
addEdit add duplicate edit remove Set to false if you want the method to be skipped in a particular row.
Valid Values: true or false
skip 
addEdit add duplicate edit remove Set to true is you want the method to be skipped in a particular row.
See * and Skip for details.
Valid Values: true or false

# Example Spreadsheet and Screenshots

# Spreadsheet using layer and mode

*
layer
mode name newName color targetLayer target location visible locked print preview template dimPercentage
add
add Gold gold Orange Layer above TRUE
duplicate Green Layer Locked and Hidden #bca Blue Layer blue below FALSE TRUE
edit Orange Layer GrassGreen Green Layer bottom FALSE
edit Green Layer Gray Layer grayscale 20 TRUE FALSE 25
edit Blue Layer 0 0 255 aboveAll
remove Blue Layer

Row 0

Original Artwork

Panel For Row 0

Original Artwork

Row 1

Row 1 Artwork

A layer is added above existing layers, it is named as per its layer number

Panel For Row 1

Row 1 Panel

mode: add

Row 2

Row 2 Artwork

The layer "Gold" is added above "Orange Layer", it is colored gold, it is made a "template" layer

Panel For Row 2

Row 2 Panel

mode: add name: Gold color: gold targetLayer: Orange Layer location: above template: true

Row 3

Row 3 Artwork

The layer "Green Layer" is duplicated above the artwork tagged "blue" which is in the "Blue Layer", the layer is named "Locked and Hidden" and colored #bca, it's artwork is not visible and the layer is locked

Panel For Row 3

Row 3 Panel

mode: duplicate name: Green Layer newName: Locked and Hidden color: #bca targetLayer: Blue Layer target: blue location: above visible: false locked: true

Row 2

Row 2 Artwork

The layer "Gold" is added above "Orange Layer", it is colored gold, it is made a "template" layer

Panel For Row 2

Row 2 Panel

mode: add name: Gold color: gold targetLayer: Orange Layer location: above template: true

Row 3

Row 3 Artwork

The layer "Green Layer" is duplicated above the artwork tagged "blue" which is in the "Blue Layer", the layer is named "Locked and Hidden" and colored #bca, it's artwork is not visible and the layer is locked

Panel For Row 3

Row 3 Panel

mode: duplicate name: Green Layer newName: Locked and Hidden color: #bca targetLayer: Blue Layer target: blue location: above visible: false locked: true

Row 4

Row 4 Artwork

"Orange Layer" is moved to the bottom of the "Blue Layer", colored "Grass Green", it's artwork is not previewed, i.e. only the artworks outlines will be visible

Panel For Row 4

Row 4 Panel

mode: edit name: Orange Layer color: GrassGreen targetLayer: Green Layer location: bottom preview: false

Row 5

Row 5 Artwork

"Green Layer" is renamed to "Gray Layer" colored gray 20, the layer is locked, will not print and images are dimmed to 25%

Panel For Row 5

Row 5 Panel

mode: edit name: Green Layer newName: Gray Layer color: grayscale 20 locked: true print: false dimPercentage: 25

Row 6

Row 6 Artwork

"Blue Layer" colored RGB 0 0 255 and moved above all other layers

Panel For Row 6

Row 6 Panel

mode: edit name: Blue Layer color: 0 0 255 location: aboveAll

Row 7

Row 7 Artwork

"Blue Layer" and its artwork is removed (deleted)

Panel For Row 7

Row 7 Panel

mode: remove name: Blue Layer

# Spreadsheet using addLayer

*
addLayer
name color targetLayer location template
Gold gold Orange Layer above TRUE

# Spreadsheet using addEditLayer

*
Comment addEditLayer
* name color locked visible
Edits the "Red" layer if it exists, otherwise adds the new layer Red red FALSE TRUE
Edits the "Layer 2" layer if it exists, otherwise adds the new layer Layer 2 #f80 FALSE FALSE
Edits the "Gold" layer if it exists, otherwise adds the new layer Gold gold TRUE TRUE

# Spreadsheet using duplicateLayer

*
duplicateLayer
name newName color targetLayer target location visible locked
Green Layer Locked and Hidden #bca Blue Layer blue below FALSE TRUE

# Spreadsheet using editLayer

*
editLayer
name newName color targetLayer location locked print preview dimPercentage
Orange Layer GrassGreen Green Layer bottom FALSE
Green Layer Gray Layer grayscale 20 TRUE FALSE 25
Blue Layer 0 0 255 aboveAll

# Spreadsheet using removeLayer

*
removeLayer
name LayerNumber
Blue Layer
1