@@ -13,7 +13,7 @@ interface
13
13
14
14
type
15
15
16
- TDefaultChecked = function(const TrackerURL: UTF8String ): boolean of object ;
16
+ TDefaultChecked = function(const TrackerURL: utf8string ): boolean of object ;
17
17
18
18
{ TControlerTrackerListOnline }
19
19
@@ -35,7 +35,7 @@ TControlerTrackerListOnline = class
35
35
procedure SetChecked (index: integer; AValue: boolean);
36
36
procedure ShowTrackerStatus (Visible: boolean);
37
37
procedure AppendRow (Checked: boolean; Status: TTrackerListOnlineStatus;
38
- const TrackerURL: UTF8String );
38
+ const TrackerURL: utf8string );
39
39
public
40
40
property Checked[index: integer]: boolean read GetChecked write SetChecked;
41
41
function TrackerURL (index: integer): string;
@@ -65,6 +65,17 @@ implementation
65
65
{ TControlerTrackerListOnline }
66
66
67
67
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
+
68
79
function TControlerTrackerListOnline.DownloadTrackers_All_Live_Stable : boolean;
69
80
begin
70
81
Result := FNewTrackon.Download_All_Live_Stable;
@@ -88,7 +99,11 @@ constructor TControlerTrackerListOnline.Create(StringGridTorrentURL: TStringGrid
88
99
FStringGridTorrentURL := StringGridTorrentURL;
89
100
FStringGridTorrentURL.RowCount := 1 ;
90
101
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 ;
92
107
93
108
FSelect := FStringGridTorrentURL.Columns.Add;
94
109
FSelect.Title.Caption := ' Keep' ;
@@ -144,7 +159,7 @@ procedure TControlerTrackerListOnline.SetChecked(index: integer; AValue: boolean
144
159
145
160
146
161
procedure TControlerTrackerListOnline.AppendRow (Checked: boolean;
147
- Status: TTrackerListOnlineStatus; const TrackerURL: UTF8String );
162
+ Status: TTrackerListOnlineStatus; const TrackerURL: utf8string );
148
163
var
149
164
CheckedStr, StatusStr: string;
150
165
begin
0 commit comments