Closed jgh07 closed 3 years ago
You could try to load the correct ResourceDictionary
and get the brush from it.
Something like this:
var colorScheme = new ResourceDictionary();
colorScheme.Source =
new Uri("pack://application:,,,/AdonisUI;component/ColorSchemes/Light.xaml",
UriKind.RelativeOrAbsolute);
var foreground = colorScheme[Brushes.ForegroundBrush] as Brush;
I did not test this code so it might not work exactly like this. (Source)
Is there a way to do this directly in XAML?
You could wrap this code in some custom dependency property and use it in XAML.
Is there a way to get the ForegroundBrush of the not currently loaded theme (would be black in dark mode and white in light mode) in Xaml?