Skip to content

Commit 6d45d98

Browse files
committed
allow color to get a list/tuple
1 parent 7841f84 commit 6d45d98

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_rgb_display/rgb.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@
4545
_BUFFER_SIZE = const(256)
4646

4747

48-
def color565(r, g, b):
48+
def color565(r, g=0, b=0):
4949
"""Convert red, green and blue values (0-255) into a 16-bit 565 encoding. As
5050
a convenience this is also available in the parent adafruit_rgb_display
5151
package namespace."""
52+
try:
53+
r, g, b = r # see if the first var is a tuple/list
54+
except TypeError:
55+
pass
5256
return (r & 0xf8) << 8 | (g & 0xfc) << 3 | b >> 3
5357

5458

0 commit comments

Comments
 (0)