Skip to main content

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)

Release files for colorzero 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for colorzero 2.0
File Size Uploaded
colorzero-2.0.tar.gz 25.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for colorzero 2.0
File Interpreter ABI Platform
colorzero-2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size:52.0 kB

Release files / colorzero-2.0.tar.gz

Download URL colorzero-2.0.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e7d5a5c26cd0dc37b164ebefc609f388de24f8593b659191e12d85f8f9d5eb58
BLAKE2b-256 checksum
How to use checksums
b3ca688824a06e8c4d04c7d2fd2af2d8da27bed51af20ee5f094154e1d680334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

Release files / colorzero-2.0-py2.py3-none-any.whl

Download URL colorzero-2.0-py2.py3-none-any.whl
Size 26.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0e60d743a6b8071498a56465f7719c96a5e92928f858bab1be2a0d606c9aa0f8
BLAKE2b-256 checksum
How to use checksums
7ea6ddd0f130e44a7593ac6c55aa93f6e256d2270fd88e9d1b64ab7f22ab8fde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

Release history Release notifications | RSS feed

This release

2.0 This release

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page