How do you convert from color HEX code to RGB in pure C using C library only (without C++ or templates)? The RGB struct may be like this:
Assuming that your hex value is a 32-bit 'int' type, and that we use the RGB struct described above, then maybe do something like:
struct RGB colorConverter(int hexValue)
{
struct RGB rgbColor;
rgbColor.r = ((hexValue >> 16) & 0xFF) / 255.0; // Extract the RR byte
rgbColor.g = ((hexValue >> 8) & 0xFF) / 255.0; // Extract the GG byte
rgbColor.b = ((hexValue) & 0xFF) / 255.0; // Extract the BB byte
return rgbColor;
}