Just for a moment, the setting Sun turns green

This photo captures the sun setting over Spain's Canary Islands, and it reveals two phenomena that are often dismissed as myths: the fabled green flash, and the even rarer blue flash. Here's how these strange lights appear.

So why does the Sun turn green or blue? A NASA expert explains:

Many think it is just a myth. Others think it is true but its cause isn't known. Adventurers pride themselves on having seen it. It's a green flash from the Sun. The truth is the green flash does exist and its cause is well understood. Just as the setting Sun disappears completely from view, a last glimmer appears startlingly green. The effect is typically visible only from locations with a low, distant horizon, and lasts just a few seconds. A green flash is also visible for a rising Sun, but takes better timing to spot...The Sun itself does not turn partly green or blue — the effect is caused by layers of the Earth's atmosphere acting like a prism.

This particular green flash is probably an inferior-mirage flash, a particular type of green flash caused by the surface of the water being warmer than the surrounding air. Flashes occur because light moves more slowly in the denser air nearer the surface than the thinner air of the upper atmosphere, causing sunlight to travel on subtly curved paths that are parallel to the curvature of the Earth.

The reason why these flashes appear green or blue is that they are higher-frequency forms of light, which have greater curves than lower-frequency counterparts like red or orange. This means they are able to remain visible longer, because the curvature of the Earth hasn't fully obstructed them yet. It's an effect that can only last for a couple of seconds, and requires relatively unpolluted air to see.

[NASA]