All the colors need to be 8 bits, not 16 or 32 like you’re returning for green and blue. For green, if you shift it 8 places to the right, you’re left with the red and green values with 16 bits of information, so if you cast that to a uint8_t (by having the return type be a uint8_t), you will only get the 8 least significant bits. For blue, just casting c to an uint8_t will do the same.
uint8_t getRedValueFromColor(uint32_t c) {
return c >> 16;
}
uint8_t getGreenValueFromColor(uint32_t c) {
return c >> 8;
}
uint8_t getBlueValueFromColor(uint32_t c) {
return c;
}