The six shown colors are simply as visually distinct from one another as they can be, as they are (roughly) equidistantly distributed along the color spectrum.
Quite obviously, the rainbow is defined as the color spectrum, to there is some overlap between the two color palettes, but that doesn't mean that the stones are colored as an intentional reference to a rainbow.
The color of the stones is not relevant to the plot. The plot never established particular colors being necessary. From a plotwise perspective, the stones could have been the same color.
But that wouldn't be visually pleasing. Having the stones distributed among the color spectrum indirectly suggests that they are a complete set, plus it makes stones easily identifiable without needing someone to always verbally identify a stone.