What is the purpose of colored lenses?

I know from snowboarding that orange is good for giving snowy terrain more contrast, but I don't know how it applies to cycling. Lens colors range from browns to oranges to yellows and even pinks... it there a reason for this, or is it just cosmetic?