Colors
The Color class represents an RGB LED color. All channel values are integers in the range 0–255.
Named presets
from flaight import Color
Color.OFF # (0, 0, 0) — LEDs off
Color.WHITE # (255, 255, 255)
Color.RED # (255, 0, 0)
Color.GREEN # (0, 255, 0)
Color.BLUE # (0, 0, 255)
Color.YELLOW # (255, 200, 0)
Color.CYAN # (0, 255, 255)
Color.MAGENTA # (255, 0, 255)
Color.ORANGE # (255, 80, 0)
Color.PURPLE # (128, 0, 255)
Custom colors
Interpolation
lerp blends linearly between two colors. t=0.0 returns the starting color, t=1.0 returns the target color.
mid = Color.RED.lerp(Color.BLUE, 0.5) # equal mix of red and blue
quarter = Color.RED.lerp(Color.BLUE, 0.25)
This is used internally by FadeColor to generate intermediate steps.
Validation
Color validates its inputs on construction: