Skip to content
Permalink
Browse files
Don't use ugly colors for newly created gradient color ramps
Because NO ONE EVER wanted a bright blue->bright green color ramp!
  • Loading branch information
nyalldawson committed Oct 20, 2021
1 parent ffec1cc commit 24e2526e3a99193ccdcfe7b466cfb5dacb880e7b
Showing with 8 additions and 6 deletions.
  1. +4 −2 src/core/qgscolorramp.h
  2. +4 −4 tests/src/core/testqgsimageoperation.cpp
@@ -137,8 +137,10 @@ class CORE_EXPORT QgsGradientStop
//! List of gradient stops
typedef QList<QgsGradientStop> QgsGradientStopsList;

#define DEFAULT_GRADIENT_COLOR1 QColor(0,0,255)
#define DEFAULT_GRADIENT_COLOR2 QColor(0,255,0)
// these are the QGIS branding colors, exaggerated a bit to make a default ramp with greater color variation
// then the official QGIS color gradient!
#define DEFAULT_GRADIENT_COLOR1 QColor(69, 116, 40)
#define DEFAULT_GRADIENT_COLOR2 QColor(188, 220, 60)

/**
* \ingroup core
@@ -286,7 +286,7 @@ void TestQgsImageOperation::overlayColor()
void TestQgsImageOperation::distanceTransformMaxDist()
{
QImage image( mTransparentSampleImage );
QgsGradientColorRamp ramp;
QgsGradientColorRamp ramp( QColor( 0, 0, 255 ), QColor( 0, 255, 0 ) );
QgsImageOperation::DistanceTransformProperties props;
props.useMaxDistance = true;
props.ramp = &ramp;
@@ -301,7 +301,7 @@ void TestQgsImageOperation::distanceTransformMaxDist()
void TestQgsImageOperation::distanceTransformSetSpread()
{
QImage image( mTransparentSampleImage );
QgsGradientColorRamp ramp;
QgsGradientColorRamp ramp( QColor( 0, 0, 255 ), QColor( 0, 255, 0 ) );
QgsImageOperation::DistanceTransformProperties props;
props.useMaxDistance = false;
props.spread = 10;
@@ -317,7 +317,7 @@ void TestQgsImageOperation::distanceTransformSetSpread()
void TestQgsImageOperation::distanceTransformInterior()
{
QImage image( mTransparentSampleImage );
QgsGradientColorRamp ramp;
QgsGradientColorRamp ramp( QColor( 0, 0, 255 ), QColor( 0, 255, 0 ) );
QgsImageOperation::DistanceTransformProperties props;
props.useMaxDistance = true;
props.ramp = &ramp;
@@ -344,7 +344,7 @@ void TestQgsImageOperation::distanceTransformMisc()
//zero spread
QImage image2( mSampleImage );
QgsImageOperation::DistanceTransformProperties props2;
QgsGradientColorRamp ramp;
QgsGradientColorRamp ramp( QColor( 0, 0, 255 ), QColor( 0, 255, 0 ) );
props2.useMaxDistance = false;
props2.spread = 0;
props2.ramp = &ramp;

0 comments on commit 24e2526

Please sign in to comment.