This following link discusses the phenomenon in terms of phosphenes:
https://www.huffpost.com/entry/why-do-i-see-patterns-when-i-...
Arguably, there have been spiritual movements fueled by relative ignorace around these things, with gurus allegedly claiming that they enable these unexpected experiences for their disciples.
I can voluntarily cause a burst of those color patterns by, after closing my eyes, relaxing all my facial muscles and letting my eyes go unfocused. Works best when trying to fall asleep, so I can imagine people unintentionally doing the same during, say, meditation and correlating it with their spiritual leader.
A sociologist who studied the spiritual cultures concluded there were many conformity-related behaviors at work. Oh, yea, I had the experience.
When I close my eye, I usually see an outline of bright/dark somewhat matching what I last saw, but desaturated and splotchy.
If I keep my eyes close, the patches kinda drift around. It's kinda fun to watch sometimes but I get bored eventually open my eyes.
I've always assumed its my eyes just adjusting to the dark, or maybe its residual light my eyelids can't filter out.