2.8" TFT LCD Color Definitions

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ezagoeco
 
Posts: 17
Joined: Wed Mar 05, 2014 12:56 pm

2.8" TFT LCD Color Definitions

Post by ezagoeco »

I have my shiny new screen up and running, and it is working fine. I'm trying to get my head around the color definitions used in the header file to try and define a few other colors, but I'm having trouble getting my brain around the format:

#define ILI9341_BLACK 0x0000
#define ILI9341_BLUE 0x00F0
etc.

At first I thought it was RGB with 0 as a place holder. But then some of the lines end in an F, for example:
#define ILI9341_CYAN 0x07FF
Which indeed shows up as Cyan.

But if I define a new color as 0x06CF - it appears as more of a 'Kelly Green'

I know my 3-digit Hex Colors as well as my 6-digit Hex Colors - but I'm just not groking this format. Any decoding hints would be gratefully appreciated.

Thanks,
-Eric

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 2.8" TFT LCD Color Definitions

Post by adafruit_support_rick »

It's a 5/6/5 coding. the high 5 bits are red, the middle 6 bits are green, and the low 5 bits are blue.

Not sure where you found that definition of ILI9341_BLUE. These are the color definitions from the library:

Code: Select all

// Color definitions
#define	ILI9341_BLACK   0x0000
#define	ILI9341_BLUE    0x001F
#define	ILI9341_RED     0xF800
#define	ILI9341_GREEN   0x07E0
#define ILI9341_CYAN    0x07FF
#define ILI9341_MAGENTA 0xF81F
#define ILI9341_YELLOW  0xFFE0  
#define ILI9341_WHITE   0xFFFF
As you can see, the low 5 bits are set in ILI9341_BLUE

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”