diff --git a/ShareX.HelpersLib/ShareXResources.cs b/ShareX.HelpersLib/ShareXResources.cs index ceef13c4c..08147ce66 100644 --- a/ShareX.HelpersLib/ShareXResources.cs +++ b/ShareX.HelpersLib/ShareXResources.cs @@ -49,6 +49,9 @@ public static string UserAgent public static Image Logo => Resources.ShareX_Logo; public static Image LogoBlack => Resources.ShareX_Logo_Black; + public static Color BackgroundColor => UseDarkTheme ? DarkBackgroundColor : SystemColors.Window; + public static Color TextColor => UseDarkTheme ? DarkTextColor : SystemColors.ControlText; + 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); @@ -56,5 +59,40 @@ public static string UserAgent 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 parent) + { + foreach (Control control in parent.Controls) + { + if (control is Label || control is CheckBox || control is RichTextBox) + { + control.ForeColor = TextColor; + control.BackColor = BackgroundColor; + } + + if (control is Button) + { + control.ForeColor = SystemColors.ControlText; + } + + if (control is GroupBox) + { + control.ForeColor = TextColor; + } + + if (control is Form) + { + control.BackColor = BackgroundColor; + } + + if (control is SplitContainer sc) + { + sc.Panel1.BackColor = BackgroundColor; + sc.Panel2.BackColor = BackgroundColor; + } + + ApplyTheme(control); + } + } } } \ No newline at end of file diff --git a/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs b/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs index 08adb1cea..f86c4988d 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs +++ b/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs @@ -31,13 +31,13 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HistoryForm)); this.scMain = new ShareX.HelpersLib.SplitContainerCustomSplitter(); + this.pStats = new System.Windows.Forms.Panel(); this.rtbStats = new System.Windows.Forms.RichTextBox(); this.lvHistory = new ShareX.HelpersLib.MyListView(); this.chIcon = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chDateTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chFilename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chURL = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.panel1 = new System.Windows.Forms.Panel(); this.btnShowStats = new System.Windows.Forms.Button(); this.pbThumbnail = new ShareX.HelpersLib.MyPictureBox(); this.gbFilters = new System.Windows.Forms.GroupBox(); @@ -56,14 +56,12 @@ private void InitializeComponent() this.cbDateFilter = new System.Windows.Forms.CheckBox(); this.dtpFilterTo = new System.Windows.Forms.DateTimePicker(); this.txtFilenameFilter = new System.Windows.Forms.TextBox(); - this.pStats = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit(); this.scMain.Panel1.SuspendLayout(); this.scMain.Panel2.SuspendLayout(); this.scMain.SuspendLayout(); - this.panel1.SuspendLayout(); - this.gbFilters.SuspendLayout(); this.pStats.SuspendLayout(); + this.gbFilters.SuspendLayout(); this.SuspendLayout(); // // scMain @@ -79,11 +77,19 @@ private void InitializeComponent() // // scMain.Panel2 // - this.scMain.Panel2.Controls.Add(this.panel1); + this.scMain.Panel2.Controls.Add(this.btnShowStats); + this.scMain.Panel2.Controls.Add(this.pbThumbnail); + this.scMain.Panel2.Controls.Add(this.gbFilters); this.scMain.SplitterColor = System.Drawing.Color.White; this.scMain.SplitterLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189))))); this.scMain.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.scMain_SplitterMoved); // + // pStats + // + this.pStats.Controls.Add(this.rtbStats); + resources.ApplyResources(this.pStats, "pStats"); + this.pStats.Name = "pStats"; + // // rtbStats // this.rtbStats.BorderStyle = System.Windows.Forms.BorderStyle.None; @@ -128,14 +134,6 @@ private void InitializeComponent() // resources.ApplyResources(this.chURL, "chURL"); // - // panel1 - // - this.panel1.Controls.Add(this.btnShowStats); - this.panel1.Controls.Add(this.pbThumbnail); - this.panel1.Controls.Add(this.gbFilters); - resources.ApplyResources(this.panel1, "panel1"); - this.panel1.Name = "panel1"; - // // btnShowStats // resources.ApplyResources(this.btnShowStats, "btnShowStats"); @@ -260,12 +258,6 @@ private void InitializeComponent() resources.ApplyResources(this.txtFilenameFilter, "txtFilenameFilter"); this.txtFilenameFilter.Name = "txtFilenameFilter"; // - // pStats - // - this.pStats.Controls.Add(this.rtbStats); - resources.ApplyResources(this.pStats, "pStats"); - this.pStats.Name = "pStats"; - // // HistoryForm // resources.ApplyResources(this, "$this"); @@ -281,10 +273,9 @@ private void InitializeComponent() this.scMain.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit(); this.scMain.ResumeLayout(false); - this.panel1.ResumeLayout(false); + this.pStats.ResumeLayout(false); this.gbFilters.ResumeLayout(false); this.gbFilters.PerformLayout(); - this.pStats.ResumeLayout(false); this.ResumeLayout(false); } @@ -297,7 +288,6 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader chURL; private System.Windows.Forms.ColumnHeader chIcon; private ShareX.HelpersLib.SplitContainerCustomSplitter scMain; - private System.Windows.Forms.Panel panel1; private HelpersLib.MyPictureBox pbThumbnail; private System.Windows.Forms.GroupBox gbFilters; private System.Windows.Forms.ComboBox cbHostFilterSelection; diff --git a/ShareX.HistoryLib/Forms/HistoryForm.cs b/ShareX.HistoryLib/Forms/HistoryForm.cs index ce5175959..0e7995365 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.cs +++ b/ShareX.HistoryLib/Forms/HistoryForm.cs @@ -78,9 +78,16 @@ public HistoryForm(string historyPath, HistorySettings settings, Action scMain.SplitterDistance = Settings.SplitterDistance; } + UpdateTheme(); + Settings.WindowState.AutoHandleFormState(this); } + public void UpdateTheme() + { + ShareXResources.ApplyTheme(this); + } + private void RefreshHistoryItems() { allHistoryItems = GetHistoryItems(); diff --git a/ShareX.HistoryLib/Forms/HistoryForm.resx b/ShareX.HistoryLib/Forms/HistoryForm.resx index ee00812d9..3dffb31b4 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.resx +++ b/ShareX.HistoryLib/Forms/HistoryForm.resx @@ -252,6 +252,9 @@ Bottom, Left + + NoControl + 8, 608 @@ -271,7 +274,7 @@ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - panel1 + scMain.Panel2 0 @@ -295,7 +298,7 @@ ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null - panel1 + scMain.Panel2 1 @@ -306,6 +309,9 @@ True + + NoControl + 13, 48 @@ -354,6 +360,9 @@ True + + NoControl + 13, 24 @@ -706,35 +715,11 @@ System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - panel1 + scMain.Panel2 2 - - Fill - - - 0, 0 - - - 425, 641 - - - 0 - - - panel1 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - scMain.Panel2 - - - 0 - scMain.Panel2