Skip to main content

Colour science for Python

Colour is an open-source Python package with algorithms and datasets for colour science.

pip install colour-science or uv add colour-science

Released under the BSD-3-Clause license.

Colour logo
NumFOCUS Affiliated Project

Colour is an affiliated project of NumFOCUS, a 501(c)(3) nonprofit in the United States.

Colour examples

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 Matplotlib:

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

colour.plotting.plot_visible_spectrum();
The visible spectrum from violet through red, plotted against wavelength in nanometres for the CIE 1931 2° standard observer.

Browse the examples notebook

Sponsors

We are grateful for the support of our sponsors. If you'd like to join them, please consider becoming a sponsor on OpenCollective.

Gold Sponsors

Silver Sponsors

Bronze Sponsors

Recurring Donations

Donations & Special Sponsors