if isinstance(value, (tuple, list, bytes, bytearray)):
value = (value[0] & 0xFF) << 16 | (value[1] & 0xFF) << 8 | value[2] & 0xFF
elif isinstance(value, int):
if isinstance(value, (tuple, list, bytes, bytearray)):
value = (value[0] & 0xFF) << 16 | (value[1] & 0xFF) << 8 | value[2] & 0xFF
elif isinstance(value, int):
raise ValueError("Color must be between 0x000000 and 0xFFFFFF")
else:
raise TypeError("Color buffer must be a buffer, tuple, list, or int")
raise ValueError("Color must be between 0x000000 and 0xFFFFFF")
else:
raise TypeError("Color buffer must be a buffer, tuple, list, or int")
(to represent an RGB value). Value can be an int, bytes (3 bytes (RGB) or
4 bytes (RGB + pad byte)), bytearray, or a tuple or list of 3 integers.
"""
(to represent an RGB value). Value can be an int, bytes (3 bytes (RGB) or
4 bytes (RGB + pad byte)), bytearray, or a tuple or list of 3 integers.
"""
- if self._colors[index].rgb888 == value:
+ self._set_color(index, self._color_to_int(value))
+
+ def _set_color(self, palette_index: int, color: int):
+ if self._colors[palette_index].rgb888 == color:
self._needs_refresh = True
def __getitem__(self, index: int) -> Optional[int]:
self._needs_refresh = True
def __getitem__(self, index: int) -> Optional[int]: