diff --git a/CHANGELIST.md b/CHANGELIST.md index 2b439896..c152aab5 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -13,6 +13,7 @@ - Update README with new build matricies - Remove empty gitmodules - Purple +- Separate themes into own namespace and files ### 3.2.0 (2024-06-20) diff --git a/MPF.UI/Theme.cs b/MPF.UI/Theme.cs index 2dbcfe6a..8dd4cc2b 100644 --- a/MPF.UI/Theme.cs +++ b/MPF.UI/Theme.cs @@ -254,209 +254,4 @@ namespace MPF.UI Application.Current.Resources["TextBox.Static.Background"] = this.TextBox_Static_Background; } } - - /// - /// Default light-mode theme - /// - public class LightModeTheme : Theme - { - public LightModeTheme() - { - // Handle application-wide resources - this.ActiveBorderBrush = null; - this.ControlBrush = null; - this.ControlTextBrush = null; - this.GrayTextBrush = null; - this.WindowBrush = null; - this.WindowTextBrush = null; - - // Handle Button-specific resources - this.Button_Disabled_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0xF4, 0xF4)); - this.Button_MouseOver_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xBE, 0xE6, 0xFD)); - this.Button_Pressed_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xC4, 0xE5, 0xF6)); - this.Button_Static_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xDD, 0xDD, 0xDD)); - - // Handle ComboBox-specific resources - this.ComboBox_Disabled_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0)); - this.ComboBox_Disabled_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); - this.ComboBox_Disabled_Editable_Button_Background = Brushes.Transparent; - this.ComboBox_MouseOver_Background = new LinearGradientBrush( - Color.FromArgb(0xFF, 0xEC, 0xF4, 0xFC), - Color.FromArgb(0xFF, 0xDC, 0xEC, 0xFC), - new Point(0, 0), - new Point(0, 1)); - this.ComboBox_MouseOver_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); - this.ComboBox_MouseOver_Editable_Button_Background = new LinearGradientBrush( - Color.FromArgb(0xFF, 0xEB, 0xF4, 0xFC), - Color.FromArgb(0xFF, 0xDC, 0xEC, 0xFC), - new Point(0, 0), - new Point(0, 1)); - this.ComboBox_Pressed_Background = new LinearGradientBrush( - Color.FromArgb(0xFF, 0xDA, 0xEC, 0xFC), - Color.FromArgb(0xFF, 0xC4, 0xE0, 0xFC), - new Point(0, 0), - new Point(0, 1)); - this.ComboBox_Pressed_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); - this.ComboBox_Pressed_Editable_Button_Background = new LinearGradientBrush( - Color.FromArgb(0xFF, 0xDA, 0xEB, 0xFC), - Color.FromArgb(0xFF, 0xC4, 0xE0, 0xFC), - new Point(0, 0), - new Point(0, 1)); - this.ComboBox_Static_Background = new LinearGradientBrush( - Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0), - Color.FromArgb(0xFF, 0xE5, 0xE5, 0xE5), - new Point(0, 0), - new Point(0, 1)); - this.ComboBox_Static_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); - this.ComboBox_Static_Editable_Button_Background = Brushes.Transparent; - - // Handle CustomMessageBox-specific resources - this.CustomMessageBox_Static_Background = null; - - // Handle MenuItem-specific resources - this.MenuItem_SubMenu_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0)); - this.MenuItem_SubMenu_Border = Brushes.DarkGray; - - // Handle ProgressBar-specific resources - this.ProgressBar_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6)); - - // Handle ScrollViewer-specific resources - this.ScrollViewer_ScrollBar_Background = Brushes.LightGray; - - // Handle TabItem-specific resources - this.TabItem_Selected_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); - this.TabItem_Static_Background = new LinearGradientBrush( - Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0), - Color.FromArgb(0xFF, 0xE5, 0xE5, 0xE5), - new Point(0, 0), - new Point(0, 1)); - this.TabItem_Static_Border = Brushes.DarkGray; - - // Handle TextBox-specific resources - this.TextBox_Static_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); - } - } - - /// - /// Default dark-mode theme - /// - public class DarkModeTheme : Theme - { - public DarkModeTheme() - { - // Setup needed brushes - var darkModeBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, 0x20, 0x20, 0x20) }; - - // Handle application-wide resources - this.ActiveBorderBrush = Brushes.Black; - this.ControlBrush = darkModeBrush; - this.ControlTextBrush = Brushes.White; - this.GrayTextBrush = Brushes.DarkGray; - this.WindowBrush = darkModeBrush; - this.WindowTextBrush = Brushes.White; - - // Handle Button-specific resources - this.Button_Disabled_Background = darkModeBrush; - this.Button_MouseOver_Background = darkModeBrush; - this.Button_Pressed_Background = darkModeBrush; - this.Button_Static_Background = darkModeBrush; - - // Handle ComboBox-specific resources - this.ComboBox_Disabled_Background = darkModeBrush; - this.ComboBox_Disabled_Editable_Background = darkModeBrush; - this.ComboBox_Disabled_Editable_Button_Background = darkModeBrush; - this.ComboBox_MouseOver_Background = darkModeBrush; - this.ComboBox_MouseOver_Editable_Background = darkModeBrush; - this.ComboBox_MouseOver_Editable_Button_Background = darkModeBrush; - this.ComboBox_Pressed_Background = darkModeBrush; - this.ComboBox_Pressed_Editable_Background = darkModeBrush; - this.ComboBox_Pressed_Editable_Button_Background = darkModeBrush; - this.ComboBox_Static_Background = darkModeBrush; - this.ComboBox_Static_Editable_Background = darkModeBrush; - this.ComboBox_Static_Editable_Button_Background = darkModeBrush; - - // Handle CustomMessageBox-specific resources - this.CustomMessageBox_Static_Background = darkModeBrush; - - // Handle MenuItem-specific resources - this.MenuItem_SubMenu_Background = darkModeBrush; - this.MenuItem_SubMenu_Border = Brushes.DarkGray; - - // Handle ProgressBar-specific resources - this.ProgressBar_Background = darkModeBrush; - - // Handle ScrollViewer-specific resources - this.ScrollViewer_ScrollBar_Background = darkModeBrush; - - // Handle TabItem-specific resources - this.TabItem_Selected_Background = darkModeBrush; - this.TabItem_Static_Background = darkModeBrush; - this.TabItem_Static_Border = Brushes.DarkGray; - - // Handle TextBox-specific resources - this.TextBox_Static_Background = darkModeBrush; - } - } - - /// - /// Default purple-mode theme - /// - public class PurpModeTheme : Theme - { - public PurpModeTheme() - { - // Setup needed brushes - var darkPurpBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, 0x11, 0x11, 0x11) }; - var lightPurpBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, 0x9a, 0x5e, 0xc0) }; - - // Handle application-wide resources - this.ActiveBorderBrush = lightPurpBrush; - this.ControlBrush = darkPurpBrush; - this.ControlTextBrush = lightPurpBrush; - this.GrayTextBrush = lightPurpBrush; - this.WindowBrush = darkPurpBrush; - this.WindowTextBrush = lightPurpBrush; - - // Handle Button-specific resources - this.Button_Disabled_Background = darkPurpBrush; - this.Button_MouseOver_Background = darkPurpBrush; - this.Button_Pressed_Background = darkPurpBrush; - this.Button_Static_Background = darkPurpBrush; - - // Handle ComboBox-specific resources - this.ComboBox_Disabled_Background = darkPurpBrush; - this.ComboBox_Disabled_Editable_Background = darkPurpBrush; - this.ComboBox_Disabled_Editable_Button_Background = darkPurpBrush; - this.ComboBox_MouseOver_Background = darkPurpBrush; - this.ComboBox_MouseOver_Editable_Background = darkPurpBrush; - this.ComboBox_MouseOver_Editable_Button_Background = darkPurpBrush; - this.ComboBox_Pressed_Background = darkPurpBrush; - this.ComboBox_Pressed_Editable_Background = darkPurpBrush; - this.ComboBox_Pressed_Editable_Button_Background = darkPurpBrush; - this.ComboBox_Static_Background = darkPurpBrush; - this.ComboBox_Static_Editable_Background = darkPurpBrush; - this.ComboBox_Static_Editable_Button_Background = darkPurpBrush; - - // Handle CustomMessageBox-specific resources - this.CustomMessageBox_Static_Background = darkPurpBrush; - - // Handle MenuItem-specific resources - this.MenuItem_SubMenu_Background = darkPurpBrush; - this.MenuItem_SubMenu_Border = Brushes.DarkGray; - - // Handle ProgressBar-specific resources - this.ProgressBar_Background = darkPurpBrush; - - // Handle ScrollViewer-specific resources - this.ScrollViewer_ScrollBar_Background = darkPurpBrush; - - // Handle TabItem-specific resources - this.TabItem_Selected_Background = darkPurpBrush; - this.TabItem_Static_Background = darkPurpBrush; - this.TabItem_Static_Border = Brushes.DarkGray; - - // Handle TextBox-specific resources - this.TextBox_Static_Background = darkPurpBrush; - } - } } diff --git a/MPF.UI/Themes/DarkModeTheme.cs b/MPF.UI/Themes/DarkModeTheme.cs new file mode 100644 index 00000000..c8a62516 --- /dev/null +++ b/MPF.UI/Themes/DarkModeTheme.cs @@ -0,0 +1,65 @@ +using System.Windows.Media; + +namespace MPF.UI.Themes +{ + /// + /// Default dark-mode theme + /// + public class DarkModeTheme : Theme + { + public DarkModeTheme() + { + // Setup needed brushes + var darkModeBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, 0x20, 0x20, 0x20) }; + + // Handle application-wide resources + this.ActiveBorderBrush = Brushes.Black; + this.ControlBrush = darkModeBrush; + this.ControlTextBrush = Brushes.White; + this.GrayTextBrush = Brushes.DarkGray; + this.WindowBrush = darkModeBrush; + this.WindowTextBrush = Brushes.White; + + // Handle Button-specific resources + this.Button_Disabled_Background = darkModeBrush; + this.Button_MouseOver_Background = darkModeBrush; + this.Button_Pressed_Background = darkModeBrush; + this.Button_Static_Background = darkModeBrush; + + // Handle ComboBox-specific resources + this.ComboBox_Disabled_Background = darkModeBrush; + this.ComboBox_Disabled_Editable_Background = darkModeBrush; + this.ComboBox_Disabled_Editable_Button_Background = darkModeBrush; + this.ComboBox_MouseOver_Background = darkModeBrush; + this.ComboBox_MouseOver_Editable_Background = darkModeBrush; + this.ComboBox_MouseOver_Editable_Button_Background = darkModeBrush; + this.ComboBox_Pressed_Background = darkModeBrush; + this.ComboBox_Pressed_Editable_Background = darkModeBrush; + this.ComboBox_Pressed_Editable_Button_Background = darkModeBrush; + this.ComboBox_Static_Background = darkModeBrush; + this.ComboBox_Static_Editable_Background = darkModeBrush; + this.ComboBox_Static_Editable_Button_Background = darkModeBrush; + + // Handle CustomMessageBox-specific resources + this.CustomMessageBox_Static_Background = darkModeBrush; + + // Handle MenuItem-specific resources + this.MenuItem_SubMenu_Background = darkModeBrush; + this.MenuItem_SubMenu_Border = Brushes.DarkGray; + + // Handle ProgressBar-specific resources + this.ProgressBar_Background = darkModeBrush; + + // Handle ScrollViewer-specific resources + this.ScrollViewer_ScrollBar_Background = darkModeBrush; + + // Handle TabItem-specific resources + this.TabItem_Selected_Background = darkModeBrush; + this.TabItem_Static_Background = darkModeBrush; + this.TabItem_Static_Border = Brushes.DarkGray; + + // Handle TextBox-specific resources + this.TextBox_Static_Background = darkModeBrush; + } + } +} diff --git a/MPF.UI/Themes/LightModeTheme.cs b/MPF.UI/Themes/LightModeTheme.cs new file mode 100644 index 00000000..b53c953c --- /dev/null +++ b/MPF.UI/Themes/LightModeTheme.cs @@ -0,0 +1,87 @@ +using System.Windows; +using System.Windows.Media; + +namespace MPF.UI.Themes +{ + /// + /// Default light-mode theme + /// + public class LightModeTheme : Theme + { + public LightModeTheme() + { + // Handle application-wide resources + this.ActiveBorderBrush = null; + this.ControlBrush = null; + this.ControlTextBrush = null; + this.GrayTextBrush = null; + this.WindowBrush = null; + this.WindowTextBrush = null; + + // Handle Button-specific resources + this.Button_Disabled_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0xF4, 0xF4)); + this.Button_MouseOver_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xBE, 0xE6, 0xFD)); + this.Button_Pressed_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xC4, 0xE5, 0xF6)); + this.Button_Static_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xDD, 0xDD, 0xDD)); + + // Handle ComboBox-specific resources + this.ComboBox_Disabled_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0)); + this.ComboBox_Disabled_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); + this.ComboBox_Disabled_Editable_Button_Background = Brushes.Transparent; + this.ComboBox_MouseOver_Background = new LinearGradientBrush( + Color.FromArgb(0xFF, 0xEC, 0xF4, 0xFC), + Color.FromArgb(0xFF, 0xDC, 0xEC, 0xFC), + new Point(0, 0), + new Point(0, 1)); + this.ComboBox_MouseOver_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); + this.ComboBox_MouseOver_Editable_Button_Background = new LinearGradientBrush( + Color.FromArgb(0xFF, 0xEB, 0xF4, 0xFC), + Color.FromArgb(0xFF, 0xDC, 0xEC, 0xFC), + new Point(0, 0), + new Point(0, 1)); + this.ComboBox_Pressed_Background = new LinearGradientBrush( + Color.FromArgb(0xFF, 0xDA, 0xEC, 0xFC), + Color.FromArgb(0xFF, 0xC4, 0xE0, 0xFC), + new Point(0, 0), + new Point(0, 1)); + this.ComboBox_Pressed_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); + this.ComboBox_Pressed_Editable_Button_Background = new LinearGradientBrush( + Color.FromArgb(0xFF, 0xDA, 0xEB, 0xFC), + Color.FromArgb(0xFF, 0xC4, 0xE0, 0xFC), + new Point(0, 0), + new Point(0, 1)); + this.ComboBox_Static_Background = new LinearGradientBrush( + Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0), + Color.FromArgb(0xFF, 0xE5, 0xE5, 0xE5), + new Point(0, 0), + new Point(0, 1)); + this.ComboBox_Static_Editable_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); + this.ComboBox_Static_Editable_Button_Background = Brushes.Transparent; + + // Handle CustomMessageBox-specific resources + this.CustomMessageBox_Static_Background = null; + + // Handle MenuItem-specific resources + this.MenuItem_SubMenu_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0)); + this.MenuItem_SubMenu_Border = Brushes.DarkGray; + + // Handle ProgressBar-specific resources + this.ProgressBar_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6)); + + // Handle ScrollViewer-specific resources + this.ScrollViewer_ScrollBar_Background = Brushes.LightGray; + + // Handle TabItem-specific resources + this.TabItem_Selected_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); + this.TabItem_Static_Background = new LinearGradientBrush( + Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0), + Color.FromArgb(0xFF, 0xE5, 0xE5, 0xE5), + new Point(0, 0), + new Point(0, 1)); + this.TabItem_Static_Border = Brushes.DarkGray; + + // Handle TextBox-specific resources + this.TextBox_Static_Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); + } + } +} diff --git a/MPF.UI/Themes/PurpModeTheme.cs b/MPF.UI/Themes/PurpModeTheme.cs new file mode 100644 index 00000000..771080d2 --- /dev/null +++ b/MPF.UI/Themes/PurpModeTheme.cs @@ -0,0 +1,66 @@ +using System.Windows.Media; + +namespace MPF.UI.Themes +{ + /// + /// Default purple-mode theme + /// + public class PurpModeTheme : Theme + { + public PurpModeTheme() + { + // Setup needed brushes + var darkPurpBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, 0x11, 0x11, 0x11) }; + var lightPurpBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, 0x9a, 0x5e, 0xc0) }; + + // Handle application-wide resources + this.ActiveBorderBrush = lightPurpBrush; + this.ControlBrush = darkPurpBrush; + this.ControlTextBrush = lightPurpBrush; + this.GrayTextBrush = lightPurpBrush; + this.WindowBrush = darkPurpBrush; + this.WindowTextBrush = lightPurpBrush; + + // Handle Button-specific resources + this.Button_Disabled_Background = darkPurpBrush; + this.Button_MouseOver_Background = darkPurpBrush; + this.Button_Pressed_Background = darkPurpBrush; + this.Button_Static_Background = darkPurpBrush; + + // Handle ComboBox-specific resources + this.ComboBox_Disabled_Background = darkPurpBrush; + this.ComboBox_Disabled_Editable_Background = darkPurpBrush; + this.ComboBox_Disabled_Editable_Button_Background = darkPurpBrush; + this.ComboBox_MouseOver_Background = darkPurpBrush; + this.ComboBox_MouseOver_Editable_Background = darkPurpBrush; + this.ComboBox_MouseOver_Editable_Button_Background = darkPurpBrush; + this.ComboBox_Pressed_Background = darkPurpBrush; + this.ComboBox_Pressed_Editable_Background = darkPurpBrush; + this.ComboBox_Pressed_Editable_Button_Background = darkPurpBrush; + this.ComboBox_Static_Background = darkPurpBrush; + this.ComboBox_Static_Editable_Background = darkPurpBrush; + this.ComboBox_Static_Editable_Button_Background = darkPurpBrush; + + // Handle CustomMessageBox-specific resources + this.CustomMessageBox_Static_Background = darkPurpBrush; + + // Handle MenuItem-specific resources + this.MenuItem_SubMenu_Background = darkPurpBrush; + this.MenuItem_SubMenu_Border = Brushes.DarkGray; + + // Handle ProgressBar-specific resources + this.ProgressBar_Background = darkPurpBrush; + + // Handle ScrollViewer-specific resources + this.ScrollViewer_ScrollBar_Background = darkPurpBrush; + + // Handle TabItem-specific resources + this.TabItem_Selected_Background = darkPurpBrush; + this.TabItem_Static_Background = darkPurpBrush; + this.TabItem_Static_Border = Brushes.DarkGray; + + // Handle TextBox-specific resources + this.TextBox_Static_Background = darkPurpBrush; + } + } +} diff --git a/MPF.UI/Windows/MainWindow.xaml.cs b/MPF.UI/Windows/MainWindow.xaml.cs index 3b66cd79..2300d123 100644 --- a/MPF.UI/Windows/MainWindow.xaml.cs +++ b/MPF.UI/Windows/MainWindow.xaml.cs @@ -3,6 +3,7 @@ using System.IO; using System.Windows; using System.Windows.Controls; using MPF.Frontend.ViewModels; +using MPF.UI.Themes; using MPF.UI.UserControls; using SabreTools.RedumpLib; using SabreTools.RedumpLib.Data;