colour.conversions.rgb2hex¶
- colour.conversions.rgb2hex(rgb: Tuple[float, float, float], force_long: float = False) str¶
Transform RGB tuple to hex RGB representation.
- Parameters
rgb – RGB 3-uple of float between 0 and 1
- Return type
3 hex char or 6 hex char string representation
>>> from colour import rgb2hex
>>> rgb2hex((0.0,1.0,0.0)) '#0f0'
Rounding try to be as natural as possible:
>>> rgb2hex((0.0,0.999999,1.0)) '#0ff'
And if not possible, the 6 hex char representation is used:
>>> rgb2hex((0.23,1.0,1.0)) '#3bffff'
>>> rgb2hex((0.0,0.999999,1.0), force_long=True) '#00ffff'