The first sunglasses were meant to protect you not from the sun but from so-called "snow blindness." Residents of the Far North used to make them entirely of wood, bone, or other nontransparent material, leaving narrow slits for the eyes: this helped to preserve one’s vision when snow surfaces became blindingly reflective.
These days, sunglasses are not just a means of protecting eyesight but also a fashion accessory with a wide range of styles.