Example #1
0
        public ThemeManager(bool useWinSysAccent, bool useWinDefFont, bool includeWindowsTitleBar)
        {
            UseSegoeUIOnWindows                 = useWinDefFont;
            UseSystemAccentOnWindows            = useWinSysAccent;
            IncludeWindowsTitleBarInThemeChange = includeWindowsTitleBar;

            _isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

            if (_isWindows)
            {
                Win32Interop.OSVERSIONINFOEX osInfo = new Win32Interop.OSVERSIONINFOEX {
                    OSVersionInfoSize = Marshal.SizeOf(typeof(Win32Interop.OSVERSIONINFOEX))
                };
                Win32Interop.RtlGetVersion(ref osInfo);

                bool useDark = Win32Interop.GetSystemTheme(osInfo);
                PreferredTheme = useDark ? FluentThemeMode.Dark : FluentThemeMode.Light;
            }
            else
            {
                PreferredTheme = FluentThemeMode.Light;
            }
        }