nice work. I think you could tune this a bit more to pick the right colours for the right elements, bad contrast and clashing colours sometimes appear. but nice effort, bookmarked :)
thanks, some intelligent way to automatically assign colors would be nice. May be I'll look at colors brightness and hue. For now, you can manually reassign them if the generated theme doesn't work.
It's over a dozen hours later, but...
In the past I've used relative luminance to determine whether to display light or dark text on a colored background (take relative luminance of both, determine contrast ratio, don't remember exactly what ratio was required, I believe 5:1). You could use a similar method for the generated colors and use low ratios for things like gradients and high ratios for highlight buttons, etc.