The new lens can switch within seconds from clear to darkly shaded and back again in response to a small electrical charge that a wearer could control, researchers said.
The colour of the lenses can be fine-tuned to match the full range of hues used in commercial sunglasses, researchers report in a study published in the journal ACS Applied Materials & Interfaces.
To make the lenses, researchers said they used a method that could be easily scaled up for manufacturing.
When wearers are driving or wearing a baseball cap, for example, the lenses stay clear rather than switching to a darker shade even in broad daylight.
Also, the majority of available versions don't block out the harshest light, such as bright light reflected off snow.
The change from coloured to clear can take several minutes, which has safety implications for certain users including airline pilots, researchers said.