Gradually fades a part of the palette to black. allegro game programming library.
#include <allegro.h>
void fade_out_range(int speed, int from, int to);
Gradually fades a part of the palette from the current palette to a black screen. The speed is from 1 (the slowest) up to 64 (instantaneous). This routine only affects colors between from and to (inclusive: pass 0 and 255 to fade the entire palette).
Note that this function will block your game while the fade is in effect, and it won't work right visually if you are not in an 8 bit color depth resolution.
fade_out(3alleg4)