We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3f945da + 74a2003 commit a42ece2Copy full SHA for a42ece2
displayio/_colorconverter.py
@@ -205,8 +205,15 @@ def _convert(
205
self._cached_input_pixel = input_pixel.pixel
206
self._cached_output_color = output_color.pixel
207
208
+ @staticmethod
209
+ def _rgbtuple_to_hex(color_tuple):
210
+ """Convert rgb tuple with 0-255 values to hex color value"""
211
+ return color_tuple[0] << 16 | color_tuple[1] << 8 | color_tuple[2]
212
+
213
@staticmethod
214
def _convert_pixel(colorspace: Colorspace, pixel: int) -> int:
215
+ if isinstance(pixel, tuple):
216
+ pixel = ColorConverter._rgbtuple_to_hex(pixel)
217
pixel = clamp(pixel, 0, 0xFFFFFFFF)
218
if colorspace in (
219
Colorspace.RGB565_SWAPPED,
0 commit comments