from colorspace import palette, diverging_hcl, desaturate
from colorspace import specplot, swatchplot
from colorspace.colorlib import hexcols
cols = hexcols(diverging_hcl()(10))
specplot(desaturate(cols));
Documentation built with Python 3.11.10, pyp2qmd 0.1.1 and quarto 1.5.57 on GitHub.
Transform a vector of given colors to the corresponding colors with chroma reduced (by a tunable amount) in HCL space.
The color object (col) is transformed to the HCL color space where the chroma is reduced, before converted back to the original color space.
See also: deutan, protan, tritan, desaturate, and cvd_image.
desaturate(cols, amount=1.0)
colsstr, list, matplotlib.colors.LinearSegmentedColormap, colorobject
amountfloat
[0.,1.] defining the degree of desaturation. amount = 1. removes all color, amount = 0. none, defaults to 1..
list: Returns a list of (modified) hex colors.
from colorspace import palette, diverging_hcl, desaturate
from colorspace import specplot, swatchplot
from colorspace.colorlib import hexcols
cols = hexcols(diverging_hcl()(10))
specplot(desaturate(cols));
# Take a list of colors which can be interpreted/translated to hex
# colors and desaturate them via the HCL color space
cols = ["magenta", "red", "orange", "#F2F204", "#6BF204", "#4DA00D"]
desaturate(cols)['#919191', '#7F7F7F', '#B8B8B8', '#EAEAEA', '#D5D5D5', '#8D8D8D']