It's called Photochromic lens or transitional lens.
It is transparent indoor. But when it is in the sun, the color changes according to the intensity of the ultra violet.
The color of the glasses get dark when they are exposed to ultraviolet radiation. It becomes a pair of sunglasses when you are outdoor.While, as long as the light source is taken away,say, entering indoors, the glasses turns back to normal transparency. Transitional lenses can be made of polycarbonate, glass,or another plastic.
The advantage and disadvantage of Photochromic lens:
Advantage: If you have both vision problem which requires you to wear a pair of glasses and you are also in need of a pair of sunglasses to protect yourself from ultraviolet, you can have photochromis lens as it has both functions of sunglasses and normal glasses.
Disadvantage: The color doesn't change quick enough.