cmap.Color#
cmap.Color
#
Class to represent a single color.
Instances of this class are immutable and cached (based on the rgba tuple), you can compare them with is
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value | str, tuple, list, array, Color, or int | The color to represent. Can be any "ColorLike". | required |
alpha: float
property
#
Return the alpha value.
hex: str
property
#
Return the color as hex.
hsl: HSLA
property
#
Return the color as Hue, Saturation, Lightness.
hsv: HSVA
property
#
Return the color as Hue, Saturation, Value.
name: str | None
property
#
Return the color as name.
rgba: RGBA
property
#
Return the color as (Red, Green, Blue, Alpha) tuple in 0-1 range.
rgba8: RGBA8
property
#
Return the color as (Red, Green, Blue, Alpha) tuple in 0-255 range.
rgba_string: str
property
#
Return the color as an 'rgba(r, g, b, a)' string; 0-255 range.
__repr__() -> str
#
Return a string representation of the color.
__rich_repr__() -> Any
#
Provide a rich representation of the color, with color swatch.
__str__() -> str
#
Return a string representation of the color.