Today I found some time to document the source code for the xmas decoration and push it to a GutHub repository. I added some comments to explain some of the cryptic calculations and added warnings what you should not copy from this code.
The link to the repository is: https://github.com/LuckyResistor/XmasLights
Have a look in the complete project description how to make your own color changing xmas decoration.