Colour Science for Python

Most of the public Colour API is available from the colour namespace.

In [1]:
import colour

For example, calculating the colour rendering index of light source can be done as follows:

In [2]:
sd = colour.ILLUMINANT_SDS.get('FL2')
colour.colour_rendering_index(sd)
Out[2]:
64.233724121664778

The correlated colour temperature of a CIE Standard Illuminant can be calculated easily:

In [3]:
il = colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50']
colour.xy_to_CCT(il, method='Hernandez 1999')
Out[3]:
5001.3574639752351

Colour also implements various plotting functions thanks to Matplotlib:

In [4]:
colour.plotting.colour_style()

colour.plotting.plot_visible_spectrum();