There is an epsiode of Babylon 5 where this is brought up as actual science. The idea being that at the moment of death, the cells covering the retina retain the signature of the last bits of light thy were exposed to. As a result, these cells can be analyzed to determine a rough estimation of what they were exposed to. They were able to prove that the eyeball in question had been exposed to a particular type of visible spectrum consistent with a Centari energy weapon, thus proving some point or other about who killed him.
Personally, I thought it was a real damn stretch.
It's not a secret that JMS is a devoted Lovecraftian. I mean, there's so much HPL in Babylon 5, some of it obvious (Charles Dexter, lol), some not (the whole plot of the 4th season is very much Derleth, while War Without End is heavily influenced by Shadow out of Time). Watching the whole thing with the Lovecraft and Tolkien references in your brain is huge fun!