from colorspace import rainbow_hcl, protan, palette
from colorspace import specplot, swatchplot
# Drawing 100 colors along the HCL rainbow color palette
cols = rainbow_hcl()(100)
specplot(cols);
Documentation built with Python 3.11.10, pyp2qmd 0.1.1 and quarto 1.5.57 on GitHub.
Transformation of colors by simulating color vision deficiencies, based on a CVD transform matrix. This function is an interface to the CVD object and returns simulated colors for protanope vision.
See also deutan, tritan, desaturate, and cvd_image.
protan(cols, severity=1.0, linear=True)
colslist, colorobject, matplotlib.colors.LinearSegmentedColormap
severityfloat
[0., 1.]. Zero means no deficiency, one maximum deficiency, defaults to 1..
linearbool
False, the transformation is applied to the gamma-corrected sRGB coordinates (as in the Machado et al. 2009 supplementary materials).
colorobject: Returns an object of the same type as the input object cols with modified colors as people with protanope color vision might see the colors (simulated).
from colorspace import rainbow_hcl, protan, palette
from colorspace import specplot, swatchplot
# Drawing 100 colors along the HCL rainbow color palette
cols = rainbow_hcl()(100)
specplot(cols);
# Visualize original and simulated color swatches
swatchplot([cols, protan(cols)],
show_names = False, figsize = (5, 1.5));
['#007FFF', '#6D5F00', '#C3AC00', '#FFE700', '#FADC00', '#A69200']