phoenix6.signals.rgbw_color
¶
Module Contents¶
Attributes¶
- phoenix6.signals.rgbw_color.USE_WPILIB = True¶
- class phoenix6.signals.rgbw_color.RGBWColor¶
- class phoenix6.signals.rgbw_color.RGBWColor(red: int, green: int, blue: int, white: int = 0)
Represents an RGBW color that can be applied to an LED.
- property red: int¶
The red component of the color, within [0, 255].
- property green: int¶
The green component of the color, within [0, 255].
- property blue: int¶
The blue component of the color, within [0, 255].
- property white: int¶
The white component of the color, within [0, 255]. Note that not all LED strips support the white component.
- static from_hex(hex_str: str) RGBWColor | None ¶
Creates a new RGBW color from the given hex string.
- Parameters:
hex_str (str) – The color hex in the form “#RRGGBBWW” or “#RRGGBB”.
- Returns:
The color if the hex is valid, otherwise None
- Return type:
RGBWColor | None
- static from_hsv(h: phoenix6.units.degree, s: float, v: float) RGBWColor ¶
Creates a new RGBW color from the given HSV color.
- Parameters:
h (degree) – The hue as an angle from [0, 360) deg, where 0 is red.
s (float) – The saturation as a scalar from [0, 1].
v (float) – The value as a scalar from [0, 1].
- Returns:
The corresponding RGB color; the white component will be 0.
- Return type:
- to_hex_str() str ¶
Returns this RGBW color as a hex string.
- Returns:
A hex string in the format “#RRGGBBWW”
- Return type:
str