gradpyent.library.colors module

Collection of common colors.

gradpyent.library.colors.known_colors() dict

A dictionary containing common color names.

Returns:

A dictionary with color names as keys and their RGB representations as values.

Example: “red”: RGB([255, 0, 0]), “blue”: RGB([0, 0, 255]),

Return type:

dict

gradpyent.library.formats module

Output formatting of colors.

gradpyent.library.formats.format_color(rgb: RGB, fmt: str | None = 'rgb', opacity: float | None = 1.0) str | Tuple[int, int, int]

Format output to desired style.

Parameters:
  • rgb – The RGB object to convert to a different format

  • fmt – Desired format

  • opacity – If fmt is ‘kml’ an optional opacity 0-1 can be passed

Returns:

Formatted color as a string (HTML/KML) or tuple (RGB)

gradpyent.library.formats.get_verified_color(arg)
gradpyent.library.formats.get_verified_color(arg: RGB)
gradpyent.library.formats.get_verified_color(arg: Sequence)
gradpyent.library.formats.get_verified_color(arg: str)

Dispatch calls to convert input color to RGB.

Parameters:

arg – Color, can be RGB, Sequence (RGB), or str (HTML/KML)

gradpyent.library.rgb module

RGB color objects.

class gradpyent.library.rgb.RGB(red: int, green: int, blue: int)

Bases: object

Represents a color in RGB format.

property blue: int

Get blue component value.

Returns:

blue component value

property green: int

Get green component value.

Returns:

green component value

property red: int

Get red component value.

Returns:

red component value