Skip to content

Allow SpriteList.draw_hit_boxes to take RGB colors #2577

Closed
@pushfoo

Description

@pushfoo

Enhancement request:

What should be added/changed?

Allow SpriteList.draw_hit_boxes to take RGB colors.

What would it help with?

This splits part of #2066 off:

  • an issue for PyCon APAC 2025 as a first-time contribution
  • a test of GitHub's new sub-issue feature within Arcade

Proposed implementation:

In this file at this location:

def draw_hit_boxes(self, color: RGBA255 = (0, 0, 0, 255), line_thickness: float = 1.0) -> None:
"""
Draw all the hit boxes in this list.
.. warning:: This method is slow and should only be used for debugging.
Args:
color: The color of the hit boxes
line_thickness: The thickness of the lines
"""
# NOTE: Find a way to efficiently draw this
for sprite in self.sprite_list:
sprite.draw_hit_box(color, line_thickness)

  • Change the annotation for color:
    • Add an import for RGBorA255 from arcade.types to this line
      from arcade.types import RGBA255, Color, RGBANormalized, RGBOrANormalized
    • Change the annotation for color to RGBAorA255
  • Convert and store the color argument with a line like converted_color = Color.from_iterable(color)
    • Put it before the for loop (we don't want to re-convert it each time!)
  • Pass converted_color instead of color in sprite.draw_hit_box(color, line_thickness)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pycon APAC 2025 SprintsSpecific beginner-friendly issues for PyCon APAC 2025 sprint attendees

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions