What you are “seeing” are called “phosphenes.
The retina is analogous to film in a camera, located at the very back of the eye. Its nerve cells (photoreceptors and others) can only appreciate a stimulus in one way: by “seeing” light of various wavelengths and intensity. So rubbing your closed eyes creates pressure on many of the retinal nerve cells that is perceived as patterns of light and color.