When you close your eyes and focus them on one spot and don’t move them, you start to see grey, like static on a tv. What is that?
You can get the same sensation with your eyes open by staring at a spot, although it requires a little more focus.
If your eyes get the same information for a long time, you stop processing that information, so your vision gets replaced by gray blobs wherever the information is being lost.
To some extent, probably a little bit of light penetrating your eyelids.
But, if it happens when you’re in darkness, its most likely because when our senses are straining to detect something and not getting anything, it can cause our brains to kind of short circuit and develop a false input to fill the gap. This is why people have audio and visual hallucinations when they use sensory deprivation tanks. Our brains evolved to constantly process information from our senses in order to survive, so our brains literally can’t comprehend a lack of input.