diff --git a/ShareX.HelpersLib/ShareXResources.cs b/ShareX.HelpersLib/ShareXResources.cs index 55a62e8e5..7fd886f08 100644 --- a/ShareX.HelpersLib/ShareXResources.cs +++ b/ShareX.HelpersLib/ShareXResources.cs @@ -43,6 +43,7 @@ public static string UserAgent public static bool UseDarkTheme { get; set; } public static bool UseWhiteIcon { get; set; } + public static bool ApplyTheme { get; set; } = true; public static Icon Icon => UseWhiteIcon ? Resources.ShareX_Icon_White : Resources.ShareX_Icon; @@ -51,16 +52,29 @@ public static string UserAgent public static Color BackgroundColor => UseDarkTheme ? DarkBackgroundColor : SystemColors.Window; public static Color TextColor => UseDarkTheme ? DarkTextColor : SystemColors.ControlText; + public static Color BorderColor => UseDarkTheme ? DarkBorderColor : ProfessionalColors.SeparatorDark; + public static Color CheckerColor1 => UseDarkTheme ? DarkCheckerColor1 : SystemColors.ControlLightLight; + public static Color CheckerColor2 => UseDarkTheme ? DarkCheckerColor2 : SystemColors.ControlLight; public static Color DarkBackgroundColor { get; } = Color.FromArgb(42, 47, 56); public static Color DarkTextColor { get; } = Color.FromArgb(235, 235, 235); public static Color DarkBorderColor { get; } = Color.FromArgb(28, 32, 38); + public static Color DarkCheckerColor1 { get; } = Color.FromArgb(60, 60, 60); + public static Color DarkCheckerColor2 { get; } = Color.FromArgb(50, 50, 50); public static int CheckerSize { get; } = 15; - public static Color CheckerColor1 => UseDarkTheme ? Color.FromArgb(60, 60, 60) : SystemColors.ControlLightLight; - public static Color CheckerColor2 => UseDarkTheme ? Color.FromArgb(50, 50, 50) : SystemColors.ControlLight; - public static void ApplyTheme(Control control) + public static void ApplyThemeToForm(Form form) + { + form.Icon = Icon; + + if (ApplyTheme) + { + ApplyThemeToControl(form); + } + } + + private static void ApplyThemeToControl(Control control) { if (control is Label || control is CheckBox || @@ -85,7 +99,8 @@ public static void ApplyTheme(Control control) control.ForeColor = TextColor; } - if (control is Form || control is TabPage) + if (control is Form || + control is TabPage) { control.BackColor = BackgroundColor; } @@ -98,7 +113,7 @@ public static void ApplyTheme(Control control) foreach (Control child in control.Controls) { - ApplyTheme(child); + ApplyThemeToControl(child); } } } diff --git a/ShareX.HistoryLib/Forms/HistoryForm.cs b/ShareX.HistoryLib/Forms/HistoryForm.cs index cca76d8b3..f5b6f4b25 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.cs +++ b/ShareX.HistoryLib/Forms/HistoryForm.cs @@ -52,7 +52,8 @@ public HistoryForm(string historyPath, HistorySettings settings, Action Settings = settings; InitializeComponent(); - Icon = ShareXResources.Icon; + ShareXResources.ApplyThemeToForm(this); + defaultTitle = Text; UpdateTitle(); @@ -78,8 +79,6 @@ public HistoryForm(string historyPath, HistorySettings settings, Action scMain.SplitterDistance = Settings.SplitterDistance; } - ShareXResources.ApplyTheme(this); - Settings.WindowState.AutoHandleFormState(this); } diff --git a/ShareX/Forms/AboutForm.cs b/ShareX/Forms/AboutForm.cs index ad3cb95bc..12f494108 100644 --- a/ShareX/Forms/AboutForm.cs +++ b/ShareX/Forms/AboutForm.cs @@ -37,7 +37,8 @@ public partial class AboutForm : Form public AboutForm() { InitializeComponent(); - Icon = ShareXResources.Icon; + ShareXResources.ApplyThemeToForm(this); + lblProductName.Text = Program.Title; pbLogo.Image = ShareXResources.Logo; diff --git a/ShareX/Forms/ApplicationSettingsForm.cs b/ShareX/Forms/ApplicationSettingsForm.cs index a69df8b5b..680638f5d 100644 --- a/ShareX/Forms/ApplicationSettingsForm.cs +++ b/ShareX/Forms/ApplicationSettingsForm.cs @@ -42,8 +42,7 @@ public partial class ApplicationSettingsForm : Form public ApplicationSettingsForm() { InitializeControls(); - Icon = ShareXResources.Icon; - ShareXResources.ApplyTheme(this); + ShareXResources.ApplyThemeToForm(this); } private void SettingsForm_Shown(object sender, EventArgs e) diff --git a/ShareX/Forms/HotkeySettingsForm.cs b/ShareX/Forms/HotkeySettingsForm.cs index afbce148c..758787680 100644 --- a/ShareX/Forms/HotkeySettingsForm.cs +++ b/ShareX/Forms/HotkeySettingsForm.cs @@ -42,7 +42,8 @@ public partial class HotkeySettingsForm : Form public HotkeySettingsForm(HotkeyManager hotkeyManager) { InitializeComponent(); - Icon = ShareXResources.Icon; + ShareXResources.ApplyThemeToForm(this); + PrepareHotkeys(hotkeyManager); } diff --git a/ShareX/Forms/TaskSettingsForm.cs b/ShareX/Forms/TaskSettingsForm.cs index 95a1c0de8..552d43896 100644 --- a/ShareX/Forms/TaskSettingsForm.cs +++ b/ShareX/Forms/TaskSettingsForm.cs @@ -48,7 +48,8 @@ public partial class TaskSettingsForm : Form public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false) { InitializeComponent(); - Icon = ShareXResources.Icon; + ShareXResources.ApplyThemeToForm(this); + TaskSettings = hotkeySetting; IsDefault = isDefault;