Light: color

color
  • gets/sets the color of the light.

Type: 
  • float list [ r, g, b]
Values:
  • r: Red Channel

    Range: 0.00 to 1.00
  • g: Green Channel

    Range: 0.00 to 1.00
  • b: Blue Channel

    Range 0.00 to 1.00
Sample Code

################## get the color of the light
 
# import bge
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get a list of the lights in the scene
lightList = scene.lights

# get light named SearchLight
light = lightList["SearchLight"]

# get the color of the light
col = light.color

Sample Code

################## set the color of the light
 
# import bge
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get a list of the lights in the scene
lightList = scene.lights

# get light named SearchLight
light = lightList["SearchLight"]

# set the color of the light
light.color = [ 0.00, 0.00, 0.5]