Rainbows do not have only 7 colours.
Technically, a rainbow consists of ALL the colours your eyes are capable of seeing, and more. A rainbow is a natural occurrence where light from the sun gets refracted by the atmosphere and (i'm super-boiling the physics down to simple analogies here) since sunlight is made up of many many photons traveling at different wavelengths, they bend at different angles, the end results is a rainbow.
There are more than 7 colours in a rainbow, but our eyes trick us into seeing the most prominent of the colours, sometimes if you look real close at a rainbow, you'd see more than 7 colours sandwiched between the borders of the "main" colours. You'll see cyan between blue and green, brown in red and orange, pink and maroon in blue and purple and so on.
If you really are fascinated at this subject and want to jump down the rabbit hole, you'd see a whole new world of particle and quantum physics which to this day scientists still make discoveries that change our very understanding of science. It's really interesting stuff that sheds light (pun intended) on the way the universe works.