Create Standard RGB (sRGB) Color Object

Description

Allows conversions to: CIELAB, CIELUV, CIEXYZ, HLS, HSV, RGB, hexcols. polarLAB and polarLUV.

Usage

sRGB(R, G, B, alpha=None, gamma=None)

Arguments

Rint, float, list, numpy.array
Numeric value(s) for red intensity ([0., 1.]).
Gint, float, list, numpy.array
Numeric value(s) for green intensity ([0., 1.]).
Bint, float, list, numpy.array
Numeric value(s) for blue intensity ([0., 1.]).
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.
gammaNone, float
If None (default) the default gamma value is used. Can be specified to overwrite the default.

Methods

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

Examples

from colorspace import sRGB
# Constructing color object with one single color via float
sRGB(1., 0.3, 0.5)
sRGB color object (1 colors)
            R       G       B
  1:     1.00    0.30    0.50
# Constructing object via lists
sRGB([1., 0.8], [0.5, 0.5], [0.0, 0.2])
sRGB color object (2 colors)
            R       G       B
  1:     1.00    0.50    0.00
         0.80    0.50    0.20
# Constructing object via numpy arrays
from numpy import asarray
sRGB(asarray([1., 0.8]), asarray([0.5, 0.5]), asarray([0.0, 0.2]))
sRGB color object (2 colors)
            R       G       B
  1:     1.00    0.50    0.00
         0.80    0.50    0.20