colors and lights - touretzkyds/cozmopedia GitHub Wiki
The Color class (cozmo.lights.Color) describes a color using standard (r,g,b,alpha) values in the range [0..255], where alpha is an opacity coefficient and is presently ignored. (In computer graphics, alpha can be used to make objects semi-transparent, or to blend colors together.) Anki recommends using alpha=255 (fully opaque) so that if they do support transparency in the future, current programs' behavior won't change.
Colors are converted to 32 bit integers; the int_color attribute returns the rgba value in this integer form.
Built-in colors include:
- cozmo.lights.red
- cozmo.lights.green
- cozmo.lights.blue
- cozmo.lights.white
- cozmo.lights.off
The Light class (cozmo.lights.Light) describes a light that switches back and forth between two color states, each of which is a cozmo.lights.Color instance. The two color states are called "on" and "off", but in reality they are completely arbitrary. In the simplest case, a steady light, the "on" state is some fully-saturated color such as blue (0,0,255) and the off state isn't used. For a flashing light, the off state would be (0,0,0). For a light that cycles between two colors, such as blue and red, the "off" state would be red (255,0,0).
Built-in steady lights include:
- cozmo.lights.red_light
- cozmo.lights.green_light
- cozmo.lights.blue_light
- cozmo.lights.white_light
- cozmo.lights.off_light
- "on" color
- "on" period (in ms)
- "on" to off transition time (in ms)
- "off" color
- "off" period (in ms)
- "off" to "on" transition time (in ms)