The shapes and colors that our eyes see when we rub our eyes a lot, are known as "phosphine" and have been known long ago, since the time of the ancient Greeks.
Rubbing the eyes increases the pressure inside the pupil of the eye and this pressure activates the ganglion cells in the retina, in the same way as light. Your brain does not know the difference and thus interprets activation as if you were seeing light from the outside world.
The most common phosphons are blocks of different colors that move by friction.
Next, are the particles like sparks and we move fast.
These "images" are reminiscent of psychedelic paintings, because hallucinogens * also affect the visual system.
* Hallucinogen - A drug that causes hallucinations, such as LSD.
Other effects include a range of bright blue dots of light.
If you want to experience these, be careful and gently rub your eyes for a while. Do not press them hard because you risk eye damage.
Source: Science Focus