from colorspace import diverging_hcl
= diverging_hcl()
a 10) a.colors(
['#023FA5',
'#6371AF',
'#959CC3',
'#BEC1D4',
'#DBDCE0',
'#E0DBDC',
'#D6BCC0',
'#C6909A',
'#AE5A6D',
'#8E063B']
Documentation built with Python 3.11.10
, pyp2qmd 0.1.1
and quarto 1.5.57
on GitHub.
The HCL (hue-chroma-luminance) color model is a perceptual color model obtained by using polar coordinates in CIELUV space (i.e., polarLUV), where steps of equal size correspond to approximately equal perceptual changes in color. By taking polar coordinates the resulting three dimensions capture the three perceptual axes very well: hue is the type of color, chroma the colorfulness compared to the corresponding gray, and luminance the brightness. This makes it relatively easy to create balanced palettes through trajectories in this HCL space. In contrast, in the more commonly-used ‘HSV’ (hue-saturation-value) model (a simple transformation of ‘RGB’), the three axes are confounded so that luminance changes along with the hue leading to very unbalanced palettes.
diverging_hcl
codes the underlying numeric values by a triangular luminance sequence with different hues in the left and in the right arm of the palette. Thus, it can be seen as a combination of two sequential palettes with some restrictions: (a) a single hue is used for each arm of the palette, (b) chroma and luminance trajectory are balanced between the two arms, (c) the neutral central value has zero chroma. To specify such a palette a vector of two hues h
(or equivalently h1
and h2
), either a single chroma value c
(or c1
) or a vector of two chroma values c
(or c1
and cmax
), a vector of two luminances l
(or l1
and l2
), and power parameter(s) power
(or p1
and p2
) are used. For more flexible diverging palettes without the restrictrictions above (and consequently more parameters) divergingx_hcl
is available. For backward compatibility, diverge_hcl
is a copy of diverging_hcl
.
If h
is str it will overwrite the palette
argument. In this case, pre-specified palette settings will be loaded but are allowed to be overwritten by the user. At any time the user can overwrite any of the settings. By default, diverging_hcl
returns an object of class hclpalette
identical to the pre-defined "Blue-Red"
palette.
See also: qualitative_hcl, sequential_hcl, divergingx_hcl, rainbow_hcl, heat_hcl, terrain_hcl, diverging_hsv, and rainbow.
diverging_hcl(h=[260, 0], c=80, l=[30, 90],
power=1.5, fixup=True, palette=None,
rev=False, *args, **kwargs)
h
list, float, int
h
is a str this argument acts like the palette
argument (see palette
input parameter).
c
float, int, list
c1
, the second as cmax
.
l
float, int, list
power
float, int, list
fixup
bool
palette
str
rev
bool
*args
**kwargs
h1
, h2
, c1
, cmax
, l1
, l2
, p1
, p2
.
Initialize new object, no return. Raises a set of errors if the parameters are misspecified. Note that the object is callable, the default object call can be used to return hex colors (identical to the .colors()
method), see examples.
diverging_hcl.cmap(n=256, name='custom_hcl_cmap')
diverging_hcl.colors(n=11, fixup=None, alpha=None, **kwargs)
diverging_hcl.get(key)
diverging_hcl.hclplot(n=7, **kwargs)
diverging_hcl.name()
diverging_hcl.show_settings()
diverging_hcl.specplot(n=180, *args, **kwargs)
diverging_hcl.swatchplot(n=7, **kwargs)
['#023FA5',
'#6371AF',
'#959CC3',
'#BEC1D4',
'#DBDCE0',
'#E0DBDC',
'#D6BCC0',
'#C6909A',
'#AE5A6D',
'#8E063B']
['#009B9F',
'#00ADB1',
'#6CC0C2',
'#A7D3D5',
'#D9E7E7',
'#EDE1E8',
'#E4C1D8',
'#DBA1C8',
'#D180B9',
'#C75DAA']