plastro.phenotype_simulation.rgba_to_hex
- plastro.phenotype_simulation.rgba_to_hex(rgba: Tuple) str[source]
Convert RGBA color to hexadecimal format.
Utility function for converting matplotlib color tuples to hex strings for consistent color handling across different plotting libraries.
- Parameters:
rgba (Tuple) – RGBA color tuple with values either as floats (0-1) or integers (0-255).
- Returns:
Hexadecimal color string in format ‘#RRGGBBAA’.
- Return type:
Examples
>>> rgba_to_hex((1.0, 0.5, 0.0, 1.0)) # Orange, full opacity '#ff8000ff' >>> rgba_to_hex((255, 128, 0, 255)) # Same color, integer format '#ff8000ff'