Color

A color representation in different formats.

Constructor

  • Color()
  • Color(hex: str)
  • Color(rgba: Sequence[int])
  • Color(r: int, g: int, b: int, a: int = 255)

Parameters

  • hex : Hex color string (with or without '#' prefix).
  • rgba : A sequence of 3 or 4 integers [0-255] (RGB or RGBA).
  • r : Red value [0-255].
  • g : Green value [0-255].
  • b : Blue value [0-255].
  • a : Alpha value [0-255]. Defaults to 255.

Properties


NameDescriptionType
rThe red component of the colorint
gThe green component of the colorint
bThe blue component of the colorint
aThe alpha component of the colorint
hexThe hexadecimal representation of the colorstr
hsvThe HSV representation of the colortuple[float,float,float,float]

Methods


Copy

copy() Color

Create a copy of the color.

Returns

Color : A new color object that is a copy of the original.