@@ -38,7 +38,18 @@ public TrayService(MainWindow owner)
3838 Menu = BuildMenu ( owner , _restartComputerItem ) ,
3939 } ;
4040
41+ // macOS tints the menu bar from the wallpaper, not from the system appearance, so no theme
42+ // check can pick the right glyph; a template icon is masked and tinted by macOS itself.
43+ if ( OperatingSystem . IsMacOS ( ) )
44+ {
45+ MacOSProperties . SetIsTemplateIcon ( _trayIcon , true ) ;
46+ }
47+
4148 PendingRebootStore . Changed += OnPendingRebootStoreChanged ;
49+ if ( Application . Current ? . PlatformSettings is { } platformSettings )
50+ {
51+ platformSettings . ColorValuesChanged += OnPlatformColorValuesChanged ;
52+ }
4253
4354 _trayIcon . Clicked += ( _ , _ ) => Dispatcher . UIThread . Post ( ( ) => owner . ShowFromTray ( ) ) ;
4455
@@ -144,15 +155,30 @@ private static bool IsTaskbarLight()
144155 return false ;
145156 }
146157#else
147- // On Linux (and other platforms), mirror the app's active theme variant so
148- // the icon remains legible regardless of the desktop colour scheme.
149- return Application . Current ? . ActualThemeVariant == ThemeVariant . Light ;
158+ // macOS: the icon is a template (see the constructor), only its alpha is used.
159+ if ( OperatingSystem . IsMacOS ( ) )
160+ {
161+ return true ;
162+ }
163+
164+ // The Linux panel follows the desktop appearance, not UniGetUI's own theme.
165+ var app = Application . Current ;
166+ PlatformThemeVariant ? osVariant = app ? . PlatformSettings ? . GetColorValues ( ) . ThemeVariant ;
167+ if ( osVariant is not null )
168+ {
169+ return osVariant == PlatformThemeVariant . Light ;
170+ }
171+
172+ return app ? . ActualThemeVariant == ThemeVariant . Light ;
150173#endif
151174 }
152175
153176 private void OnPendingRebootStoreChanged ( object ? sender , EventArgs e )
154177 => Dispatcher . UIThread . Post ( UpdateStatus ) ;
155178
179+ private void OnPlatformColorValuesChanged ( object ? sender , PlatformColorValues e )
180+ => Dispatcher . UIThread . Post ( UpdateStatus ) ;
181+
156182 private static NativeMenu BuildMenu ( MainWindow owner , NativeMenuItem restartComputerItem )
157183 {
158184 var menu = new NativeMenu ( ) ;
@@ -194,6 +220,11 @@ public void Dispose()
194220 {
195221 PendingRebootStore . Changed -= OnPendingRebootStoreChanged ;
196222 var app = Application . Current ;
223+ if ( app ? . PlatformSettings is { } platformSettings )
224+ {
225+ platformSettings . ColorValuesChanged -= OnPlatformColorValuesChanged ;
226+ }
227+
197228 if ( app is not null )
198229 TrayIcon . GetIcons ( app ) ? . Remove ( _trayIcon ) ;
199230 _trayIcon . Dispose ( ) ;
0 commit comments