Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit 488124c

Browse files
author
Eric Maupin
committed
[mac] Manual theme image handling
1 parent 81e1929 commit 488124c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Xamarin.PropertyEditing.Mac.Standalone/ViewController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ partial void OnThemeChanged (NSObject sender)
9393
appearance = NSAppearance.NameVibrantDark;
9494
}
9595

96-
View.Appearance = NSAppearance.GetAppearance (appearance);
96+
var realAppearance = NSAppearance.GetAppearance (appearance);
97+
((HostResourceProvider)PropertyPanel.HostResourceProvider).CurrentAppearance = realAppearance;
98+
View.Appearance = realAppearance;
9799
}
98100
}
99101
}

Xamarin.PropertyEditing.Mac/HostResourceProvider.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ namespace Xamarin.PropertyEditing.Mac
77
public class HostResourceProvider
88
: IHostResourceProvider
99
{
10+
public NSAppearance CurrentAppearance
11+
{
12+
get;
13+
set;
14+
}
15+
1016
public virtual NSAppearance GetVibrantAppearance (NSAppearance appearance)
1117
{
1218
if (appearance == null)
@@ -25,6 +31,9 @@ public virtual NSColor GetNamedColor (string name)
2531

2632
public virtual NSImage GetNamedImage (string name)
2733
{
34+
if ((CurrentAppearance ?? NSAppearance.CurrentAppearance).Name.ToLower ().Contains ("dark"))
35+
name += "~dark";
36+
2837
return NSImage.ImageNamed (name);
2938
}
3039

0 commit comments

Comments
 (0)