Skip to content

Instantly share code, notes, and snippets.

@bright-light-in-the-night
Last active November 9, 2021 13:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bright-light-in-the-night/6cd116568a14047de037c5655ae8d401 to your computer and use it in GitHub Desktop.
Save bright-light-in-the-night/6cd116568a14047de037c5655ae8d401 to your computer and use it in GitHub Desktop.
// https://ee-programming-notepad.blogspot.com/2016/09/16-bits-rgb-color-representation.html
uint16_t color;
// white
color = 0b1111111111111111; // binary representation
color = 0xFFFF; // hexadecimal representation
color = 65535; // decimal representation
// black
color = 0b0000000000000000; // binary representation
color = 0x0000; // hexadecimal representation
color = 0; // decimal representation
// yellow
color = 0b1111111111100000; // binary representation
color = 0xFFE0; // hexadecimal representation
color = 65504; // decimal representation
// blue
color = 0b0000000000011111; // binary representation
color = 0x001F; // hexadecimal representation
color = 31; // decimal representation
// red
color = 0b1111100000000000; // binary representation
color = 0xF800; // hexadecimal representation
color = 63488; // decimal representation
// green
color = 0b0000011111100000; // binary representation
color = 0x07E0; // hexadecimal representation
color = 2016; // decimal representation
// cyan
color = 0b0000011111111111; // binary representation
color = 0x07FF; // hexadecimal representation
color = 2047; // decimal representation
// magenta
color = 0b1111100000011111; // binary representation
color = 0xF81F; // hexadecimal representation
color = 63519; // decimal representation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment