Skip to content

Commit b2f2abc

Browse files
committed
Make palette color ordering consistent with ColorConvertes and fix blinka.
1 parent 3139d0d commit b2f2abc

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

shared-module/displayio/Palette.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ void common_hal_displayio_palette_make_transparent(displayio_palette_t* self, ui
4747
void common_hal_displayio_palette_set_color(displayio_palette_t* self, uint32_t palette_index, uint32_t color) {
4848
uint32_t shift = (palette_index % 2) * 16;
4949
uint32_t masked = self->colors[palette_index / 2] & ~(0xffff << shift);
50-
uint32_t b5 = (color >> 19);
50+
uint32_t r5 = (color >> 19);
5151
uint32_t g6 = (color >> 10) & 0x3f;
52-
uint32_t r5 = (color >> 3) & 0x1f;
52+
uint32_t b5 = (color >> 3) & 0x1f;
5353
uint32_t packed = r5 << 11 | g6 << 5 | b5;
5454
// swap bytes
5555
packed = __builtin_bswap16(packed);

shared-module/displayio/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ displayio_bitmap_t blinka_bitmap = {
9999

100100
uint32_t blinka_transparency[1] = {0x80000000};
101101

102-
// TODO(tannewt): Fix these colors
103-
uint32_t blinka_colors[8] = {0x91780000, 0x879FFC98, 0xffff0000, 0x0000f501,
102+
// These colors are RGB 565 with the bytes swapped.
103+
uint32_t blinka_colors[8] = {0x78890000, 0x9F86B8FC, 0xffff0D5A, 0x0000f501,
104104
0x00000000, 0x00000000, 0x00000000, 0x00000000};
105105

106106
displayio_palette_t blinka_palette = {

0 commit comments

Comments
 (0)