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

sd = colour.ILLUMINANTS_SDS.get('F2')
colour.colour_rendering_index(sd)
Out[1]:
64.151520202968015

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]:
5001.3574639752351

Colour also implements various plotting functions thanks to Matplotlib:

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

plot_visible_spectrum();