LayerColor

Returns or changes the color of a layer.  Layer colors are represented as RGB colors.  An RGB color specifies the relative intensity of red, green, and blue to cause a specific color to be displayed.

Syntax

rhinoscriptsyntax.LayerColor (layer, color=None)

rhinoscript.layer.LayerColor (layer, color=None)

Parameters

layer

Required.  String or Guid.  The name of an existing layer.

color

Optional.  Number or System.Drawing.Color.  The new color value.  If omitted, the current layer color is returned.

Returns

System.Drawing.Color

If a color value  is not specified,  the current color value if successful.

System.Drawing.Color

If a color value is specified, the previous color value if successful.

Example

import rhinoscriptsyntax as rs

import random

from System.Drawing import Color

 

def randomcolor():

    red = int(255*random.random())

    green = int(255*random.random())

    blue = int(255*random.random())

    return Color.FromArgb(red,green,blue)

 

layerNames = rs.LayerNames()

if layerNames:

    for name in layerNames: rs.LayerColor(name, randomcolor())

Also See

LayerMode