Skip to content

Commit

Permalink
feat: allow input of color tuple for color
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloeckchengrafik committed Jan 11, 2024
1 parent 39dff31 commit c7bb5c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions swarm/swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ async def get_color(self) -> int:
return self._color

async def set_color(self, color) -> None:
# If color is a tuple, reformat it as hex
if isinstance(color, tuple) or isinstance(color, list):
color = (color[0] << 16) + (color[1] << 8) + color[2]
self._color = color
await self._swarm.send(self._port_name, "setColor", color)

Expand Down

0 comments on commit c7bb5c2

Please sign in to comment.