Create RGB Color Object

Description

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

Usage

RGB(R, G, B, alpha=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.

Methods

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

Examples

from colorspace import RGB
# Constructing color object with one single color via float
RGB(1., 0.3, 0.5)
RGB color object (1 colors)
            R       G       B
  1:     1.00    0.30    0.50
# Constructing object via lists
RGB([1., 0.8], [0.5, 0.5], [0.0, 0.2])
RGB 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
RGB(asarray([1., 0.8]), asarray([0.5, 0.5]), asarray([0.0, 0.2]))
RGB color object (2 colors)
            R       G       B
  1:     1.00    0.50    0.00
         0.80    0.50    0.20