Skip to content
Another color manipulation library for Python (originally from picamera)
Branch: master
Clone or download
waveform80 Use pdflatex for PDF output
RTD *still* doesn't support xelatex so this is the only way to (easily)
produce PDF output
Latest commit 963f1a0 Aug 9, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
colorzero Use pdflatex for PDF output Aug 9, 2018
LICENSE.txt Rename project to colorzero, update copyrights Mar 6, 2018
coverage.cfg Test __repr__ output May 8, 2018
rtd_requirements.txt Use pdflatex for PDF output Aug 9, 2018



colorzero is a color manipulation library for Python (yes, another one) which aims to be reasonably simple to use and "pythonic" in nature.

It does not aim to be as comprehensive, powerful, or that matter as correct as, say, colormath. colorzero originally grew out of work on my picamera project, hence it's intended to be sufficiently simple that school children can use it without having to explain color spaces and illuminants. However, it does aim to be useful to a wide range of skills, hence it does include basic facilities for CIE Lab representations, and Delta-E calculations should you need them.

The major difference between colorzero and other libraries (grapefruit, colormath, etc.) is that its Color class is a namedtuple descendent. This means it is immutable; you cannot directly change the attributes of a Color instance. The major advantage of this is that instances can be used as keys in dictionaries (for simple LUTs), or placed in sets.

Manipulation of Color instances is done by typical operations with other classes the result of which is a new Color instance. For example:

>>> Color('red') + Color('blue')
<Color html='#ff00ff' rgb=(1, 0, 1)>
>>> Color('magenta') - Color('red')
<Color html='#0000ff' rgb=(0, 0, 1)>
>>> Color('red') - Red(0.5)
<Color html='#800000' rgb=(0.5, 0, 0)>
>>> Color('green') + Color('grey').red
<Color html='#808000' rgb=(0.501961, 0.501961, 0)>
>>> Color.from_hls(0.5, 0.5, 1.0)
<Color html='#00ffff' rgb=(0, 1, 1)>
>>> Color.from_hls(0.5, 0.5, 1.0) * Lightness(0.8)
<Color html='#00cccc' rgb=(0, 0.8, 0.8)>
>>> (Color.from_hls(0.5, 0.5, 1.0) * Lightness(0.8)).hls
HLS(h=0.5, l=0.4, s=1.0)


  • The code is licensed under the BSD license
  • The source code can be obtained from GitHub, which also hosts the bug tracker
  • The documentation (which includes installation, quick-start examples, and lots of code recipes) can be read on ReadTheDocs
  • Packages can be downloaded from PyPI, but reading the installation instructions is more likely to be useful
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.