Created
May 1, 2018 08:54
-
-
Save m0ppers/0c5a3e06694af642b902bc32df27e405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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