pybricks.parameters: Allow iterating colors.

https://github.com/pybricks/support/issues/1661
This commit is contained in:
Laurens Valk
2025-02-25 11:16:27 +01:00
parent 789e70a42b
commit c77b440270
+4
View File
@@ -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)