Color palette generator

From Qt Wiki
Revision as of 11:52, 28 November 2016 by EdwardWelbourne (talk | contribs) (Categorize)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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