Add random_color and the color palette

random_color returns an immutable (red, green, blue) tuple of integers from 0 to 255
and random_palette_color picks a named color. Both take an optional random.Random
so that tests can seed them.

Task: MIL-003#1
Task: MIL-003#2
This commit is contained in:
2026-10-07 23:59:02 +08:00
parent b3153b9dc1
commit 9318a07fa0
5 changed files with 127 additions and 0 deletions
+3
View File
@@ -8,10 +8,13 @@ The challenges so far are @ref turtle_challenges.square.draw_square and
first argument, so it can be tested without a window.
"""
from turtle_challenges.colors import random_color, random_palette_color
from turtle_challenges.dashed_line import draw_dashed_line
from turtle_challenges.square import draw_square
__all__ = [
"draw_dashed_line",
"draw_square",
"random_color",
"random_palette_color",
]