That works because the RGB receptors in the eye have different transient responses, so by precisely timing flashes of light you can create a color illusion. This is called the Fechner color effect : https://en.wikipedia.org/wiki/Fechner_color
Interesting! I don’t remember the name of the program (it was some shareware program I downloaded in the mid 1990s) but I’m pretty certain it used those Fechner discs to create the illusion.