Color Handling

The epipack.colors module provides a large collection of colors and palettes that can used for visualizations and plots

Colors

The dictionary

  • hex_colors

maps color names to hex codes.

The dictionary

  • colors

maps color names to rgb tuples (in [0,255]).

Every color is associated with an accompanying lighter or darker version of itself. The dictionary

  • accompanying_color

maps color names to their respective counterparts.

Palettes

Palettes are lists of color names. The dictionary

  • palettes

maps palette names to such lists of color names.

Every palette is associated with a link color and a back ground color. These are encoded in

  • hex_bg_colors, and

  • hex_link_colors

as well as

  • bg_colors and

  • link_colors

for the rgb tuple version.

You can load palettes like this:

from epipack.colors import hex_colors, colors, palettes

pal_name = 'dark'
these_hex_colors = [ hex_colors[col] for col in palettes[pal_name] ]
these_rgb_colors = [ colors[col] for col in palettes[pal_name] ]

These are all available palettes:

>>> palettes['dark']
../_images/00.png
>>> palettes['dark pastel']
../_images/01.png
>>> palettes['light']
../_images/02.png
>>> palettes['light pastel']
../_images/03.png
>>> palettes['french79']
../_images/04.png
>>> palettes['french79 pastel']
../_images/05.png
>>> palettes['brewer light']
../_images/06.png
>>> palettes['brewer light pastel']
../_images/07.png
>>> palettes['brewer dark']
../_images/08.png
>>> palettes['brewer dark pastel']
../_images/09.png