colour.conversions.hex2rgb

colour.conversions.hex2rgb(str_rgb: str) Tuple[float, float, float]

Transform hex RGB representation to RGB tuple.

Parameters

str_rgb – 3 hex char or 6 hex char string representation

Return type

RGB 3-uple of float between 0 and 1

>>> from colour import hex2rgb
>>> hex2rgb('#00ff00')
(0.0, 1.0, 0.0)
>>> hex2rgb('#0f0')
(0.0, 1.0, 0.0)
>>> hex2rgb('#aaa')  
(0.66..., 0.66..., 0.66...)
>>> hex2rgb('#aa')  
Traceback (most recent call last):
...
ValueError: Invalid value '#aa' provided for rgb color.