Snakes are descended from highly visual lizards  but have limited (probably dichromatic) color vision attributed to a dim-light lifestyle of early snakes [2–4]. The living species of front-fanged elapids, however, are ecologically very diverse, with ∼300 terrestrial species (cobras, taipans, etc.) and ∼60 fully marine sea snakes, plus eight independently marine, amphibious sea kraits . Here, we investigate the evolution of spectral sensitivity in elapids by analyzing their opsin genes (which are responsible for sensitivity to UV and visible light), retinal photoreceptors, and ocular lenses. We found that sea snakes underwent rapid adaptive diversification of their visual pigments when compared with their terrestrial and amphibious relatives. The three opsins present in snakes (SWS1, LWS, and RH1) have evolved under positive selection in elapids, and in sea snakes they have undergone multiple shifts in spectral sensitivity toward the longer wavelengths that dominate below the sea surface. Several relatively distantly related Hydrophis sea snakes are polymorphic for shortwave sensitive visual pigment encoded by alleles of SWS1. This spectral site polymorphism is expected to confer expanded “UV-blue” spectral sensitivity and is estimated to have persisted twice as long as the predicted survival time for selectively neutral nuclear alleles. We suggest that this polymorphism is adaptively maintained across Hydrophis species via balancing selection, similarly to the LWS polymorphism that confers allelic trichromacy in some primates. Diving sea snakes thus appear to share parallel mechanisms of color vision diversification with fruit-eating primates.