So, where's the code? I want an algorithm that I can use in any software, not a web form.

This is the library the author references. I’ve used it myself and it works great

https://github.com/gka/chroma.js