From c4e5d6b223f0a584d71eb4097d38d2381d052aa1 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sun, 5 Jan 2025 05:17:07 -0500 Subject: [PATCH 1/3] Add method that tells the app/backend that we are using a dark mode theme --- Headers/Additions/GNUstepGUI/GSTheme.h | 9 +++++++++ Source/GSTheme.m | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/Headers/Additions/GNUstepGUI/GSTheme.h b/Headers/Additions/GNUstepGUI/GSTheme.h index 643617cac..e02476acc 100644 --- a/Headers/Additions/GNUstepGUI/GSTheme.h +++ b/Headers/Additions/GNUstepGUI/GSTheme.h @@ -783,6 +783,15 @@ APPKIT_EXPORT_CLASS */ - (NSString*) license; +/** + * Returns YES if in dark mode, and NO, if not. The reasoning behind this + * is that some applications may display on the screen in dark mode, but + * print with the colors reversed. This method allows GUI and the backend + * to understand when we are using a dark theme and render accordingly when + * printing. The default is NO, as the default theme is not a dark theme. + */ +- (BOOL) isDarkMode; + @end /** diff --git a/Source/GSTheme.m b/Source/GSTheme.m index 2067be731..066784d69 100644 --- a/Source/GSTheme.m +++ b/Source/GSTheme.m @@ -1339,6 +1339,11 @@ - (NSString *) license return [[self infoDictionary] objectForKey: @"GSThemeLicense"]; } +- (BOOL) isDarkMode +{ + return NO; +} + @end @implementation GSTheme (Private) From 9568ec7fb99120a68ba0fc8640333f2c4e91cbda Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sun, 5 Jan 2025 20:42:06 -0500 Subject: [PATCH 2/3] Add method that tells the app/backend that we are using a dark mode theme --- Headers/Additions/GNUstepGUI/GSTheme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Headers/Additions/GNUstepGUI/GSTheme.h b/Headers/Additions/GNUstepGUI/GSTheme.h index e02476acc..8c81090ee 100644 --- a/Headers/Additions/GNUstepGUI/GSTheme.h +++ b/Headers/Additions/GNUstepGUI/GSTheme.h @@ -784,7 +784,7 @@ APPKIT_EXPORT_CLASS - (NSString*) license; /** - * Returns YES if in dark mode, and NO, if not. The reasoning behind this + * Returns YES if in dark mode, or NO, if not. The reasoning behind this * is that some applications may display on the screen in dark mode, but * print with the colors reversed. This method allows GUI and the backend * to understand when we are using a dark theme and render accordingly when From 04c72e874c53e102251a598e2133e666853b81e1 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Wed, 8 Jan 2025 07:45:01 -0500 Subject: [PATCH 3/3] Use GSThemeDarkMode setting in the theme as the return value instead of it being hard coded --- Source/GSTheme.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/GSTheme.m b/Source/GSTheme.m index 066784d69..b3a3fbe31 100644 --- a/Source/GSTheme.m +++ b/Source/GSTheme.m @@ -1341,7 +1341,8 @@ - (NSString *) license - (BOOL) isDarkMode { - return NO; + return [[[self infoDictionary] objectForKey: @"GSThemeDarkMode"] + isEqualToString: @"YES"]; } @end