Color

Represents an RGBA color.

Constructor

  • Color() Color
  • Color(
        r: int,
        g: int,
        b: int,
        a: int = 255
    ) Color
  • Color(hex: str) Color

Represents an RGBA color.

Properties


NameDescriptionType
rRed channel value.int
gGreen channel value.int
bBlue channel value.int
aAlpha (transparency) channel value.int
hexGet or set the color as a hex string.str
hsvGet or set the color as an HSV tuple.tuple[float, float, float, float]
BLACK(0, 0, 0, 255)Color
WHITE(255, 255, 255, 255)Color
RED(255, 0, 0, 255)Color
GREEN(0, 255, 0, 255)Color
BLUE(0, 0, 255, 255)Color
YELLOW(255, 255, 0, 255)Color
MAGENTA(255, 0, 255, 255)Color
CYAN(0, 255, 255, 255)Color
GRAY(128, 128, 128, 255)Color
DARK_GRAY(64, 64, 64, 255)Color
LIGHT_GRAY(192, 192, 192, 255)Color
ORANGE(255, 165, 0, 255)Color
BROWN(165, 42, 42, 255)Color
PINK(255, 192, 203, 255)Color
PURPLE(128, 0, 128, 255)Color
NAVY(0, 0, 128, 255)Color
TEAL(0, 128, 128, 255)Color
OLIVE(128, 128, 0, 255)Color
MAROON(128, 0, 0, 255)Color

Methods


Copy

copy() Color

Create a copy of the color.

Returns

Color : A new Color object with the same RGBA values.