# How to change color of several layers at once

**URL:** <https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258>\
**Category:** Ruby API\
**Tags:** materials, layers, colors, opacity\
**Created:** [December 4, 2019, 12:07am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258 "2019-12-04T00:07:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![botomup](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/botomup/32/79578_2.png) [@botomup](https://forums.sketchup.com/u/botomup)\
**Post date:** [December 4, 2019, 12:07am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/1 "2019-12-04T00:07:49Z")

</div>

hello everybody,

I’m looking for a plugin that could change the color of several layers at once.

I often import CAD in my models that are usualy mades with a lot of layers. those layers have their own color organization that don’t match mine. It’s because I use “color by layer” and “line color by material” to export colored CAD drawings.  
so, I have to change color of the imported layers, and, I have to do it one by one.

do you know any plugin that could help me ?  
I didn’t find one looking in commons plugins databases.

thank you by advance.  
have a nice day.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [December 4, 2019, 12:11am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/2 "2019-12-04T00:11:54Z")

</div>

Can you give more information about the layer names before and after ?

Example …  
All CAD layer names begin with “Window” change to color(34,156,75)  
All CAD layer names containing “Roof” change color to (127,127,127)  
All CAD layer names ending in “Revision” change color to 100% Red  
… etc.

---

<div class="post-metadata">

**Author:** ![botomup](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/botomup/32/79578_2.png) [@botomup](https://forums.sketchup.com/u/botomup)\
**Post date:** [December 4, 2019, 12:22am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/3 "2019-12-04T00:22:52Z")

</div>

Hi Dan,  
I usually turn all the imported layers to a 70% grey. And I use colors for my own layers.  
Names are always a mess because a lot of people works on the same CAD and every one have his own name logic.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [December 4, 2019, 12:59am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/4 "2019-12-04T00:59:40Z")

</div>

> [@botomup](#):
>
> I usually turn all the imported layers to a 70% grey.

Can you give me the number for RGB? (0…256)  
Full gray is (127,127,127) which is halfway between Black and White (basically 50% each,) along the central axis of the RGB colorspace.

I’m not sure what you mean by 70%. Between the white and the black? (77,77,77)

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [December 4, 2019, 1:21am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/5 "2019-12-04T01:21:02Z")

</div>

Well … try this. You can adjust the Gray RGB components to suit.

[Example\_SetAllLayersGray.rb](https://forums.sketchup.com/uploads/short-url/qIxMtQ9fqudSUM7RvWt3BWSh6DX.rb) (878 Bytes)

```ruby
module Example
  module SetAllLayersGray

    extend self

    @@loaded = false unless defined?(@@loaded)

    def gray_all_layers
      shade = Sketchup::Color.new(77,77,77)
      layers = Sketchup.active_model.layers.to_a
      choice = UI.messagebox('Set "Layer0" black?',MB_YESNO)
      if choice == IDYES
        zero = layers.delete(Sketchup.active_model.layers["Layer0"])
        zero.color= "Black" if !zero.nil?
      end
      layers.each do |layer|
        layer.color= shade
      end
    end

    def gray_all_layers_command
      choice = UI.messagebox('Set all layer colors to gray?',MB_YESNO)
      gray_all_layers() if choice == IDYES
    end

    unless @@loaded
      UI.menu('Plugins').add_item('Set All Layers Gray') {
        gray_all_layers_command()
      }
      @@loaded = true
    end

  end
end

```

---

<div class="post-metadata">

**Author:** ![botomup](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/botomup/32/79578_2.png) [@botomup](https://forums.sketchup.com/u/botomup)\
**Post date:** [December 4, 2019, 8:39am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/6 "2019-12-04T08:39:48Z")

</div>

Hi Dan,  
I’ve never wrote ruby script before. I’ve no time to do it now. I’ll give it a try later. there are a few basic “protocols” that I need to learn before writing a script.

there is also a layer manager project from D.Bur that is now open source on the extension warehouse. perhaps it’s possible to start from that work and to add this color manager feature to it.

thank you for your help.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [December 4, 2019, 9:04am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/7 "2019-12-04T09:04:20Z")

</div>

> [@botomup](#):
>
> I’ve never wrote ruby script before. I’ve no time to do it now.

I posted an example for you [above](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/5).

---

<div class="post-metadata">

**Author:** ![MikeWayzovski](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/mikewayzovski/32/98346_2.png) [@MikeWayzovski](https://forums.sketchup.com/u/MikeWayzovski)\
**Post date:** [December 5, 2019, 6:18pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/8 "2019-12-05T18:18:36Z")

</div>

> [@botomup](#):
>
> I’ve no time to do it now

You would if you had learned it earlier! 😃  
At least, that’s what I always try to say to myself…  
For now, I just bookmark Dan’s post for my little collection of usefull little Ruby 💎 snippets  
In time I will have time…

---

<div class="post-metadata">

**Author:** ![dezmo](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/dezmo/32/51058_2.png) [@dezmo](https://forums.sketchup.com/u/dezmo)\
**Post date:** [December 6, 2019, 10:58am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/9 "2019-12-06T10:58:13Z")

</div>

Based on @DanRathbun code I made a quick and dirty plugin. So it is not bulletproof, and maybe not as nice as should be… but I hope it will work.  
(Checked only in SU2019, but should work in earlier version too…)

[Set\_layers\_color.rb](https://forums.sketchup.com/uploads/short-url/4GOPwlJCVett4ScJlEYzJ5qbwW.rb) (905 Bytes)  
Just copy “Set\_layers\_color.rb” to your plugin folder (usually : c:\Users\your\_user\_name\AppData\Roaming\SketchUp\SketchUp 2019\SketchUp\Plugins\ ) and restart SU.  
You will get a menu:“Set Layers Color”. Click on it!  
 ![image](https://global.discourse-cdn.com/sketchup/original/3X/6/1/61479e639280ed690052097cfef36093ba6ded40.png)  
The selected layers will be colored.  
You can put anything but “0” beside the Layer name, then they will be colored by r,g,b chosen in the last 3 lines… (r,g and be should be 0…255)

 ![image](https://global.discourse-cdn.com/sketchup/original/3X/4/f/4fe49df8c5c3e25e62b5836ed0a3369df757a42c.png)

```ruby
module Example_dezmo
  module SetLayersColor

    extend self

    @@loaded = false unless defined?(@@loaded)

    def color_layers_layers    
### You can copy-paste this part to Ruby console to get same result without install
      layers = Sketchup.active_model.layers.to_a
      layer_names = layers.map{|l| l.name}
      defaults = Array.new(layers.length,"0") + ["77","77","77"]
      input = UI.inputbox(layer_names +["r","g","b"], defaults, "Select Layers and enter color!")
      if input
        shade = Sketchup::Color.new(Integer(input[-3]),Integer(input[-2]),Integer(input[-1]))
        i=0
        layers.each do |layer|
          layer.color= shade if input[i] != "0"
          i+=1
        end
      end
### You can copy-paste this part to Ruby console to get same result without install
    end

    def color_layers_command
      color_layers_layers()
    end

    unless @@loaded
      UI.menu('Plugins').add_item('Set Layers Color') {
        color_layers_command()
      }
      @@loaded = true
    end

  end
end

```

PS:Unfortunately “UI.inputbox” have it’s limits. So if you have plenty of layers this my not fit to the screen … 😢

---

<div class="post-metadata">

**Author:** ![botomup](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/botomup/32/79578_2.png) [@botomup](https://forums.sketchup.com/u/botomup)\
**Post date:** [January 17, 2020, 3:18pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/10 "2020-01-17T15:18:54Z")

</div>

Hi Dezmo.

thank you for what you’ve done according to Dan’s code.  
you’re plugin works nice.

unfortunately, as you said, the number of layers is limited to the size of the window.

I can erase layers to keep only 30 to work on, and repeat the operation with the next 30 untill I’ts done. then I merge all the layers again in the same file.  
It’s a little complicate but it save time compared to change color of layers 1 by 1.

usually, architectural CAD files that I work on have less than 30 layers (around 15/20). huges files of big projects a little messy can exceed 100 layers but not very much. work can be done in 4 times max.

is it the same way to change the line types ?

thank you again.

---

<div class="post-metadata">

**Author:** ![dezmo](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/dezmo/32/51058_2.png) [@dezmo](https://forums.sketchup.com/u/dezmo)\
**Post date:** [January 17, 2020, 7:56pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/11 "2020-01-17T19:56:48Z")

</div>

> [@botomup](#):
>
> thank you again.

@botomup You are welcome!

> [@botomup](#):
>
> is it the same way to change the line types ?

However the line types can be set for several layers at once on the Layers Tray…  
 ![setdashes](https://global.discourse-cdn.com/sketchup/original/3X/d/0/d0c5849dcd98ee28b0bda9ddc5f4316f49b2577c.gif)

… I have been modified the example for you. It is even more “quick & dirty” and just tested ones. It is definitely for SU2019 (or later) only ! [set\_layers\_color&linestyle.rb](https://forums.sketchup.com/uploads/short-url/sI29YCO4OfTYGpfOX3Ilwf4xqTt.rb) (1.5 KB)

```auto
module Example_dezmo
  module SetLayersColorLineStyle

    extend self

    @@loaded = false unless defined?(@@loaded)

    def color_linetype_layers
### You can copy-paste this part to Ruby console to get same result without install
      layers = Sketchup.active_model.layers.to_a
      layer_names = layers.map{|l| l.name}
      line_styles = Sketchup.active_model.line_styles
      line_styles_names = line_styles.map{|l| l.name}
      list = Array.new((3+layers.length),"") + ["no change|"+line_styles_names.join('|')]
      defaults = Array.new(layers.length,"0") + ["77","77","77"] + ["no change"]
      input = UI.inputbox(layer_names +["r","g","b","line style"], defaults, list, "Select Layers and enter color and line style!")
      if input
        shade = Sketchup::Color.new(Integer(input[-4]),Integer(input[-3]),Integer(input[-2]))
        line_style = Sketchup.active_model.line_styles[input[-1]]
      puts input[-1]
        i=0
        layers.each do |layer|
          layer.color= shade if input[i] != "0"
          layer.line_style = line_style if (input[i] != "0" && input[-1] != "no change")
          i+=1
        end
      end
### You can copy-paste this part to Ruby console to get same result without install
    end

    def color_lt_layers_command
      color_linetype_layers()
    end

    unless @@loaded
      UI.menu('Plugins').add_item('Set Layers Color_LineStyle') {
        color_lt_layers_command()
      }
      @@loaded = true
    end

  end
end

```

 ![image](https://global.discourse-cdn.com/sketchup/original/3X/2/c/2cecbed98fcc482e5825ebbb0196a80fbddd6a42.png)

---

<div class="post-metadata">

**Author:** ![Sonder](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/sonder/32/27173_2.png) [@Sonder](https://forums.sketchup.com/u/Sonder)\
**Post date:** [January 19, 2020, 3:08am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/12 "2020-01-19T03:08:49Z")

</div>

Nice work! I need to do this for Matt’s section cut technique…set all layers opacity to zero.

---

<div class="post-metadata">

**Author:** ![DaveR](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/daver/32/7601_2.png) [@DaveR](https://forums.sketchup.com/u/DaveR)\
**Post date:** [January 19, 2020, 3:13am UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/13 "2020-01-19T03:13:55Z")

</div>

@Sonder has a great reason for something like this. Could you add an opacity setting to apply to selected layers?

---

<div class="post-metadata">

**Author:** ![MikeWayzovski](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/mikewayzovski/32/98346_2.png) [@MikeWayzovski](https://forums.sketchup.com/u/MikeWayzovski)\
**Post date:** [January 19, 2020, 12:30pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/14 "2020-01-19T12:30:31Z")

</div>

Basically, you need to toggle between zero opacity and full, all though it might work better with one color (white) for all layers.  
Preferably with a menu entry.

> [@\[code\] Set Layer Colors menu command example](https://forums.sketchup.com/t/code-set-layer-colorjs-menu-command-example/26231):
>
> An example that creates two menu commands at the bottom of the “View” menu. It sets all layers whose name begins with “Demo” to red, “New” to gray, and any others to white. It saves the previous color settings, and adds a complimentary command to reset the layer colors back to previous. EDIT: But,… this can add a bunch of undo operations to the undo stack. See the [next post](https://forums.sketchup.com/t/code-set-layer-colors-menu-command-example/26231/2), for an example that wraps the commands in named undo operations. 
> 
> > **Example without undoable operations (click to expand…**
> >

@DanRathbun

---

<div class="post-metadata">

**Author:** ![botomup](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/botomup/32/79578_2.png) [@botomup](https://forums.sketchup.com/u/botomup)\
**Post date:** [January 19, 2020, 12:31pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/15 "2020-01-19T12:31:10Z")

</div>

Nice job Dezmo !

once again you’re right. it’s possible to change several layers line style at once within SketchUp. so, this looks like a dead end.

---

<div class="post-metadata">

**Author:** ![dezmo](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/dezmo/32/51058_2.png) [@dezmo](https://forums.sketchup.com/u/dezmo)\
**Post date:** [January 19, 2020, 2:12pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/16 "2020-01-19T14:12:30Z")

</div>

> [@DaveR](#):
>
> Could you add an opacity setting to apply to selected layers?

Unfortunately for some reason the opacity (alpha) of layers can not be set by Ruby.

At least I could not find a good method… neither a reason why this is not working?  
@DanRathbun do you have some idea?

For example here the 4th parameter (11) should be the opacity value:

```auto
Sketchup.active_model.layers[0].color = [255, 255, 0, 11]

```

Theoretically this will set the color and the desired opacity of the layer, but somehow this is not applied to the model…  
If I’m query it, looks applied

```auto
Sketchup.active_model.layers[0].color 
>> Color(255, 255, 0, 11)

```

But no, it is not “represented” on UI, so not really applied.

I know from API doc:

```auto
# You can then assign colors to the material of DrawingElements.
# Note that this creates a new Material object, and the alpha value
# of the color does NOT get applied to the new Material. You must
# manually set the alpha to get transparent materials.

```

> **[Class: Sketchup::Color](https://ruby.sketchup.com/Sketchup/Color.html#initialize-instance_method)**
>
> The Color class is used to create and manipulate colors within SketchUp Models.

I have been tried to manually set the alpha to get transparency for code above e.g.:

```auto
shade.alpha = 11

```

…but I didn’t really expect any results, since there is no face here… and a layer have NO material …  
Unfortunately my knowledge is “stoping” here.  
Anybody else?

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [January 19, 2020, 4:49pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/17 "2020-01-19T16:49:06Z")

</div>

There are issues logged with regard to layers, materials and opacity …

> [@Layer.material instead of layer.color](https://forums.sketchup.com/t/layer-material-instead-of-layer-color/190):
>
> I asked this already on DevCamp in Lisbon, but I ask it again but now I show you why! Please give me the method layer.material, you gave me layer.color instead\* Why I need this… Maybe you don’t know (and if it’s a bug, please DON’T FIX IT), but when you assign a material to a layer instead of a color and you use ‘Color by Layer’ in combination with the ‘hidden line render’ mode. Everthing is white except the textures. This is a very nice feature to create very clean architectural drawing wi…

… _which led to the following API issue being logged_ …

> <https://github.com/SketchUp/api-issue-tracker/issues/7>
>
> It's still not resolved :(
> 
> https://forums.sketchup.com/t/layer-material-inste…ad-of-layer-color/190
> 
> The material is inaccessible from Ruby \_(it can only be read by CAPI).\_ 
> It is not possible to attach an observer for a layer material change event.
> MaterialsObserver nor LayersObserver is not triggered in case of layer materials modifications.

> [@Attach a material to a layer in SketchUp for windows?](https://forums.sketchup.com/t/attach-a-material-to-a-layer-in-sketchup-for-windows/763):
>
> As a mac user it’s very easy to attach a material instead of a solid color to a layer for use with ‘color by layer’. You click on the color box behind the layer and you click on the desired material of the material browser and you are done. But now I try this on a windows version… And I can’t find An easy way to this. OK I can browse for a texture but i don’t have the texture itself I want to use a material already in the material browser. I can export the texture from the material and than use …

> [@Feature request: SULayerSetMaterial](https://forums.sketchup.com/t/feature-request-sulayersetmaterial/51877):
>
> I’m looking to set the material on a layer using a material that’s already in the container. Forgive me (and let me know) if that’s in the latest SDK. I’m using one version older than current as far as I know. Without that function it’s not possible for material refs to be shared between layers or between layers and drawing elements. Maybe there’s a work around that I’m not familiar with, please enlighten me if that’s the case. Right now, in my Rhino exporter, I call SULayerGetMaterial to c…

… _which led to the following API issue being logged_ …

> <https://github.com/SketchUp/api-issue-tracker/issues/418>
>
> \### SketchUp C API ~~Feature Parity Request~~ ^Documentation Issue
> 
> A. ~~Pleas…e implement \`SULayerGetColor()\` and \`SULayerSetColor()\` for the C API so as to bring it into parity with the Ruby API~~.
> 
> \> \*\*EDIT\*\*: \*\*Not necessary\*\*. As Thomas describes below, layer colors are accessed using \[\`SUMaterialGetColor()\`\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/struct\_s\_u\_material\_ref.html#a8a3fd963eaf7d38c65b3e336cedf40da) and \[\`SUMaterialSetColor()\`\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/struct\_s\_u\_material\_ref.html#ab4f59a1e090547e244cee1374632e68c) via the layer's \[\`SULayerGetMaterial()\`\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/struct\_s\_u\_layer\_ref.html#acb1bdd418a35ee45aa165f60a34f79dd) function.
> 
> B. ~~Perhaps deprecate \`SULayerGetMaterial()\` and/or~~ \*\*Add\*\* documentation notes to the effect of Thomas' comments ...
> \> https://forums.sketchup.com/t/feature-request-sulayersetmaterial/51877/3
> \> \_Layer materials cannot be shared in SketchUp. The layer itself owns the material. This is different from the materials applied to entities (which is owned by the Materials collection (In Ruby this is exposed as model.materials where as in the C API you ask the ModelRef directly (I wish there had been a MaterialsRef collection in the C API as well, alas.))\_
> \>
> \> \_So you don’t want to mix layer materials and materials from DrawingElements - their ownership works differently.\_
> \>
> \> \_In the C API there is no SULayerSetMaterial, but SULayerGetMaterial gets you a reference to the MaterialRef for that layer and let you modify that.\_
> 
> ... and ...
> \> https://forums.sketchup.com/t/feature-request-sulayersetmaterial/51877/7
> \> \_Internally layers own their own materials (unrelated to the model’s material collection.) Now, for some reason the C API exposed the material. (Why is not known to me - it was before me. My guess is that the original implementer wasn’t aware of this detail and simply exposed the material instead of just the colors.) So that’s some internal implementation details that unfortunately got exposed to the API. Some extensions have actually made use of that, so we are kind of stuck with it.\_
> 
> \----
> 
> Publicly requested by Tim Hemmelman of Robert McNeil & Assoc., Rhino Development.
> 
> Reference public forum discussion:
> https://forums.sketchup.com/t/feature-request-sulayersetmaterial/51877/9

---

<div class="post-metadata">

**Author:** ![MikeWayzovski](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/mikewayzovski/32/98346_2.png) [@MikeWayzovski](https://forums.sketchup.com/u/MikeWayzovski)\
**Post date:** [January 19, 2020, 5:30pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/18 "2020-01-19T17:30:24Z")

</div>

I tried fiddling with your demo of demolayers, with no luck.

It does say ‘manually’ in the API for changing .alpha

I wonder if you can duplicate an existing Layer through Ruby.  
Then, one would only have to create one (and set the opacity)

Collect all existing layers (x)  
Duplicate the ‘Matt Method Layer’ x times  
Putt all stuff in them

Set renderoptions (ColorByLayer, NoProfiles, Noedges)

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [January 19, 2020, 5:37pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/19 "2020-01-19T17:37:15Z")

</div>

> [@dezmo](#):
>
> Theoretically this will set the color and the desired opacity of the layer, but somehow this is not applied to the model

Correct. SketchUp does not yet support layer transparency set via the API.

> [@Sonder](#):
>
> I need to do this for Matt’s section cut technique…set all layers opacity to zero.

ALL layers ? zero would mean 100% transparent which is similar to Xray mode with background, foreground, section fill and backcolor all the same. Having Color By Layer on or off makes no difference.

---

<div class="post-metadata">

**Author:** ![MikeWayzovski](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/mikewayzovski/32/98346_2.png) [@MikeWayzovski](https://forums.sketchup.com/u/MikeWayzovski)\
**Post date:** [January 19, 2020, 5:38pm UTC](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258/20 "2020-01-19T17:38:43Z")

</div>

But you cannot have sectioncuts with witeframe

> **[Matt Donley, Author at MasterSketchUp.com](https://mastersketchup.com/author/ljmvd/)**

[Next page](https://forums.sketchup.com/t/how-to-change-color-of-several-layers-at-once/110258.md?page=2)
