RGBA#
- class tqec.interop.RGBA(r, g, b, a)[source]#
Bases:
object
RGBA representation of a color.
- Parameters:
r (int)
g (int)
b (int)
a (float)
- r#
Red component of the color, in the range [0, 255].
- Type:
int
- g#
Green component of the color, in the range [0, 255].
- Type:
int
- b#
Blue component of the color, in the range [0, 255].
- Type:
int
- a#
Alpha component of the color, in the range [0, 1].
- Type:
float
Methods
__init__
(r, g, b, a)Returns the color as a tuple of floats.
to_hex
()Returns the color as a hexadecimal string.
with_alpha
(a)Returns a new RGBA with the same color but a different alpha value.
Attributes
Detailed methods
- __init__(r, g, b, a)#
- Parameters:
r (int)
g (int)
b (int)
a (float)
- Return type:
None
- as_floats()[source]#
Returns the color as a tuple of floats. The RGB values are normalized to the range [0, 1].
- Returns:
Length 4 tuple of floats representing the color.
- Return type:
tuple[float, float, float, float]