Arduino HEX(ie. 0xFB00) color chart

I am using a color tft screen and so far i was using only bitmaps. But now i want to draw some shapes myself(mainly to speed up display process), but i am really confused about color codes.

It is not a standard HEX format(6 letters) but it has 4 letters, for example 0xFFE0(yellow). I searched over all color charts(bmp, hex, rgb,...) a ton of convertes and color calculators but i could not find any that would make a correct code.

This is color codes i got along whit library(Adafruit GFX):
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

Any idea how i could get codes for the rest of colors? Thanks.

Any idea how i could get codes for the rest of colors?

Post a link to the library. The format is probably 5 bits for red, 6 bits for blue, and 5 bits for green.

Yes it works (5-6-5) like this, but how can i get color codes from that?

The format is called RGB565. It is similar to RGB888, but only uses 16 bits (5+6+5) instead of 24 (8+8+8) and so has less fine control over the colours (less colours available overall).

Here's a website to help calculate RGB565 values, but you should try to understand the format because it is not terribly difficult.

1 Like
#define BLUE 0x001F

suggests five bits for blue

#define RED 0xF800

five for red

#define GREEN 0x07E0

six for green

(The human eye is most sensitive to green, so having twice as many shades of green available makes sense)

but how can i get color codes from that?

The red value can be anything from 0 to 31. The green value can be anything from 0 to 63. The blue value can be anything from 0 to 21. Using <<, you can shift the red value 11 bits, then add the green value, after shifting it 5 bits, then add the blue value.

Adafruit products usually have pretty good documentation. You're just looking in the wrong place.

thanks you all for help and thanks @arduinodlb for solution. :DD

Please, is anyone can tell me about what is the orange color code?

KimPlayz4LK:
Please, is anyone can tell me about what is the orange color code?

Orange is red with a bit of green..

For orange, make a sketch with a for loop that can be controlled with a switch.

Have the colours sent to LEDs, when you get to the colour desired, push switch to print the current colour value.

I have always found that orange is a very difficult colour to make with RGB LEDs. A lot depends on the diffuser you use and the background colour it is viewed against. Mind you brown is a lot harder to get.

Grumpy_Mike:
I have always found that orange is a very difficult colour to make with RGB LEDs. A lot depends on the diffuser you use and the background colour it is viewed against. Mind you brown is a lot harder to get.

Brown is easy on a 12v ws2811, just power it with 8v