Skip to content

Commit 458c20f

Browse files
authored
Update color.py (#2512)
adds __getnewargs__() so Color can be un/pickled
1 parent 4cb0211 commit 458c20f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arcade/types/color.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ def __new__(cls, r: int, g: int, b: int, a: int = 255):
140140
# https://github.com/python/mypy/issues/8541
141141
return super().__new__(cls, (r, g, b, a)) # type: ignore
142142

143+
def __getnewargs__(self) -> tuple[int, int, int, int]:
144+
return self.r, self.g, self.b, self.a
145+
143146
def __deepcopy__(self, _) -> Self:
144147
"""Allow :py:func:`~copy.deepcopy` to be used with Color"""
145148
return self.__class__(r=self.r, g=self.g, b=self.b, a=self.a)

0 commit comments

Comments
 (0)