- gradient.setColorAt( 0.0, QColor( c(0), c(1), c(2) ) );
- gradient.setColorAt( 0.22, QColor( c(3), c(4), c(5) ) );
- gradient.setColorAt( 0.5, QColor( c(6), c(7), c(8) ) );
- gradient.setColorAt( 1.0, QColor( c(9), c(10), c(11) ) );
+#define add_color(gradient, range, c1, c2, c3) \
+ gradient.setColorAt( range, QColor( c(c1), c(c2), c(c3) ) );
+
+ /* Desaturated colors */
+#define desaturate(c) c->setHsvF( c->hueF(), 0.2 , 0.5, 1.0 )
+#define add_desaturated_color(gradient, range, c1, c2, c3) \
+ foo = new QColor( c(c1), c(c2), c(c3) );\
+ desaturate( foo ); gradient.setColorAt( range, *foo );\
+ delete foo;
+
+ /* combine the two helpers */
+#define add_colors( gradient1, gradient2, range, c1, c2, c3 )\
+ add_color( gradient1, range, c1, c2, c3 ); \
+ add_desaturated_color( gradient2, range, c1, c2, c3 );
+
+ QColor * foo;
+ add_colors( gradient, gradient2, 0.0, 0, 1, 2 );
+ add_colors( gradient, gradient2, 0.22, 3, 4, 5 );
+ add_colors( gradient, gradient2, 0.5, 6, 7, 8 );
+ add_colors( gradient, gradient2, 1.0, 9, 10, 11 );