There's a certain pattern of torches shown to match.
If done correctly, heading back to the gate will unlock it.
Thanks for bringing this to my attention, as there is a small error with the right side's lower-left torch.
Using it while the flame is purple incorrectly resets the lower-right torch's "value" for the puzzle instead (without changing its color). However, this can be worked around by changing the colors of the lower-right torch again.
The torches should match based on relative position (such as the lower-left one on the right side needing to be blue).
I will include a fix for this in a small update with a few other fixes.