private static void SetOfficeTheme(Mode mode, Theme newTheme, RuntimeConfig rtc, byte lightTheme, byte darkTheme, bool enabled) { if (enabled) { if (mode == Mode.DarkOnly) { RegistryHandler.OfficeTheme(darkTheme); rtc.CurrentOfficeTheme = Theme.Dark; } else if (mode == Mode.LightOnly) { RegistryHandler.OfficeTheme(lightTheme); rtc.CurrentOfficeTheme = Theme.Light; } else { if (newTheme == Theme.Dark) { RegistryHandler.OfficeTheme(darkTheme); } else { RegistryHandler.OfficeTheme(lightTheme); } rtc.CurrentOfficeTheme = newTheme; } } }