Colour Science for Python

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

In [1]:
import colour

For example, computing the CIE 2017 Colour Fidelity Index of a light source can be done as follows:

In [2]:
sd = colour.SDS_ILLUMINANTS.get('FL2')
colour.colour_fidelity_index(sd)
Out[2]:
70.120825477833037

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

In [3]:
il = colour.CCS_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 via to Matplotlib:

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

colour.plotting.plot_visible_spectrum();