from colorspace import HCL, sRGB, hexcols
# Example using HCL color object with alpha channel
= HCL([260, 80, 30], [80, 0, 80], [30, 90, 30], [1, 0.6, 0.2])
cols "H") # Specific dimension cols.get(
array([260., 80., 30.])
Documentation built with Python 3.11.10
, pyp2qmd 0.1.1
and quarto 1.5.57
on GitHub.
Allows to extract the current values of one or multiple dimensions for all colors of this color object. The names of the coordinates varies between different color spaces.
HSV.get(dimname=None)
dimname
None, str
None
(default) values of all coordinates of the current color object are returned. A specific coordinate can be specified if needed.
Returns a numpy.ndarray
if coordinates of one specific dimension are requested, else a dict
of arrays.
from colorspace import HCL, sRGB, hexcols
# Example using HCL color object with alpha channel
cols = HCL([260, 80, 30], [80, 0, 80], [30, 90, 30], [1, 0.6, 0.2])
cols.get("H") # Specific dimension
array([260., 80., 30.])
{'H': array([260., 80., 30.]),
'C': array([80., 0., 80.]),
'L': array([30., 90., 30.]),
'alpha': array([1. , 0.6, 0.2])}
array([0.00691302, 0.88757039, 0.49625787])
{'R': array([0.00691302, 0.88757039, 0.49625787]),
'G': array([0.24577258, 0.8875635 , 0.17895641]),
'B': array([ 0.64603426, 0.88759885, -0.30114778]),
'alpha': array([1. , 0.6, 0.2])}
TypeError
: If argument dimname
is neither None or str.
ValueError
: If the dimension specified on dimnames
does not exist.