qgis/QGIS — pull request #1581 by nyalldawson (2014-09-14 12:14:34+00:00)
Title: Improved method for selecting random colors for categorised renderer

At the moment, the colors chosen by the categorised renderer are totally random. This is suboptimal, and results in a kind of lottery where you may end up with a nice distinct color scheme or a scheme where classes are indistinguishable. For instance:..

![screenshot from 2014-09-14 14 14 01](https://cloud.githubusercontent.com/assets/1829991/4263849/b56c67fe-3c05-11e4-9e11-d8f263adb5de.png)

This pull request modifies QgsVectorColorRampV2 so that ramps can be notified of the total desired number of colors to be generated by the ramp. This lets us precalculate a nicer set of colors which have a much greater chance of being visual distinct from one another.

It's not perfect, but works well for ~<10 colors and in any case is 100x better than the current behaviour. I'll keep investigating better methods for selecting visually distinct colors, but in the meantime I think this is worthwhile merging.