---
title: "A Python Toolbox for Manipulating and Assessing Colors and Palettes"
bibliography: references.bib
---

*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](https://colorspace.R-Forge.R-project.org/) package
to make the tools easily available for Python enthusiasts. More information
and an interactive interface can also be found on
[HCLwizard.org](https://hclwizard.org).

The package itself can be found on
[GitHub](https://github.com/retostauffer/python-colorspace/) and this documentation
is also available on [GitHub Pages](https://retostauffer.github.io/python-colorspace/).


## Contents

* [Color spaces](articles/color_spaces.qmd)
* [HCL-Based Color Palettes](articles/hcl_palettes.qmd)
* HCL-Based Color Palettes for [matplotlib](articles/usewith_matplotlib.qmd),
    [seaborn](articles/usewith_seaborn.qmd), and [plotly](articles/usewith_plotly.qmd)
* [Palette Visualization and Assessment](articles/palette_visualization.qmd)
* [App for Choosing Palettes Interactively](articles/choose_palette.qmd)
* [Color Vision Deficiency Emulation](articles/cvd.qmd)
* [Color Manipulation and Utilities](articles/manipulation_utilities.qmd)
* [Approximate Colors from Other Packages](articles/approximations.qmd)
* [Somewhere over the Rainbow](articles/endrainbow.qmd)


## Community guidelines

Everyone is warmly welcome to contribute to Python _colorspace_
by addressing existing issues, reporting bugs, or requesting
new features. Please refer to our [Community guidelines](community.qmd)
for more information.


## Citations

Stauffer, R. and Zeileis A. (2024). "colorspace: A Python Toolbox for Manipulating
and Assessing Colors and Palettes." _The Journal of Open Source Software_,
9(102), 7120, doi:[10.21105/joss.07120](https://doi.org/10.21105/joss.07120).

Stauffer, R. and Zeileis, A. (2024). "colorspace: A Python Toolbox for Manipulating and Assessing Colors and Palettes (v1.0.0)". _Zenodo_.
doi:[10.5281/zenodo.14004295](https://doi.org/10.5281/zenodo.14004295).


## Other packages and further reading

* [HCLwizard.org](https://hclwizard.org): More information about the HCL color
  space, introduction to the *colorspace* packages (available for
  [_R_](https://cran.r-project.org/package=colorspace) and
  [Python](https://pypi.org/project/colorspace/)), 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](/references.qmd)
  which provide more detailed insights, e.g.,
* [The end of the rainbow](https://www.climate-lab-book.ac.uk/2014/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](https://betterfigures.org/): Constructive criticism of the
  graphics of climate science by Doug McNeall.

Scientific articles with more detailed insights:

* Zeileis, A., Fisher, J., Hornik, K., Ihaka, R., McWhite, C., Murrell, P.,
  Stauffer, R., & Wilke, C. (2020). [colorspace: A Toolbox for Manipulating and
  Assessing Colors and Palettes](https://doi.org/10.18637/jss.v096.i01).
  Journal of Statistical Software, 96(1), 1–49, doi:
  [doi:10.18637/jss.v096.i01](https://doi.org/10.18637/jss.v096.i01)
* Stauffer, R., Mayr, G. J., Dabernig, M., & Zeileis, A. (2015). [Somewhere
  Over the Rainbow: How to Make Effective Use o f Colors in Meteorological
  Visualizations](https://doi.org/10.1175/BAMS-D-13-00155.1).
  American Meteorological Society, 96(2), 203–216,
  [doi:10.1175/BAMS-D-13-00155.1](https://doi.org/10.1175/BAMS-D-13-00155.1).
  Zeileis, Achim, Kurt Hornik, and Paul Murrell. 2009.
  "Escaping RGBland: Selecting Colors for Statistical Graphics."
  Computational Statistics & Data Analysis 53: 3259--3270.
  <https://doi.org/10.1016/j.csda.2008.11.033>.
* Ihaka, Ross. 2003. "[Colour for Presentation Graphics.](https://www.r-project.org/conferences/DSC-2003/Proceedings/Ihaka.pdf)"
  In Proceedings of the 3rd International Workshop on Distributed Statistical Computing,
  Vienna, Austria, edited by Kurt Hornik, Friedrich Leisch, and Achim Zeileis.
  <https://www.r-project.org/conferences/DSC-2003/Proceedings/Ihaka.pdf>.
* Crameri, Fabio, Grace E. Shephard, and Philip J. Heron. 2020.
  "The Misuse of Colour in Science Communication." _Nature Communications_ 11 (5444): 1--10.
  <https://doi.org/10.1038/s41467-020-19160-7>.
* ... and others ([reference list](/references.qmd)).

Some other packages providing color maps in Python
wich might be of interest:

* [matplotlib](https://matplotlib.org/): Library for creating visualizations.
  Provides a range of (mostly) well specified color maps
  [colormaps](https://matplotlib.org/stable/users/explain/colors/colormaps.html).
* [seaborn](https://seaborn.pydata.org>):
  Statistical data visualization. The package also provides access to a
  range of (mostly) well specified
  [color palettes](https://seaborn.pydata.org/tutorial/color_palettes.html).
* [plotly](https://plotly.com/python): Graphing library for interactive plots
  and figures which comes with a series of built-in and (mostly) well defined
  [color scales](https://plotly.com/python/builtin-colorscales/).
* [palettable](https://jiffyclub.github.io/palettable): Color palettes for Python.
  Formely known as `brewer2mpl`. Provides a range of color palettes including
  "Brewer2" and "Carto" palettes.
* [cmcrameri](https://pypi.org/project/cmcrameri/): Python package with a few
  series of sequential and diverging color palettes.
* [colormap](https://pypi.org/project/colormap/): Python package providing
  access to a series of color palettes and functionality to create own (fixed-color)
  palettes.
* [colormaps](https://pypi.org/project/colormaps/): Collection of color palettes
  for Python to be used with matplotlib (e.g., cartocolors, brewer palettes, ...).
* [ColorBrewer2.org](https://colorbrewer2.org): The source of the brewer colors,
  interactive web page by Cynthia Brewer, Mark Harrower, and The Pennsylvania
  State University.


