Color palette generator

From Qt Wiki
Revision as of 15:30, 3 March 2015 by AutoSpider (talk | contribs) (Add "cleanup" tag)
Jump to navigation Jump to search
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

Little code snippet, that show how generate a

color palette:
 QList<QBrush> brushScale;
 double h=0;
 double golden_ratio = 0.618033988749895;
 int ColorCount = 20;
 for (int i=0;i<ColorCount;i+'')
 {
 h''= golden_ratio * 360/ColorCount * i;
 h =(int)h60;
 brushScale.append(QBrush(QColor::fromHsv(int(h),245,245,255)));
 }

Taken from:

http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/