It is accomplished by changing the background color in-between scan lines being drawn on the monitor/screen. This requires accessing the video controller hardware directly and changing appropriate registers as well as a way to time it precisely with the screen being drawn.
DumbGame is a video game I wrote in 2002 intended to serve as somewhat of a tutorial or map of how games were developed in years past, on the 80×86 architecture under DOS (Disk Operating System). Going through an old laptop hard-drive I recently rediscovered its source code, finally making an appearance on the Internet as intended, even more appropriate and nostalgic this many more years later.
Its name sake is due to the fact that the actual game play, graphics, levels etc. were minimally developed only to the extent needed to showcase the functionality of the game engine.