# ColorAttrib¶

from panda3d.core import ColorAttrib

class ColorAttrib

Bases: RenderAttrib

Indicates what color should be applied to renderable geometry.

Inheritance diagram

enum Type
enumerator T_vertex = 0
enumerator T_flat = 1
enumerator T_off = 2
property class_slotint
property colorLColor

If the type is T_flat or T_off, this returns the color that will be applied to geometry. If the type is T_vertex, this is meaningless.

property color_type → Type

Returns the type of color specified by this ColorAttrib. The options are:

T_vertex - use the vertex color specified in the geometry itself.

T_flat - use the color specified in this ColorAttrib for all geometry. You can get this color via getColor().

T_off - use the color white.

static getClassSlot()int
static getClassType()TypeHandle
getColor()LColor

If the type is T_flat or T_off, this returns the color that will be applied to geometry. If the type is T_vertex, this is meaningless.

getColorType() → Type

Returns the type of color specified by this ColorAttrib. The options are:

T_vertex - use the vertex color specified in the geometry itself.

T_flat - use the color specified in this ColorAttrib for all geometry. You can get this color via getColor().

T_off - use the color white.

static makeDefault()RenderAttrib

Returns a RenderAttrib that corresponds to whatever the standard default properties for render attributes of this type ought to be.

static makeFlat(color: LColor)RenderAttrib

Constructs a new ColorAttrib object that indicates geometry should be rendered in the indicated color.

static makeOff()RenderAttrib

Constructs a new ColorAttrib object that indicates geometry should be rendered in white.

static makeVertex()RenderAttrib

Constructs a new ColorAttrib object that indicates geometry should be rendered according to its own vertex color.