colors module¶
Provides Color objects with RGBA values.
- class colors.Color¶
Bases:
instance
This class is used to store a 32 bit color. The color is stored in its RGBA components.
- __getitem__((Color)arg1, (_engines._sound.Channel)index) int : ¶
Return the color component at the given index (0 - 3).
- __init__((object)arg1[, (int)r=0[, (int)g=0[, (int)b=0[, (int)a=255]]]]) None : ¶
Initialize the Color object.
- __reduce__()¶
Helper for pickle.
- __repr__((Color)arg1) str : ¶
Return the color as a stringified tuple.
- __setitem__((Color)arg1, (_engines._sound.Channel)index, (int)value) None : ¶
Set the color component at the given index.
- __str__((Color)arg1) str : ¶
Return the color as a hexadecimal string.
- with_alpha((Color)arg1, (int)a) Color : ¶
Return a copy of the color with a new alpha value.
- Parameters:
a (int) – The new alpha value.
- property a¶
A value between 0 and 255 that defines the alpha value (transparency).
- property b¶
A value between 0 and 255 that defines the blue component of the color.
- property g¶
A value between 0 and 255 that defines the green component of the color.
- property r¶
A value between 0 and 255 that defines the red component of the color.
- colors.BLACK = Color(0, 0, 0, 255)¶
- colors.BLUE = Color(0, 0, 255, 255)¶
- colors.BROWN = Color(139, 69, 19, 255)¶
- colors.CYAN = Color(0, 255, 255, 255)¶
- colors.DARK_BLUE = Color(0, 0, 128, 255)¶
- colors.DARK_GRAY = Color(64, 64, 64, 255)¶
- colors.DARK_GREEN = Color(0, 128, 0, 255)¶
- colors.DARK_RED = Color(128, 0, 0, 255)¶
- colors.GRAY = Color(128, 128, 128, 255)¶
- colors.GREEN = Color(0, 255, 0, 255)¶
- colors.LIGHT_BLUE = Color(128, 128, 255, 255)¶
- colors.LIGHT_GRAY = Color(192, 192, 192, 255)¶
- colors.LIGHT_GREEN = Color(128, 255, 128, 255)¶
- colors.LIGHT_RED = Color(255, 80, 80, 255)¶
- colors.OLIVE = Color(128, 128, 0, 255)¶
- colors.ORANGE = Color(255, 165, 0, 255)¶
- colors.PURPLE = Color(255, 0, 255, 255)¶
- colors.RED = Color(255, 0, 0, 255)¶
- colors.WHITE = Color(255, 255, 255, 255)¶
- colors.YELLOW = Color(255, 255, 0, 255)¶