Skip to content
This repository was archived by the owner on Apr 20, 2022. It is now read-only.

Commit 7a4ef7f

Browse files
committed
Only override white pixel when not given
1 parent 1c31111 commit 7a4ef7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_pypixelbuf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ def _parse_color(self, value):
253253
# same as math.ceil(brightness * 31) & 0b00011111
254254
# Idea from https://www.codeproject.com/Tips/700780/Fast-floor-ceiling-functions
255255
w = (32 - int(32 - w * 31) & 0b00011111) | DOTSTAR_LED_START
256-
elif self._has_white and r == g and g == b:
256+
elif self._has_white and (isinstance(value, int) or len(value) == 3) and r == g and g == b:
257257
# If all components are the same and we have a white pixel then use it
258-
# instead of the individual components.
258+
# instead of the individual components when all 4 values aren't explicitly given.
259259
w = r
260260
r = 0
261261
g = 0

0 commit comments

Comments
 (0)