using Microsoft.Win32; using Pilz.UI.Gtk.Symbols; using System.Runtime.InteropServices; namespace ModpackUpdater.Apps; public static class AppGlobals { public static IGtkSymbolFactory Symbols { get; } = new AppSymbolFactory(); public static void Initialize() { if (UsesWindowsDarkTheme()) Environment.SetEnvironmentVariable("GTK_THEME", "Adwaita:dark"); //RadFlyoutBase.ConfirmSvg = Symbols.GetSvgImage(AppSymbols.checkmark, Pilz.UI.Symbols.SymbolSize.Small); //RadFlyoutBase.CancelSvg = Symbols.GetSvgImage(AppSymbols.cancel, Pilz.UI.Symbols.SymbolSize.Small); } private static bool UsesWindowsDarkTheme() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { try { return Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")?.GetValue("AppsUseLightTheme") as bool? ?? default; } catch (Exception) { } } return default; } }