Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manim/utils/color/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,9 @@ def __xor__(self, other: Self) -> Self:
self._internal_from_integer(self.to_integer() ^ int(other), 1.0)
)

def __hash__(self) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python docs recommend that __hash__ returns an integer.
Can you just return hash(self.to_hex(with_alpha=True))?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to change the return typehint to int.

return self.to_hex(with_alpha=True)


RGBA = ManimColor
"""RGBA Color Space"""
Expand Down
Loading