It's a lot simpler than you think. The puzzle has been used in old RPG games, and the answer is the order of the 7 colors of the rainbow.
I literally thought that but couldn't make it work for some reason. XD
Thank you.