diff --git a/EliteBGS/MainWindow.xaml.cs b/EliteBGS/MainWindow.xaml.cs index 0c3fff1..3a77fa8 100644 --- a/EliteBGS/MainWindow.xaml.cs +++ b/EliteBGS/MainWindow.xaml.cs @@ -16,7 +16,8 @@ using System.Windows.Forms; using System.Windows.Controls.Primitives; using ControlzEx.Theming; using MahApps.Metro.Controls; -using Xceed.Wpf.AvalonDock.Themes; +using ControlzEx.Theming; +using System.Windows.Media; namespace EliteBGS; @@ -60,15 +61,19 @@ public partial class MainWindow : MahApps.Metro.Controls.MetroWindow { // Apply theme try { + AddCustomThemes(); + string[] colours = ThemeManager.Current.Themes .Select(x => x.ColorScheme) .DistinctBy(x => x) .OrderBy(x => x) .ToArray() ; + foreach (var colour in colours) { Colour.Items.Add(colour); - if (string.Compare(colour, Config.Global.Colour, true) == 0) { + if (!string.IsNullOrEmpty(Config.Global.Colour) && + string.Compare(colour, Config.Global.Colour, true) == 0) { Colour.SelectedIndex = Colour.Items.Count - 1; } } @@ -81,8 +86,9 @@ public partial class MainWindow : MahApps.Metro.Controls.MetroWindow { ThemeManager.Current.ChangeTheme(this, Config.Global.FullTheme); } catch (Exception) { - // Theme is invalid, revert back to standard dark - Config.Global.Theme = "Dark.Blue"; + // Theme is invalid, revert back to our standard dark theme + Config.Global.Colour = "HouseSalus"; + Config.Global.Theme = "Dark"; } journal = new PlayerJournal(Config.Global.JournalLocation); @@ -93,6 +99,41 @@ public partial class MainWindow : MahApps.Metro.Controls.MetroWindow { journallocation.Text = Config.Global.JournalLocation; } + private void AddCustomThemes() { + Dictionary colorThemes = new() { + { "HouseSalus", Color.FromRgb(0xBC, 0x94, 0x39) }, + //{ "HouseSalus", Color.FromRgb(0xED, 0xDA, 0x70) }, + { "NovaNavy", Color.FromRgb(0xA1, 0xA4, 0xDB) }, + }; + + foreach (var colourtheme in colorThemes) { + var brush = new SolidColorBrush(colourtheme.Value); + + // Add light theme + ThemeManager.Current.AddTheme(new Theme( + "Light." + colourtheme.Key, + "Light." + colourtheme.Key, + "Light", + colourtheme.Key, + colourtheme.Value, + brush, + true, + false) + ); + // Add dark theme + ThemeManager.Current.AddTheme(new Theme( + "Dark." + colourtheme.Key, + "Dark." + colourtheme.Key, + "Dark", + colourtheme.Key, + colourtheme.Value, + brush, + true, + false) + ); + } + } + private void InitialiseTime() { DateTime today = DateTime.Today; DateTime tomorrow = today.AddDays(1);