
Rory M. answered 02/20/24
AI, Graphics, and Electronics Engineer offering customized learning.
So a single frequency of light is a really different thing from a mixture of red green and blue light, but you can use rgb to make a color that looks identical to a given wavelength. So keep that in mind considering this formula, it is going to be based on human perception, and only applicable to human eyes. It also means depending on the application you may need to lean towards a scientific approach or an artistic one. You also need to consider the display if you want best accuracy.
http://hyperphysics.phy-astr.gsu.edu/hbase/vision/imgvis/colcon.png
This image shows how human perception converts frequency to rgb, so you just need to copy this formula. A simple version could be some polynomial where r,g,or b will have a peak shifted to its corresponding frequency. Or you could use data from here directly: http://cvrl.ucl.ac.uk/cones.htm
The more artistic option is to search for a spectral color scheme, or perhaps photograph a rainbow, and use this base image as a table in the same way as the data I linked above.