After rainfall some water droplets suspend in air and acts as prism when light enters through them. So rainbow forms. As the colors arranged according to wave length. Red color has maximum wave length and violate has minimum wave length. It is based on intensity of light at different places.Rainbow is a continuos spectrum as one color merges with other color.