Look at what's hanging from the machine.
There are seven flasks.
Just like the seven colors of the rainbow.
You need to pour something in those flasks to make a rainbow.
Find red, orange, yellow, green, blue, indigo, and violet potions, and put them in that order (left to right) in the flasks.