Create HSV Color Object

Description

Creates a color object in the Hue-Saturation-Value (HSV) color space. Can be converted to: RGB, sRGB, HLS, and hexcols. Not allowed (ambiguous) are transformations to CIEXYZ, CIELUV, CIELAB, polarLUV, and polarLAB.

Usage

HSV(H, S, V, alpha=None)

Arguments

Hint, float, list, numpy.array
Numeric value(s) for Hue dimension.
Sint, float, list, numpy.array
Numeric value(s) for Saturation dimension.
Vint, float, list, numpy.array
Numeric value(s) for Value dimension.
alphaNone, float, list, numpy.array
Numeric value(s) for the alpha channel ([0., 1.]) where 0. equals full transparency, 1. full opacity. If None (default) no transparency is added.

Methods

HSV.colors(fixup=True, rev=False)
Extract Hex Colors
HSV.dropalpha()
Remove Alpha Channel
HSV.get(dimname=None)
Extracting Color Coordinates
HSV.get_whitepoint()
Get White Point
HSV.hasalpha()
Check for Alpha Channel
HSV.hclplot(**kwargs)
Palette Plot in HCL Space
HSV.length()
Get Number of Colors
HSV.set(**kwargs)
Set Coordinates/Manipulate Colors
HSV.set_whitepoint(**kwargs)
Set White Point
HSV.specplot(**kwargs)
Color Spectrum Plot
HSV.swatchplot(**kwargs)
Palette Swatch Plot
HSV.to(to, fixup=True)
Transform Color Space

Examples

# Constructing object via numpy arrays
from colorspace import HSV
# Constructing color object with one single color via float
HSV(150, 150, 10)
HSV color object (1 colors)
            H       S       V
  1:   150.00  150.00   10.00
# Constructing object via lists
HSV([150, 150, 10], [1.5, 0, 1.5], [0.1, 0.7, 0.1])
HSV color object (3 colors)
            H       S       V
  1:   150.00    1.50    0.10
       150.00    0.00    0.70
        10.00    1.50    0.10
# Constructing object via numpy arrays
from numpy import asarray
cols = HSV(asarray([150, 150, 150]),
           asarray([1.5, 0, 1.5]),
           asarray([0.1, 0.7, 0.1]))
cols
HSV color object (3 colors)
            H       S       V
  1:   150.00    1.50    0.10
       150.00    0.00    0.70
       150.00    1.50    0.10
# Converting to RGB
cols.to("RGB")
cols
RGB color object (3 colors)
            R       G       B
  1:    -0.05    0.10    0.03
         0.70    0.70    0.70
        -0.05    0.10    0.03