Color¶
- class Color(red: int | str | Color | Color | None = None, green: int | None = None, blue: int | None = None, alpha: int | None = None)¶
Simple, immutable, hashable color class with flexible construction.
Examples
>>> Color() Color(red=0, green=0, blue=0, alpha=255) >>> Color(255, 0, 255) Color(red=255, green=0, blue=255, alpha=255) >>> Color(255, 0, 255, 128) Color(red=255, green=0, blue=255, alpha=128) >>> red = Color("red") >>> red Color(red=255, green=0, blue=0, alpha=255) >>> Color(red) Color(red=255, green=0, blue=0, alpha=255) >>> Color(svgelements.Color("#0f0")) Color(red=0, green=255, blue=0, alpha=255)
Methods
Returns a float representation of the instance.
Return a standard, hexadecimal representation of the instance.
Return a standard, hexadecimal representation of the instance, ignoring alpha.
Attributes
Methods¶
- Color.as_floats() tuple[float, float, float, float] ¶
Returns a float representation of the instance.