mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-07-27 19:57:02 +00:00
pybricks.parameters: Allow iterating colors.
https://github.com/pybricks/support/issues/1661
This commit is contained in:
@@ -112,6 +112,10 @@ class Color:
|
||||
The brightness value.
|
||||
"""
|
||||
|
||||
def __iter__(self):
|
||||
"""Allows unpacking of the Color instance into h, s, and v."""
|
||||
return iter((self.h, self.s, self.v))
|
||||
|
||||
def __repr__(self):
|
||||
return "Color(h={}, s={}, v={})".format(self.h, self.s, self.v)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user