Skip to main content
Inspiring
January 13, 2018
Answered

Layer color

  • January 13, 2018
  • 4 replies
  • 2308 views

I like to have all my Illustrator layers set to the same color - medium blue.

Is there a quick or automated way of doing that instead of the slightly wearisome method of setting each one individually?

This topic has been closed for replies.
Correct answer pixxxelschubser

Hi m5heath​,

I also afraid you need a script for your requirement. (An action can't do this for different number of layers.) But you have no acces to the 'layer color short names'. You have to define the color based of the rgb values instead.

Do you have scripting skills or do you know how to use scripts?

Perhaps a moderator can move this thread to Illustrator Scripting

For the beginning: here is a sample [JS] code for changing the layer color of active layer (without error management)

var aDoc = app.activeDocument;

var aLay, mediumBlueCol;

try {

    aLay = aDoc.activeLayer;

    mediumBlueCol = new RGBColor();

    mediumBlueCol.red = 79;

    mediumBlueCol.green = 79;

    mediumBlueCol.blue = 255;

    aLay.color = mediumBlueCol;

} catch (e) {};

Have fun

4 replies

Kurt Gold
Community Expert
Community Expert
January 14, 2018

You may also take a look at this topic:

Layer colors - set default

m5heathAuthor
Inspiring
January 14, 2018

Brilliant! Thanks so much for that - nice little action that does what it says on the tin!

pixxxelschubser
Community Expert
Community Expert
January 14, 2018

New created layers are never locked.

For all layers try this:

var aDoc = app.activeDocument;

var theLay = aDoc.layers;

var mediumBlueCol = new RGBColor();

mediumBlueCol.red = 79;

mediumBlueCol.green = 79;

mediumBlueCol.blue = 255;

for (i=0; i<theLay.length; i++) {

    theLay.color = mediumBlueCol;

}

var shakeIllustrator = app.documents.add();

shakeIllustrator.close (SaveOptions. DONOTSAVECHANGES);

Have fun

Inspiring
January 14, 2018

In older versions, you could highlight all your layers, then double click on one of them to call the dialog for setting layer color. Once you selected your preferred color and dismissed the dialog, all layers would be set with that color. At least in 2017, this no longer works. What I do now is highlight all layers, select Options for selection… from the layers panel dropdown menu, and set the color in that dialog.

Not optimal, but better than changing each layer's color individually.

m5heathAuthor
Inspiring
January 14, 2018

Thanks so much - that works too. Life is looking up!

angie_taylor
Legend
January 14, 2018

If you select one item, then Double-click the Color swatch and Check the Box to make it a global Color. Now when you change the Color for one of the items, all the others will also update.

alternatively, if you don’t want to use global colours, select one item, then go to “Select Same Fill Color”. This will select all of the items. The. Change the Color.

m5heathAuthor
Inspiring
January 14, 2018

I think you're talking about color of objects - I'm talking about layer color ie the color you set when you double-click on a layer and get the layer dialogue box

michelew83603738
Community Expert
Community Expert
January 14, 2018

You could probably write an action and run it at the beginning of every file. You might want to ask on the Illustrator ActionScripting Forum.

pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
January 14, 2018

Hi m5heath​,

I also afraid you need a script for your requirement. (An action can't do this for different number of layers.) But you have no acces to the 'layer color short names'. You have to define the color based of the rgb values instead.

Do you have scripting skills or do you know how to use scripts?

Perhaps a moderator can move this thread to Illustrator Scripting

For the beginning: here is a sample [JS] code for changing the layer color of active layer (without error management)

var aDoc = app.activeDocument;

var aLay, mediumBlueCol;

try {

    aLay = aDoc.activeLayer;

    mediumBlueCol = new RGBColor();

    mediumBlueCol.red = 79;

    mediumBlueCol.green = 79;

    mediumBlueCol.blue = 255;

    aLay.color = mediumBlueCol;

} catch (e) {};

Have fun

m5heathAuthor
Inspiring
January 14, 2018

Thanks a million for this script which I've tested and it works perfectly for one layer and that's a big help. It doesn't work for more than one layer (selected with Shift-click) and I wonder if there is an easy tweak to extend the functionality of the script to do that. Also, is there a way to run a script using a keyboard shortcut?

Sadly I do not have scripting skills.