If you use Adafruit GFX or similar libraries this tool can help you with the convertion between color components that are “packed” into a single 16-bit variable, with the most significant 5 bits conveying red, middle 6 bits conveying green, and least significant 5 bits conveying blue.
MSB 15 |
14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
LSB 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
04 | 03 | 02 | 01 | 00 | 05 | 04 | 03 | 02 | 01 | 00 | 04 | 03 | 02 | 01 | 00 |
5 bits red (0-31) |
6 bits green (0-63) |
5 bits blue (0-31) |
MSB 23 |
22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
LSB 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
07 | 06 | 05 | 04 | 03 | 02 | 01 | 00 | 07 | 06 | 05 | 04 | 03 | 02 | 01 | 00 | 07 | 06 | 05 | 04 | 03 | 02 | 01 | 00 |
8 bits red (0-255) |
8 bits green (0-255) |
8 bits blue (0-255) |
© Copyright 2021