jangada.mixin.Colorable.color#

Colorable.color: str#

Color for visualization and styling.

Canonical HTML hex string (#RRGGBB format) for visual representation. Accepts various input formats via matplotlib’s color parsing, including hex strings, RGB tuples, and named colors. Always stored in uppercase hex format.

See also

Colorable.color_rgb

Read-only RGB tuple property

matplotlib.colors.to_hex

Underlying color conversion function

Notes

Requires matplotlib for color parsing. The canonical uppercase #RRGGBB format ensures consistency across the system and compatibility with most graphics APIs and web standards.

Use color_rgb property for integer RGB values (0-255) when needed by graphics libraries.

Examples

Hex string:

obj.color = '#FF0000'
assert obj.color == '#FF0000'

RGB tuple:

obj.color = (1.0, 0.0, 0.0)  # Float format
assert obj.color == '#FF0000'

Color name:

obj.color = 'red'
assert obj.color == '#FF0000'

Case normalization:

obj.color = '#ff0000'
assert obj.color == '#FF0000'  # Uppercase

Get as RGB tuple:

obj.color = '#FF0000'
assert obj.color_rgb == (255, 0, 0)