@@ -13,7 +13,7 @@ interface
1313
1414type
1515
16- TDefaultChecked = function(const TrackerURL: UTF8String ): boolean of object ;
16+ TDefaultChecked = function(const TrackerURL: utf8string ): boolean of object ;
1717
1818 { TControlerTrackerListOnline }
1919
@@ -35,7 +35,7 @@ TControlerTrackerListOnline = class
3535 procedure SetChecked (index: integer; AValue: boolean);
3636 procedure ShowTrackerStatus (Visible: boolean);
3737 procedure AppendRow (Checked: boolean; Status: TTrackerListOnlineStatus;
38- const TrackerURL: UTF8String );
38+ const TrackerURL: utf8string );
3939 public
4040 property Checked[index: integer]: boolean read GetChecked write SetChecked;
4141 function TrackerURL (index: integer): string;
@@ -65,6 +65,17 @@ implementation
6565{ TControlerTrackerListOnline }
6666
6767
68+ function IsDarkTheme : boolean;
69+ // by "Hansaplast" & "Alextp" from Lazarus forum
70+ function _Level (C: TColor): double;
71+ begin
72+ Result := Red(C) * 0.3 + Green(C) * 0.59 + Blue(C) * 0.11 ;
73+ end ;
74+
75+ begin
76+ Result := _Level(ColorToRGB(clWindow)) < _Level(ColorToRGB(clWindowText));
77+ end ;
78+
6879function TControlerTrackerListOnline.DownloadTrackers_All_Live_Stable : boolean;
6980begin
7081 Result := FNewTrackon.Download_All_Live_Stable;
@@ -88,7 +99,11 @@ constructor TControlerTrackerListOnline.Create(StringGridTorrentURL: TStringGrid
8899 FStringGridTorrentURL := StringGridTorrentURL;
89100 FStringGridTorrentURL.RowCount := 1 ;
90101 FStringGridTorrentURL.FixedRows := 1 ;
91- FStringGridTorrentURL.AlternateColor := clCream;
102+
103+ if not IsDarkTheme then
104+ begin // The dark theme for Linux and macOS cannot use AlternateColor. Text will be invisible.
105+ FStringGridTorrentURL.AlternateColor := clCream;
106+ end ;
92107
93108 FSelect := FStringGridTorrentURL.Columns.Add;
94109 FSelect.Title.Caption := ' Keep' ;
@@ -144,7 +159,7 @@ procedure TControlerTrackerListOnline.SetChecked(index: integer; AValue: boolean
144159
145160
146161procedure TControlerTrackerListOnline.AppendRow (Checked: boolean;
147- Status: TTrackerListOnlineStatus; const TrackerURL: UTF8String );
162+ Status: TTrackerListOnlineStatus; const TrackerURL: utf8string );
148163var
149164 CheckedStr, StatusStr: string;
150165begin
0 commit comments