Colour instrument
RGB565 Colour Reference
Pick an ordinary RGB colour and get its TFT-friendly RGB565 value, reproduced colour and ready-to-paste Arduino constant.
- Format
- Interactive
- Published
- Updated
Live conversion
Pick a colour
Choose an ordinary 24-bit colour. The nearest RGB565 value and the colour a 16-bit display can actually reproduce update immediately.
- Hex
- Decimal
- 16-bit binary
- Stored channels
- Reproduced RGB
Ready to paste
constexpr uint16_t COLOUR = 0xF267; If you have ever bounced between an ordinary RGB colour picker and a tiny TFT library demanding 0xF81F as though that is a perfectly ordinary thing to ask, this is the bridge between them.
What RGB565 stores
RGB565 stores colour in 16 bits:
- 5 bits red
- 6 bits green
- 5 bits blue
Green gets the extra bit because human vision is more sensitive to changes in green. Red and blue each get 32 possible levels; green gets 64. Converting from 24-bit RGB therefore loses some precision, which is why the picker shows the reproduced colour alongside the source.
The conversion
From 8-bit RGB values:
rgb565 = ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | (blue >> 3)
Or, if you prefer to think in ranges:
- red:
0-255becomes0-31 - green:
0-255becomes0-63 - blue:
0-255becomes0-31
Useful fixed values
Black 0x0000
White 0xFFFF
Red 0xF800
Green 0x07E0
Blue 0x001F
Yellow 0xFFE0
Cyan 0x07FF
Magenta 0xF81F
Where it helps
- hard-coding UI colours for TFT displays
- comparing the selected colour with what the display can reproduce
- pasting a
uint16_tconstant directly into Arduino code