A Toolbox for Manipulating and Assessing Colors and Palettes

colorspace is a Python package to create and handle colors and color palettes in Python. Based on the Hue-Chroma-Luminance (HCL) color space effective color palettes can be designed and implemented in your own daily workflow.

This package is based on the R colorspace package to make the tools easily available for Python enthusiasts. More information and an interactive interface can also be found on HCLwizard.org.

The package itself can be found on GitHub and this documentation is also available on GitHub Pages.

Contents

Other Packages and Further Reading

More information and further reading:

  • HCLwizard.org: More information about the HCL color space, introduction to the colorspace packages (available for R and Python), and some interactive tools to define effective HCL-based color palettes, pick colors, and check existing plots and figures for possible problems in terms of color vision deficiencies.

  • A list of scientific articles which provide more detailed insights, e.g.,

  • The end of the rainbow: An open letter to the climate science community by Ed Hawkins, Doug McNeall, David Stephenson, Jonny Williams & Dave Carlson.

  • Better Figures: Constructive criticism of the graphics of climate science by Doug McNeall.

Scientific articles with more detailed insights:

Some other packages providing color maps in Python (on top of the default color maps) wich might be of interest:

  • seaborn: Statistical data visualization. The package also provides access to a range of (mostly) well specified color palettes.

  • palettable: Color palettes for Python. Formely known as brewer2mpl. Provides a range of color palettes including “Brewer2” and “Carto” palettes.

  • ColorBrewer2.org: The source of the brewer colors, interactive web page by Cynthia Brewer, Mark Harrower, and The Pennsylvania State University.

Known issues

Warning

White point implemented but might require some additional testing.

TODO’s

Todo

Class does not allow for lambda function for h. Thus, the colors on both ends of a qualitative color map with h = [0, 360] are identical. See also palette definition (text files). I would need to allow for lambda functions which will require quite some adaptions of the current code (reading config files; _checkinput function; evaluation of the function whenever needed).

Just adding lambda. Write tests for this.

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/colorspace/palettes.py:docstring of colorspace.palettes.qualitative_hcl, line 57.)

Todo

Article about color map approximations must be written or referred to the R colorspace website.

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/source/articles/approximations.rst, line 9.)

Todo

Incorrect description. Missing support for the lambda function which, here, controls h2 by default. Once implemented please check code/result/text.

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/source/articles/hcl_palettes.rst, line 109.)

Todo

I do not have the same order as I do not mix basic and advanced. Thus, this list above is invalid for the python package. Fix this.

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/source/articles/hcl_palettes.rst, line 258.)

Todo

Registering new palettes not yet implemented.

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/source/articles/hcl_palettes.rst, line 427.)

Todo

Section must be written.

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/source/articles/palette_visualization.rst, line 208.)

Todo

Darken and lighten not yet implemented.

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/source/getstarted.rst, line 64.)

Todo

Update once released on PyPI.

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/source/getstarted.rst, line 117.)

Todo

Adjust text when adding divergingx_hcl() (_Finally, even more flexible diverging HCL palettes are provided by divergingx_hcl()

(The original entry is located in /home/runner/work/python-colorspace/python-colorspace/source/getstarted.rst, line 154.)