Palette Formats

From NerdConsole
Jump to navigationJump to search

Most of the time NerdConsole operates in true 24-bit RGB888 color. There is one special graphics mode that trades that for 12-bit RGB444 color for the purposes of packing even more colors onto the screen.

RGB888

This format takes 3 bytes of data per color granting access to 16,777,216 possible colors.

Bit 7 6 5 4 3 2 1 0
Byte 0 R R R R R R R R
Byte 1 G G G G G G G G
Byte 2 B B B B B B B B

R=Red | G=Green | B=Blue

RGB444

This format takes 1.5 bytes of data per color granting access to 4,096 possible colors. This format interleaves 2 colors for every three bytes of palette data.

Bit 7 6 5 4 3 2 1 0
Byte 0 R0 R0 R0 R0 G0 G0 G0 G0
Byte 1 B0 B0 B0 B0 R1 R1 R1 R1
Byte 1 G1 G1 G1 G1 B1 B1 B1 B1

Even color entrties: R0=Red | G0=Green | B0=Blue

Odd color entrties: R1=Red | G1=Green | B1=Blue

RGB565

Some bitmapped graphics mode use the RGB565 mode to reduce the number of bytes needed per pixel to 2 while still providing 65,536 colors. Human eyes can see varying levels of green better than red or blue, so the extra bit is used for green.

Bit 7 6 5 4 3 2 1 0
Byte 0 R R R R R G G G
Byte 1 G G G B B B B B

R=Red | G=Green | B=Blue