We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 36c2f7f + bce3588 commit 70915caCopy full SHA for 70915ca
src/core/symbology-ng/qgsvectorcolorrampv2.cpp
@@ -345,10 +345,12 @@ double QgsRandomColorsV2::value( int index ) const
345
QColor QgsRandomColorsV2::color( double value ) const
346
{
347
Q_UNUSED( value );
348
- int r = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
349
- int g = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
350
- int b = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
351
- return QColor( r, g, b );
+ int minVal = 130;
+ int maxVal = 255;
+ int h = 1 + ( int )( 360.0 * rand() / ( RAND_MAX + 1.0 ) );
+ int s = ( rand() % ( DEFAULT_RANDOM_SAT_MAX - DEFAULT_RANDOM_SAT_MIN + 1 ) ) + DEFAULT_RANDOM_SAT_MIN;
352
+ int v = ( rand() % ( maxVal - minVal + 1 ) ) + minVal;
353
+ return QColor::fromHsv( h, s, v );
354
}
355
356
QString QgsRandomColorsV2::type() const
0 commit comments