Set Coordinates/Manipulate Colors

Description

Allows to manipulate current colors. The named input arguments have to fulfil a specific set or requirements. If not, the function raises exceptions. The requirements:

  • Dimension has to exist
  • New data/values must be of same length and type as the existing ones

Usage

HSV.set(**kwargs)

Arguments

**kwargs
Named arguments. The key is the name of the dimension to be changed, the value an object which fulfills the requirements (see description of this method)

Examples

# Example shown for HCL colors, works the same
# for all other color objects (sRGB, hexcols, ...)
from colorspace import HCL
cols = HCL([260, 80, 30], [80, 0, 80], [30, 90, 30])
cols
polarLUV color object (3 colors)
            H       C       L
  1:   260.00   80.00   30.00
        80.00    0.00   90.00
        30.00   80.00   30.00
cols.set(H = [150, 150, 30])
cols
polarLUV color object (3 colors)
            H       C       L
  1:   150.00   80.00   30.00
       150.00    0.00   90.00
        30.00   80.00   30.00

Raises

  • ValueError: If the dimension does not exist.
  • ValueError: If the new data can't be converted into numpy.array (is done automatically if needed).
  • ValueError: If new data has wrong length (does not match the number of colors/length of current values).