# Tol_colors
> Colormaps and qualitative colorsets that are colorblind-safe
<div align="left">
[](https://pypi.org/project/tol-colors)
[](https://github.com/Descanonge/tol_colors/releases)
[](https://github.com/Descanonge/tol_colors/actions/workflows/tests.yml)
[](https://tol-colors.readthedocs.io/en/latest/)
</div>
<img alt="icon" src="https://raw.githubusercontent.com/Descanonge/tol_colors/refs/heads/master/docs/source/_static/icon.svg" width="128" align="left">
Those color schemes were designed by Paul Tol. This repository is packaging his work so that it can be easily installed using pip.
This packages and its documentation follow the technical notes of the color schemes<sup id="a1">[1](#f1)</sup>, which are archived in this [repository](https://github.com/Descanonge/tol_colors/blob/master/docs/technical_notes.pdf). Details and implementations for other languages can be found on Paul Tols's [website](https://sronpersonalpages.nl/~pault/).
A more user-friendly documentation is available at <https://tol-colors.readthedocs.io>, detailing how and when to use the various colorsets and colormaps in this package.
## Install
Using pip:
``` sh
pip install tol-colors
```
From source:
``` sh
git clone https://github.com/Descanonge/tol_colors.git
cd tol_colors
pip install .
```
Show the available colorsets, colormaps, and the discrete rainbow colormap:
``` shell
python -m tol_colors
```
## Requirements
- numpy
- matplotlib
## Discrete/qualitative schemes
Sets of colors that can be used for lines, markers, qualitative lines, etc.
All colorsets are given as named tuples. You can then access the colors by index or by name:
``` python
>>> cset = tc.bright
>>> cset.blue
'#4477AA'
```
Each colorset is available as a module attribute (`tc.bright`) and stored in the dictionary `tol_colors.colorsets`. This is a special mapping that will accepts both hyphen and underscore versions
(`tc.colorsets["high-contrast"]` and `tc.colorsets["high_contrast"]` will
both work).

This package also provides a function to easily set the default colors used by Matplotlib to one of the colorsets. This will change your matplotlibrc file or a given stylesheet file.
## Colormaps
The following colormaps were created by linear interpolation of carefully chosen
colors. Those colors can be used as is for discrete colormaps. These discrete
variants are available by adding "_discrete" to the colormap name (*eg*
`tc.sunset_discrete`). Note the *iridescent* does not have a readily available
discrete version, and one should use the a dedicated function to obtain a
discrete rainbow.
Colormaps are available as module attributes (`tc.sunset`), stored in a
dictionnary `tol_colors.colormaps` (`tc.colormaps["sunset"]`), and registered in
Matplotlib with the prefix "tol." (`plt.imshow(..., cmap="tol.sunset")`).
Reversed variants are available by appending "_r" to the colormap name.
Rather than resampling the interpolated colormaps, discrete rainbow colormap is
available by specifying the number of colors between 1 and 23
(`tc.get_colormap("rainbow_discrete", n_colors=14)`).

## See also
Other packages already implement these colorschemes and might better suit your needs:
- [color_tol](https://github.com/lazarillo/color_tol)
- [pyplot-themes](https://github.com/raybuhr/pyplot-themes)
- [khroma](https://cran.r-project.org/web/packages/khroma): R package that includes those schemes
<b id="f1">1</b>: *Colour Schemes*, Paul Tol, SRON/EPS/TN/09-002, issue 3.2, 18 August 2021 [↩](#a1)
Raw data
{
"_id": null,
"home_page": null,
"name": "tol-colors",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Cl\u00e9ment Ha\u00ebck <clement.haeck@posteo.net>",
"keywords": "visualization, colorsets, colormaps, colorblind",
"author": "Paul Tol",
"author_email": "Cl\u00e9ment Ha\u00ebck <clement.haeck@posteo.net>",
"download_url": "https://files.pythonhosted.org/packages/2d/26/a2a7635e82715ced8087e6bc0924bb426de3616b2464229877c3685888ee/tol_colors-2.1.0.tar.gz",
"platform": null,
"description": "\n# Tol_colors\n\n> Colormaps and qualitative colorsets that are colorblind-safe\n\n<div align=\"left\">\n\n[](https://pypi.org/project/tol-colors)\n[](https://github.com/Descanonge/tol_colors/releases)\n[](https://github.com/Descanonge/tol_colors/actions/workflows/tests.yml)\n[](https://tol-colors.readthedocs.io/en/latest/)\n\n</div>\n\n<img alt=\"icon\" src=\"https://raw.githubusercontent.com/Descanonge/tol_colors/refs/heads/master/docs/source/_static/icon.svg\" width=\"128\" align=\"left\">\n\nThose color schemes were designed by Paul Tol. This repository is packaging his work so that it can be easily installed using pip.\nThis packages and its documentation follow the technical notes of the color schemes<sup id=\"a1\">[1](#f1)</sup>, which are archived in this [repository](https://github.com/Descanonge/tol_colors/blob/master/docs/technical_notes.pdf). Details and implementations for other languages can be found on Paul Tols's [website](https://sronpersonalpages.nl/~pault/).\n\nA more user-friendly documentation is available at <https://tol-colors.readthedocs.io>, detailing how and when to use the various colorsets and colormaps in this package.\n\n## Install\n\nUsing pip:\n``` sh\npip install tol-colors\n```\n\nFrom source:\n``` sh\ngit clone https://github.com/Descanonge/tol_colors.git\ncd tol_colors\npip install .\n```\n\nShow the available colorsets, colormaps, and the discrete rainbow colormap:\n``` shell\npython -m tol_colors\n```\n\n## Requirements\n\n- numpy\n- matplotlib\n\n## Discrete/qualitative schemes\n\nSets of colors that can be used for lines, markers, qualitative lines, etc.\nAll colorsets are given as named tuples. You can then access the colors by index or by name:\n``` python\n>>> cset = tc.bright\n>>> cset.blue\n'#4477AA'\n```\n\nEach colorset is available as a module attribute (`tc.bright`) and stored in the dictionary `tol_colors.colorsets`. This is a special mapping that will accepts both hyphen and underscore versions\n(`tc.colorsets[\"high-contrast\"]` and `tc.colorsets[\"high_contrast\"]` will\nboth work).\n\n\n\nThis package also provides a function to easily set the default colors used by Matplotlib to one of the colorsets. This will change your matplotlibrc file or a given stylesheet file.\n\n## Colormaps\n\nThe following colormaps were created by linear interpolation of carefully chosen\ncolors. Those colors can be used as is for discrete colormaps. These discrete\nvariants are available by adding \"_discrete\" to the colormap name (*eg*\n`tc.sunset_discrete`). Note the *iridescent* does not have a readily available\ndiscrete version, and one should use the a dedicated function to obtain a\ndiscrete rainbow.\n\nColormaps are available as module attributes (`tc.sunset`), stored in a\ndictionnary `tol_colors.colormaps` (`tc.colormaps[\"sunset\"]`), and registered in\nMatplotlib with the prefix \"tol.\" (`plt.imshow(..., cmap=\"tol.sunset\")`).\nReversed variants are available by appending \"_r\" to the colormap name.\n\nRather than resampling the interpolated colormaps, discrete rainbow colormap is\navailable by specifying the number of colors between 1 and 23\n(`tc.get_colormap(\"rainbow_discrete\", n_colors=14)`).\n\n\n\n## See also\n\nOther packages already implement these colorschemes and might better suit your needs:\n - [color_tol](https://github.com/lazarillo/color_tol)\n - [pyplot-themes](https://github.com/raybuhr/pyplot-themes)\n - [khroma](https://cran.r-project.org/web/packages/khroma): R package that includes those schemes \n\n<b id=\"f1\">1</b>: *Colour Schemes*, Paul Tol, SRON/EPS/TN/09-002, issue 3.2, 18 August 2021 [\u21a9](#a1)\n",
"bugtrack_url": null,
"license": null,
"summary": "Color schemes for lines and maps, color-blind safe",
"version": "2.1.0",
"project_urls": {
"Documentation": "https://tol-colors.readthedocs.io",
"Source": "https://github.com/Descanonge/tol_colors"
},
"split_keywords": [
"visualization",
" colorsets",
" colormaps",
" colorblind"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b2236183a5a967b1635b4333ac5efd9867038a3eb0e5b7a7f09f33ba5ceb8032",
"md5": "a5a9db7147d150c6cc1cf87d009c7588",
"sha256": "90c705b569a9372a182a24a1d9db7ebc11e2c5443b40c0f4e25e89a8907432f6"
},
"downloads": -1,
"filename": "tol_colors-2.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a5a9db7147d150c6cc1cf87d009c7588",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12605,
"upload_time": "2025-07-21T09:41:39",
"upload_time_iso_8601": "2025-07-21T09:41:39.654864Z",
"url": "https://files.pythonhosted.org/packages/b2/23/6183a5a967b1635b4333ac5efd9867038a3eb0e5b7a7f09f33ba5ceb8032/tol_colors-2.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2d26a2a7635e82715ced8087e6bc0924bb426de3616b2464229877c3685888ee",
"md5": "29970f4503b48a2e29dc50ba03e9c55c",
"sha256": "79454d02d1b9578225bd88e9118f88d2242f7e7acb8e6c2330ff78190fd8963e"
},
"downloads": -1,
"filename": "tol_colors-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "29970f4503b48a2e29dc50ba03e9c55c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 1901374,
"upload_time": "2025-07-21T09:41:40",
"upload_time_iso_8601": "2025-07-21T09:41:40.828580Z",
"url": "https://files.pythonhosted.org/packages/2d/26/a2a7635e82715ced8087e6bc0924bb426de3616b2464229877c3685888ee/tol_colors-2.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-21 09:41:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Descanonge",
"github_project": "tol_colors",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tol-colors"
}