The answer is . . . sunglasses!

Zaphod Beeblebrox in 'The Hitchhikers Guide to the Galaxy' used sunglasses that turned completely dark at the first sign of danger, thus preventing him from seeing anything that might alarm him. The only drawback: he couldn't see anything, including where he was going!
 
The invention may seem like fiction, but a similar type of glasses do exist!
Photochromic lenses appear transparent when indoors and darken outdoors and in UV light. Developed by Corning in the late 1960s, sunglasses and prescription lenses which darken when exposed to sunlight became known as Transitions lenses, and were hugely popular in the 90's.
 
How do these intriguing lenses work?
A Photochromic lense has millions of molecules of pigments such as silver halide or silver chloride embedded inside. When UV light is absent, these molecules are transparent under artificial light. In this state, they lose their light absorbing properties.

When exposed to direct sunshine, the molecules undergoes a chemical process that causes them to change appearance. Their new molecular structure absorb parts of the visible light. This causes the lenses to darken.
 
Corning made their original PhotoBrown and PhotoGrey products out of glass, and the molecules were distributed evenly throughout the entire lens. Yet this method caused problems in prescription glasses, where different parts of the lens were of varying thickness. This meant thicker parts of the lens would appear darker than the thinner areas. This is due to the intensity of UV rays having an effect on how many molecules can change shape. 

As plastic lenses gained popularity, a new method was developed. By immersing these lenses in a chemical tank, the Photochromatic molecules were absorbed into the plastic at a depth of about 150 microns. Transitions lenses use this process in their plastic lenses. And this method is a lot more effective than standard coatings of this nature, which normally are only around 5 microns thick. Simply, there aren't enough molecules to make the lenses very dark.
 
Sunglasses with Photochromic lenses are very tinted in colour. Some cars have glass windshield which block UV light too.

SFXC sell Photochromic pigments and inks which turn vibrant colours when exposed to UV light or sunshine! These water-based products can be used for screen printing, on textiles, fabrics and more!

Would you prefer to have Zaphod Beeblebrox's glasses or Photochromic Transition lenses? What would happen if both technologies were combined?