Since | Origin / Contributor | Maintainer | Source |
---|---|---|---|
2017-12-30 | Konrad Huebner | Konrad Huebner | color_utils.c |
This module provides basic color transformations useful for color LEDs.
Convert HSV color to GRB color.
color_utils.hsv2grb(hue, saturation, value)
hue
is the hue value, between 0 and 360saturation
is the saturation value, between 0 and 255value
is the value value, between 0 and 255
green
, red
, blue
as values between 0 and 255
Convert HSV color to GRB color and explicitly return a white value. This can be useful for RGB+W LED strips. The white value is simply calculated as min(g, r, b) and then removed from the colors. This does NOT take into account if the white chip used later creates an appropriate color.
color_utils.hsv2grbw(hue, saturation, value)
hue
is the hue value, between 0 and 360saturation
is the saturation value, between 0 and 255value
is the value value, between 0 and 255
green
, red
, blue
, white
as values between 0 and 255
Convert GRB color to HSV color.
color_utils.grb2hsv(green, red, blue)
green
is the green value, between 0 and 255red
is the red value, between 0 and 255blue
is the blue value, between 0 and 255
hue
, saturation
, value
as values between 0 and 360, respective 0 and 255
The color wheel function makes use of the HSV color space and calculates colors based on the color circle. The colors are created with full saturation and value. This function is a convenience function of the hsv2grb function and can be used to create rainbow colors.
color_utils.colorWheel(angle)
angle
is the angle on the color circle, between 0 and 359
green
, red
, blue
as values between 0 and 255