Skip to content

Handy Conversion Tool #1

@DansDesigns

Description

@DansDesigns

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 that 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

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions