colour.notation.triplet Module

Hexadecimal Triplet Notation

Defines objects for hexadecimal triplet notation:

colour.notation.triplet.RGB_to_HEX(RGB)[source]

Converts from RGB colourspace to hexadecimal triplet representation.

Parameters:RGB (array_like, (3,)) – RGB colourspace matrix.
Returns:Hexadecimal triplet representation.
Return type:unicode

Notes

  • Input RGB colourspace matrix is in domain [0, 1].

Examples

>>> RGB = np.array([0.66666667, 0.86666667, 1])
>>> # Doctests skip for Python 2.x compatibility.
>>> RGB_to_HEX(RGB)  
'#aaddff'
colour.notation.triplet.HEX_to_RGB(HEX)[source]

Converts from hexadecimal triplet representation to RGB colourspace.

Parameters:HEX (unicode) – Hexadecimal triplet representation.
Returns:RGB colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Output RGB colourspace matrix is in domain [0, 1].

Examples

>>> HEX = '#aaddff'
>>> HEX_to_RGB(HEX)  
array([ 0.6666666...,  0.8666666...,  1.        ])