newdigate / rgb565_colors

https://en.wikipedia.org/wiki/Lists_of_colors
40 stars 5 forks source link

Handy Conversion Tool #1

Closed DansDesigns closed 10 months ago

DansDesigns commented 10 months ago

Hey, Just seen your video on GUI programming with the Serial Monitor.. Brilliant Work!!

I had a look over your GitHub and I'm impressed, I thought i would share a little code i have found useful for converting the annoying hex colour definitions into the easier to understand RGB values:

` // Colour Conversion from RGB to HEX:

define RGB(r, g, b) (((r&0xF8)<<8)|((g&0xFC)<<3)|(b>>3))

// Colour definitions:

define BLACK RGB (0, 0, 0)

define WHITE RGB(255,255,255)

define GREY RGB(127, 127, 127)

define DARKGREY RGB(64, 64, 64)

define TURQUOISE RGB(0, 128, 128)

define PINK RGB(255, 128, 192)

define PINKRED RGB(235, 158, 220)

define OLIVE RGB(128, 128, 0)

define PURPLE RGB(128, 0, 128)

define AZURE RGB(0, 128, 255)

define ORANGE RGB(255,136,0)

define YELLOW RGB(255,255,0)

define GREEN RGB(51,255,51)

define SKYBLUE RGB(135,206,235)

define BLUE RGB(0,0,255)

define BLUEVIOLET RGB(138,43,226)

define AQUAMARINE RGB(127,255,212)

define RED RGB(255,53,0)

define HONEY RGB(255,204,153)

define BUTTER RGB(255,238,204)

define OCTSUNSET RGB(255,68,0)

define WARNING RGB(255,88,20)

`

*I added some Colours based on the Star Trek LCARS Colour Scheme

newdigate commented 10 months ago

Thanks @DansDesigns very kind. Yes that’s a great idea, in retrospect.

I have no idea what video you’re talking about, but yes I’ve been struggling with user interface for st7735 for years now. I love it….

Cheers buddy. Happy coding.

DansDesigns commented 10 months ago

haha, looks like I commented in the wrong place! After tracing my steps, I'm not sure how I ended up here! But still hope you find the conversion tool useful!