UPD: simplify theme mode determining based on the new Lazarus/Cocoa version

(cherry picked from commit 2f33d5a553)
This commit is contained in:
rich2014 2025-12-19 23:56:32 +08:00 committed by Alexander Koblov
commit 6406ddc06b
2 changed files with 2 additions and 14 deletions

View file

@ -54,7 +54,6 @@ type
class procedure openSystemSecurityPreferences_PrivacyAllFiles;
public
class procedure setTheme( const mode: Integer );
class function isDarkTheme: Boolean;
public
class procedure fixFormatSettings;
class procedure openNewInstance;
@ -133,17 +132,6 @@ begin
TCocoaThemeServices.darwinThemeChangedNotify;
end;
class function TDarwinApplicationUtil.isDarkTheme: Boolean;
var
appearanceName: NSString;
begin
Result:= False;
if not NSApp.respondsToSelector( ObjCSelector('effectiveAppearance') ) then
exit;
appearanceName:= NSApp.effectiveAppearance.Name;
Result:= appearanceName.isEqualToString(NSSTR_DARK_NAME) or appearanceName.isEqualToString(NSSTR_DARK_NAME_VIBRANT);
end;
class procedure TDarwinApplicationUtil.fixFormatSettings;
var
S: String;

View file

@ -13,7 +13,7 @@ uses
uFileSource, uFileSourceOperationTypes, uFileSourceManager,
uFileSourceWatcher, uMountedFileSource, uVfsModule,
uDCUtils, uLng, uGlobs,
uDarwinApplication, uDarwinFSWatch, uDarwinSimpleFSWatch,
uDarwinFSWatch, uDarwinSimpleFSWatch,
uDarwinFile, uDarwinImage,
CocoaAll, CocoaUtils, CocoaThemes;
@ -542,7 +542,7 @@ begin
_downloadImage.release;
tempImage:= NSImage.alloc.initWithContentsOfFile( StrToNSString(mbExpandFileName(iCloudDriveConfig.icon.download)) );
tempImage.setSize( NSMakeSize(16,16) );
if TDarwinApplicationUtil.isDarkTheme then begin
if TCocoaThemeServices.isDark then begin
_downloadImage:= TDarwinImageUtil.invertColor( tempImage );
end else begin
_downloadImage:= tempImage;