Color
A color representation in different formats.
Constructor
-
Color() -
Color(hex: str) -
Color(rgba: Sequence[int]) -
Color(r: int, g: int, b: int, a: int = 255)
Parameters
hex: Hex color string (with or without '#' prefix).rgba: A sequence of 3 or 4 integers [0-255] (RGB or RGBA).r: Red value [0-255].g: Green value [0-255].b: Blue value [0-255].a: Alpha value [0-255]. Defaults to 255.
Properties
| Name | Description | Type |
|---|---|---|
r | The red component of the color | int |
g | The green component of the color | int |
b | The blue component of the color | int |
a | The alpha component of the color | int |
hex | The hexadecimal representation of the color | str |
hsv | The HSV representation of the color | tuple[float,float,float,float] |
Methods
Copy
copy() → ColorCreate a copy of the color.
Returns
Color : A new color object that is a copy of the original.