Class Color API exported by pygame.color — pygame v2.6.1 documentation

##### pygame documentation

Pygame Home || Help Contents || Reference Index

Most useful stuff: Color | display | draw | event | font | image | key | locals | mixer | mouse | Rect | Surface | time | music | pygame

Advanced stuff: cursors | joystick | mask | sprite | transform | BufferProxy | freetype | gfxdraw | midi | PixelArray | pixelcopy | sndarray | surfarray | math

Other: camera | controller | examples | fastevent | scrap | tests | touch | version

## src_c/color.c

This extension module defines the Python type `pygame.Color`pygame object for color representations.

Header file: src_c/include/pygame.h

PyTypeObject *pgColor_Type

  The Pygame color object type `pygame.Color`.

int pgColor_Check(PyObject *obj)

  Return true if obj is an instance of type pgColor_Type, but not a pgColor_Type subclass instance. This macro does not check if obj is not `NULL` or indeed a Python type.

PyObject *pgColor_New(Uint8 rgba[])

  Return a new `pygame.Color` instance for the the four element array rgba. On failure, raise a Python exception and return `NULL`.

PyObject *pgColor_NewLength(Uint8 rgba[], Uint8 length)

  Return a `new pygame.Color` instance having length elements, with element values taken from the first length elements of array rgba. Argument length must be between `1` and `4` inclusive. On failure, raise a Python exception and return `NULL`.

Edit on GitHub