Yes...it's called a prism. Duh.
White light is split into the fundamental colors of a rainbow; e.g., ROYGBIV...red, orange, yellow, green, blue, indigo, and violet.
What you are missing is that light is no more than a mix of electromagnetic wavelengths. The prism then separates that mix into the discrete colors each at different wavelengths.