How to simulate a rainbow