• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Layer color

Engaged ,
Jan 13, 2018 Jan 13, 2018

Copy link to clipboard

Copied

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?

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 13, 2018 Jan 13, 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

...

Votes

Translate

Translate
Adobe
Community Expert ,
Jan 13, 2018 Jan 13, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 13, 2018 Jan 13, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

I've tried creating an action but all it does is open the layer dialogue. I think

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

I also think that there is no other way.

You're lucky.

After many many … many years is it since Illustrator 22 (CC2018) now finally possible to call a script with an action. You can give your action a shortcut. And that's it.

But yes, the script snippet I've posted before only works with the active layer. The reason is a lack of informations.

Some notes/questions:

Do you only want to change existing toplevel layers?

Or do you want this for new created layers or sublayers with and without objects?

or

Are there layers with sublayers with and without objects

Are there nested layers and/or nested sublayers with and without objects

Are there hidden or locked layers or sublayers or objects? I believe you know that it's not possible to do anything with locked layers/sublayers. You have them at first to unlock for any changings and to lock them after again.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

Thanks for your response. In a perfect world, it would be nice to be able to select all layers, sub-layers, with and without objects and do the color change once but if that is difficult, a script to do selected top level layers only would still be extremely helpful. I generally start a project by creating and naming 6 to 10 layers and to be able to flip those all to medium blue would be great. What a shame there isn't a preferences setting to do it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

You may also take a look at this topic:

Layer colors - set default

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2018 Jan 14, 2018

Copy link to clipboard

Copied

LATEST

Yesss! Works very well - you are a star. I'm so grateful.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines