Offending line:
https://github.com/tuupola/hagl/blob/master/src/hagl.c#L364
The easiest fix would be for hagl_put_text / hagl_put_char to take a second color parameter which would represent the "background" color in the rasterized bitmap.
A completely different approach would be for HAGL to be reworked to have a notion of "state", which would include the current foreground color (used by draw* and text functions), current background color (used by fill* and text functions) and current font (used by text functions).
But that might be too big of a change.