Skip to content

Instantly share code, notes, and snippets.

@jaredpsimpson
Created March 28, 2019 21:04
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 jaredpsimpson/eb212181d1edd4e7f7411fc8b93a66b4 to your computer and use it in GitHub Desktop.
Save jaredpsimpson/eb212181d1edd4e7f7411fc8b93a66b4 to your computer and use it in GitHub Desktop.
HEX to split RGB
// Get rid of '#' and convert it to integer
long int number = strtol(&command[0], NULL, 16);
// Split them up into r, g, b values
int red = number >> 16;
int green = number >> 8 & 0xFF;
int blue = number & 0xFF;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment