File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -345,10 +345,12 @@ double QgsRandomColorsV2::value( int index ) const
345
345
QColor QgsRandomColorsV2::color ( double value ) const
346
346
{
347
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 );
348
+ int minVal = 130 ;
349
+ int maxVal = 255 ;
350
+ int h = 1 + ( int )( 360.0 * rand () / ( RAND_MAX + 1.0 ) );
351
+ 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 );
352
354
}
353
355
354
356
QString QgsRandomColorsV2::type () const
You can’t perform that action at this time.
0 commit comments