Color palette generator: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Add "cleanup" tag)
(Cleanup)
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
{{LangSwitch}}
Little code snippet, that show how generate a color palette:


Little code snippet, that show how generate a
<code>
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) ) );
}
</code>


<code> QList<QBrush> brushScale;
== External Links ==
double h=0;
# [http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ Marin Ankerl's blog]
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:
http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/

Revision as of 12:37, 28 June 2015

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

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) ) );
}

External Links

  1. Marin Ankerl's blog