Skip to content

Instantly share code, notes, and snippets.

@jaredpsimpson
jaredpsimpson / hex.c
Created March 28, 2019 21:04
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;