When a beam of sunlight comes down to Earth, the light is white. But, if the light beam happens to hit raindrops (in the above scenario mist from the ocean waves) on the way down at a certain angle, the different colors that make up the beam separate so that we can see them — in the form of a rainbow.
The angle for each color of a rainbow is different, because the colors slow down at different speeds when they enter the raindrop. The light exits the raindrop in one color, depending on the angle it came in, so we see only one color coming from each raindrop.
Light at different angles coming through many raindrops form the rainbow that we see, in stripes of red, orange, yellow, green, blue, indigo and violet.
Gif via humblegifs
Image: Ocean Rainbow
[Discovery Kids - Tell Me: How do rainbows form?]