Drawing - Utility

arcade.color_from_hex_string

arcade.color_from_hex_string(code: str) Union[Tuple[int, int, int, int], List[int]][source]

Make a color from a hex code (3, 4, 6 or 8 characters of hex, normally with a hashtag)

arcade.get_four_byte_color

arcade.get_four_byte_color(color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]]) Union[Tuple[int, int, int, int], List[int]][source]

Given a RGB list, it will return RGBA. Given a RGBA list, it will return the same RGBA.

Parameters

color (Color) – Three or four byte tuple

Returns

return: Four byte RGBA tuple

arcade.get_four_float_color

arcade.get_four_float_color(color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]]) Tuple[float, float, float, float][source]

Given a 3 or 4 RGB/RGBA color where each color goes 0-255, this returns a RGBA tuple where each item is a scaled float from 0 to 1.

Parameters

color (Color) – Three or four byte tuple

Returns

Four floats as a RGBA tuple

arcade.get_points_for_thick_line

arcade.get_points_for_thick_line(start_x: float, start_y: float, end_x: float, end_y: float, line_width: float)[source]

Function used internally for Arcade. OpenGL draws triangles only, so a think line must be two triangles that make up a rectangle. This calculates those points.

arcade.get_three_float_color

arcade.get_three_float_color(color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]]) Tuple[float, float, float, float][source]

Given a 3 or 4 RGB/RGBA color where each color goes 0-255, this returns a RGBA tuple where each item is a scaled float from 0 to 1.

Parameters

color (Color) – Three or four byte tuple

Returns

Three floats as a RGB tuple

arcade.make_transparent_color

arcade.make_transparent_color(color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], transparency: float)[source]

Given a RGB color, along with an alpha, returns a RGBA color tuple.

Parameters
  • color (Color) – Three or four byte RGBA color

  • transparency (float) – Transparency

arcade.uint24_to_three_byte_color

arcade.uint24_to_three_byte_color(color: int) Union[Tuple[int, int, int], List[int]][source]

Given an int between 0 and 16777215, return a RGB color tuple.

Parameters

color (int) – 3 byte int

arcade.uint32_to_four_byte_color

arcade.uint32_to_four_byte_color(color: int) Union[Tuple[int, int, int, int], List[int]][source]

Given an int between 0 and 4294967295, return a RGBA color tuple.

Parameters

color (int) – 4 byte int