|
4 | 4 | import atexit |
5 | 5 |
|
6 | 6 |
|
7 | | -def Color(red, green, blue): |
| 7 | +def Color(red, green, blue, white=0): |
8 | 8 | """Convert the provided red, green, blue color to a 24-bit color value. |
9 | 9 | Each color component should be a value 0-255 where 0 is the lowest intensity |
10 | 10 | and 255 is the highest intensity. |
11 | 11 | """ |
12 | | - return (red << 16) | (green << 8) | blue |
| 12 | + return (white << 24) | (red << 16) | (green << 8) | blue |
13 | 13 |
|
14 | 14 |
|
15 | 15 | class _LED_Data(object): |
@@ -135,12 +135,12 @@ def setPixelColor(self, n, color): |
135 | 135 | """ |
136 | 136 | self._led_data[n] = color |
137 | 137 |
|
138 | | - def setPixelColorRGB(self, n, red, green, blue): |
| 138 | + def setPixelColorRGB(self, n, red, green, blue, white=0): |
139 | 139 | """Set LED at position n to the provided red, green, and blue color. |
140 | 140 | Each color component should be a value from 0 to 255 (where 0 is the |
141 | 141 | lowest intensity and 255 is the highest intensity). |
142 | 142 | """ |
143 | | - self.setPixelColor(n, Color(red, green, blue)) |
| 143 | + self.setPixelColor(n, Color(red, green, blue, white)) |
144 | 144 |
|
145 | 145 | def getBrightness(self): |
146 | 146 | return ws.ws2811_channel_t_brightness_get(self._channel) |
|
0 commit comments