To set the right colors for an RGB LED we have to set the appropriate values for R(ed), G(reen) and B(lue).
On this website I found this image explaining the composition of colored light from R, G and B.
You can step over the ratio axis and can generate all colors building a rainbow beginning from Red over Yellow, Green and Blue to Magenta and back to Red again.
If you start with three data points then you will get Red (0), Green (1/3) and Blue (2/3) only. The more equidistant data points are used, the finer the color gradation.
The required data points can be calculated with the Cosinus function to get a table of RGB values for controlling a RGB LED or Neopixels etc.