Tiny Screen Color Values

Started by fodderzone, February 22, 2015, 05:35:14 PM

Previous topic - Next topic

fodderzone

*
Newbie
Posts: 1
Logged
I just got a TinyScreen and have started playing around with it and came across a basic question.

What are the constants for colors? Or more to the point, the color appears to be set using a uint8_t, but the values I see defined as constants for colors don't make sense to me. Can someone help me understand how colors are represented using uint8_t? Like RGB... or is there some set of defines I can use?

Here are some of the constants I see in examples:

#define   BLACK         0x00
#define   BLUE           0xE0
#define   RED             0x03
#define   GREEN         0x1C
#define   DGREEN       0x0C
#define     YELLOW       0x1F


I could figure it out on my own, but boy that's a lot values to test and figure out.

Thanks!! 

mike_ekim1024

***
Full Member
Posts: 17
Logged
Take a look in TinyScreen.cpp - there's a version of drawRect() which extracts rgb from a byte:

  uint8_t r=(color&0x03)<<4;//two bits
  uint8_t g=(color&0x1C)<<1;//three bits
  uint8_t b=(color&0xE0)>>2;//three bits
  ...

So it looks like RGB 2:3:3 is the color format.

zet23t

***
Full Member
Posts: 44
Logged
I created a small html/javascript page to have a colortable ready:
http://zetsgames.com/colortable.html

SMF spam blocked by CleanTalk