Color - JakeTurner616/pygame-lua-bindings GitHub Wiki

hex_to_rgb(hex_color)

Converts 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.

Maps to:

  • pygame.Color: This function is used internally to create a color object.

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

Creates 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 color object.

Maps to:

  • pygame.Color: This function is used internally to create a color object.

THECOLORS()

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

Returns: A Lua table containing color names as keys and their corresponding RGB tuples as values.

Maps to:

  • pygame.color.THECOLORS: This function returns a dictionary of color names and their RGB values.