Skip to content

Instantly share code, notes, and snippets.

@m0ppers
Created May 1, 2018 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0ppers/0c5a3e06694af642b902bc32df27e405 to your computer and use it in GitHub Desktop.
Save m0ppers/0c5a3e06694af642b902bc32df27e405 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdint.h>
#define COLOR_R 241
#define COLOR_G 127
#define COLOR_B 201
#define COLOR_A 255
int main() {
uint32_t rgba = (COLOR_R << 24) | (COLOR_G << 16) | (COLOR_B << 8) | (COLOR_A);
uint8_t* color = (uint8_t*) &rgba;
printf("R: %u G: %u B: %u A: %u\n", color[0], color[1], color[2], color[3]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment