Think of the soap film as a water sandwich: a layer of water held between two layers of soap molecules. When the soap film is vertical, gravity pulls the water down, causing the top of the film to become thinner and the bottom to become thicker.
The reflections caused by these different thicknesses of soap film then cancel out different colors, producing bands of color that stretch across the film can.
Light reflects from both the front and back of the soap film. The light waves reflected from the front of the soap film are inverted while those from the back are not. The two reflections combine, producing interference of light.
When interference of light occurs, some color wavelengths add up “out of phase”—the highest point of one wave lines up with the lowest point of the other—and are therefore canceled. Others add up “in phase”—where the highest point of one wave lines up with the highest point of the other—and are therefore strengthened.
Understanding the colors of the soap film from top to bottom:
When soap films are thin compared to the wavelengths of light moving through them, they reflect no light at all, making them invisible. You can see this happening at the top of your soap film. Poking the invisible soap film with a pencil point reveals its presence because the entire soap film breaks.
When the soap film is a quarter of a wavelength of blue light thick, blue light is reflected strongly. At this same point, the film is about an eighth of a wavelength of red light thick—the wavelength of red light is just under twice that of blue, so some red light is reflected. The result is that the transparent film thickens into a metallic white sheen that appears bluer as it gets thicker.
Moving down the film, when it is half of a wavelength of blue light thick, the blue waves add up out of phase and cancel. At this point, the soap film is now a quarter of a wavelength of red light thick and the red waves add up in phase, resulting in a reddish color band.
Every integer multiple of a half blue wavelength in thickness, blue light is canceled; every odd multiple of a quarter blue wavelength, blue light is strengthened. Every multiple of a half red wavelength, the red light is cancelled. The result is alternating bands of bluish and reddish light as the film grows thicker—like contour lines on a topographic map.