@@ -78,6 +78,11 @@ extern double NSAppKitVersionNumber;
7878
7979namespace GUIUtil {
8080
81+ // The theme to set by default if settings are missing or incorrect
82+ static const QString defaultTheme = " Light" ;
83+ // The prefix a theme name should have if we want to apply dark colors and styles to it
84+ static const QString darkThemePrefix = " Dark" ;
85+
8186static const std::map<ThemedColor, QColor> themedColors = {
8287 { ThemedColor::DEFAULT, QColor (0 , 0 , 0 ) },
8388 { ThemedColor::UNCONFIRMED, QColor (128 , 128 , 128 ) },
@@ -121,13 +126,13 @@ static const std::map<ThemedStyle, QString> themedDarkStyles = {
121126QColor getThemedQColor (ThemedColor color)
122127{
123128 QString theme = QSettings ().value (" theme" , " " ).toString ();
124- return theme.startsWith (" dark " ) ? themedDarkColors.at (color) : themedColors.at (color);
129+ return theme.startsWith (darkThemePrefix ) ? themedDarkColors.at (color) : themedColors.at (color);
125130}
126131
127132QString getThemedStyleQString (ThemedStyle style)
128133{
129134 QString theme = QSettings ().value (" theme" , " " ).toString ();
130- return theme.startsWith (" dark " ) ? themedDarkStyles.at (style) : themedStyles.at (style);
135+ return theme.startsWith (darkThemePrefix ) ? themedDarkStyles.at (style) : themedStyles.at (style);
131136}
132137
133138QString dateTimeStr (const QDateTime &date)
@@ -927,9 +932,8 @@ QString loadStyleSheet()
927932
928933 QDir themes (" :themes" );
929934 // Make sure settings are pointing to an existent theme
930- // Set "Light" theme by default if settings are missing or incorrect
931935 if (theme.isEmpty () || !themes.exists (theme)) {
932- theme = " Light " ;
936+ theme = defaultTheme ;
933937 settings.setValue (" theme" , theme);
934938 }
935939
0 commit comments