Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Color palette generator: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Little code snippet, that show how generate a | Little code snippet, that show how generate a | ||
color palette: | |||
<code> QList<QBrush> brushScale; | <code> 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))); | |||
}</code> | |||
Taken from: | Taken from: | ||
http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ |
Revision as of 12:18, 25 February 2015
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/