Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
colors and lights
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:
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:
- "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)