Colour Science for Python

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

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

In [1]:
import colour

spd = colour.ILLUMINANTS_RELATIVE_SPDS.get('F2')
colour.colour_rendering_index(spd)
Out[1]:
64.150733149414719

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

In [2]:
import colour

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

Colour also implements various plotting functions thanks to Matplotlib:

In [3]:
%matplotlib inline
In [4]:
from colour.plotting import visible_spectrum_plot

visible_spectrum_plot()
Out[4]:
True