Skip to content

Commit c0ed348

Browse files
authored
Merge pull request #40 from cpforbes/cpf-list-fix
Revert use of ternary; tuple addition failed when color is a list.
2 parents 6e35cd2 + 845c0b4 commit c0ed348

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

neopixel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ def _set_item(self, index, value):
145145
g = 0
146146
b = 0
147147
elif (len(value) == self.bpp) or ((len(value) == 3) and (self.bpp == 4)):
148-
r, g, b, w = value if len(value) == 4 else value+(0,)
148+
if len(value) == 3:
149+
r, g, b = value
150+
else:
151+
r, g, b, w = value
149152
else:
150153
raise ValueError("Color tuple size does not match pixel_order.")
151154

0 commit comments

Comments
 (0)