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) – RGB colourspace array.
Returns:Hexadecimal triplet representation.
Return type:unicode

Notes

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

Examples

>>> RGB = np.array([0.66666667, 0.86666667, 1.00000000])
>>> # 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 or array_like) – Hexadecimal triplet representation.
Returns:RGB colourspace array.
Return type:ndarray

Notes

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

Examples

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