Clock - JakeTurner616/pygame-lua-bindings GitHub Wiki

Pygame color Utility Functions

hex_to_rgb(hex_color)

Convert a hexadecimal color or common color name to an RGB tuple.

Parameters:

  • hex_color: The color in hexadecimal format, either as a string or integer, or a common color name.

Returns: A tuple representing the RGB color.

Raises:

  • ValueError: If hex_color is None or not a valid color format.

color(r, g, b, a=255)

Create a color with the specified RGB and alpha values.

Parameters:

  • r: The red component of the color (0-255).
  • g: The green component of the color (0-255).
  • b: The blue component of the color (0-255).
  • a: The alpha component of the color (0-255). Default is 255 (opaque).

Returns: A tuple representing the RGBA color.

THECOLORS()

Returns a Lua table of color names and their RGB values.

Returns: A dictionary where keys are color names and values are tuples representing RGBA colors.