It sounds like you are using Allegro 4 if you are storing colors as integers. It provides a variety of functions for you to use, just check out the manual.
// int makecol(int r, int g, int b);
int white = makecol(255, 255, 255);
int green = makecol(0, 255, 0);
Or the inverse:
int r = getr(color);
int g = getg(color);
int b = getb(color);
With Allegro 4, the ordering depends on the graphics card. So the return value of makecol()
can be different for the same color depending if it is stored RGB or BGR. So you must use the above functions to get the proper color values, and only after setting the graphics mode.
If using Allegro 5 (which I highly recommend over Allegro 4), you use the ALLEGRO_COLOR
struct, which hides the underlying implementation details and thus none of the above is applicable.