Who hasn't blown bubbles outside on a sunny day? If you haven't, devote some time to blowing bubbles the next time the sun is out - it's fun. As a bubble floats gracefully through the air, sunlight creates a virtual rainbow (actual rainbows are formed by a different process) of colours across the bubble's surface. The colour-making phenomenon at work is the same as what creates the colours on a slick of oil, a rooster's tail, a cardinal tetra or hummingbird's gorget – it's iridescence.
Bubble walls are constructed of several thin layers, two soap layers sandwich a layer of water between them. This wall encases a volume of air. As sunlight shines on a bubble, some of it reflects off the surface and some enters the soap film. Inside the bubble wall, light travels slower because both water and soap are denser than the air. At the interface between the soap film and the water, again some light reflects and some passes through. The reflected light may bounce back and forth between the two surfaces a few times or it may just pass back out of the bubble. Reflection or transmission of light occurs at every interface. Most of the light emerging from the interior of the bubble wall will be out of phase with the light that reflects off the interface. Out of phase means that the troughs from one wave line up with the crests from another so that the waves cancel each other out. Some of the emerging light will be in phase, that is, the crests and troughs line up with each other. These two light waves amplify each other, resulting in brilliant iridescent colours.
Layer thickness determines what wavelengths (thus colour) will be amplified. If you move and look at the bubble from a different angle, the colours will change. This is because your viewing angle has changed in relation to the layers. From different angles the distance the light has to traverse to reach you changes, thus the wavelengths that amplify each other also change.
Unfortunately, soap bubbles last only a short time. It doesn't take long before gravity pulls the liquid to the bottom and evaporation whisks fluid away. Bubble colours change as the bubble changes. When the bubble walls are thick, only red gets canceled out leaving blues and greens. As the walls thin, yellow is also canceled out leaving blue. Next green is removed and the bubble looks magenta. Blue goes last making the bubble look golden yellow. As the bubble wall's continue to thin, all the waves in the visible region cancel out and the bubble looks just clear. When the walls reach about 25 nanometres thick the bubble is in serious risk of popping.
Since the thickness of a bubble's walls aren't constant - the walls thicken towards the bottom (remember gravity acts to pull the water down), bands of colours seem to fall downwards on the surface. That pesky gravity also prevents us from dyeing bubbles. The dye will only mix with the water and drain to the bottom of the bubble. However, when gravity is absent dyeing bubbles becomes possible – so if you head out on a long voyage to Mars bring lots of bubble making supplies as you'll have years to perfect your bubble dyeing technique.