from colorspace import hexcols
# Creating hex color object from string
"#cecece") hexcols(
- #CECECE
Documentation built with Python 3.11.10
, pyp2qmd 0.1.1
and quarto 1.5.57
on GitHub.
Creates a color object using hex colors (str). Can be converted to all other color spaces: CIELAB, CIELUV, CIEXYZ, HLS, HSV, RGB, polarLAB, polarLUV, and sRGB.
hexcols(hex_)
hex_
str, list of str, numpy.ndarray of type str
#000000
or #00000050
if with alpha channel). If invalid hex colors are provided the object will raise an exception. Invalid hex colors will be handled as numpy.nan
.
hexcols.colors(fixup=True, rev=False)
hexcols.dropalpha()
hexcols.get(dimname=None)
hexcols.get_whitepoint()
hexcols.hasalpha()
hexcols.hclplot(**kwargs)
hexcols.length()
hexcols.set(**kwargs)
hexcols.set_whitepoint(**kwargs)
hexcols.specplot(**kwargs)
hexcols.swatchplot(**kwargs)
hexcols.to(to, fixup=True)
# Creating hex colors via numpy array
from numpy import asarray
cols = hexcols(asarray(["#ff000030", "#00ff0030",
"#FFFFFF", "#000"]))
cols
CIEXYZ color object (4 colors)
X Y Z alpha
1: 41.25 21.27 1.93 0.19
35.76 71.52 11.92 0.19
95.05 100.00 108.88 ---
0.00 0.00 0.00 ---
# Picking 7 hex colors from the Green-Orange
# diverging palette for demonstrating standard representation
# in jupyter engine and standard print.
from colorspace import diverging_hcl
cols2 = hexcols(diverging_hcl("Green-Orange")(7))
cols2 # jupyter HTML representation