class Color - GabrielSCabrera/Termighty GitHub Wiki

Summary

For storing, accessing, and modifying color data. Is instantiated with a tuple RGB containing three integer values in range [0, 255] for color channels red, green, and blue.

Examples

Here is an example of the color black being created.

>>> from Termighty import Color
>>> R = 0; G = 0; B = 0
>>> color = Color((R,G,B))
>>> print(color)
COLOR NAME      UNNAMED COLOR
RGB             255 000 000
SAMPLE          ███████████

A second optional parameter exists for the color name.

>>> color = Color((R,G,B), 'black')
>>> print(color)
COLOR NAME      BLACK
RGB             255 000 000
SAMPLE          ███████████

Some colors can be instantiated by name (see Wikipedia's list of colors) with the static method palette.

>>> black = Color.palette('black')
>>> print(black)
COLOR NAME      BLACK
RGB             255 000 000
SAMPLE          ███████████