@@ -86,13 +86,31 @@ QgsNamedColorList QgsCustomColorScheme::fetchColors( const QString context, cons
86
86
Q_UNUSED ( baseColor );
87
87
88
88
// fetch predefined custom colors
89
+ QgsNamedColorList colorList;
89
90
QSettings settings;
90
91
92
+ // check if settings contains custom palette
93
+ if ( !settings.contains ( QString ( " /colors/ypalettecolors" ) ) )
94
+ {
95
+ // no custom palette, return default colors
96
+ colorList.append ( qMakePair ( QColor ( " #000000" ), QString () ) );
97
+ colorList.append ( qMakePair ( QColor ( " #ffffff" ), QString () ) );
98
+ colorList.append ( qMakePair ( QColor ( " #a6cee3" ), QString () ) );
99
+ colorList.append ( qMakePair ( QColor ( " #1f78b4" ), QString () ) );
100
+ colorList.append ( qMakePair ( QColor ( " #b2df8a" ), QString () ) );
101
+ colorList.append ( qMakePair ( QColor ( " #33a02c" ), QString () ) );
102
+ colorList.append ( qMakePair ( QColor ( " #fb9a99" ), QString () ) );
103
+ colorList.append ( qMakePair ( QColor ( " #e31a1c" ), QString () ) );
104
+ colorList.append ( qMakePair ( QColor ( " #fdbf6f" ), QString () ) );
105
+ colorList.append ( qMakePair ( QColor ( " #ff7f00" ), QString () ) );
106
+
107
+ return colorList;
108
+ }
109
+
91
110
QList< QVariant > customColorVariants = settings.value ( QString ( " /colors/palettecolors" ) ).toList ();
92
111
QList< QVariant > customColorLabels = settings.value ( QString ( " /colors/palettelabels" ) ).toList ();
93
112
94
113
// generate list from custom colors
95
- QgsNamedColorList colorList;
96
114
int colorIndex = 0 ;
97
115
for ( QList< QVariant >::iterator it = customColorVariants.begin ();
98
116
it != customColorVariants.end (); ++it )
0 commit comments