diff --git a/GitUI/CommandsDialogs/BrowseDialog/DashboardControl/Dashboard.cs b/GitUI/CommandsDialogs/BrowseDialog/DashboardControl/Dashboard.cs index bba2372d53d..d52bac34ef3 100644 --- a/GitUI/CommandsDialogs/BrowseDialog/DashboardControl/Dashboard.cs +++ b/GitUI/CommandsDialogs/BrowseDialog/DashboardControl/Dashboard.cs @@ -23,8 +23,6 @@ public partial class Dashboard : GitModuleControl private readonly TranslationString _openRepository = new("Open repository"); private readonly TranslationString _translate = new("Translate"); - private DashboardTheme _selectedTheme; - public event EventHandler GitModuleChanged; public Dashboard() @@ -63,31 +61,31 @@ protected override CreateParams CreateParams public void RefreshContent() { + DashboardTheme selectedTheme = ColorHelper.IsLightTheme() ? DashboardTheme.Light : DashboardTheme.Dark; InitDashboardLayout(); ApplyTheme(); userRepositoriesList.ShowRecentRepositories(); void ApplyTheme() { - _selectedTheme = ColorHelper.IsLightTheme() ? DashboardTheme.Light : DashboardTheme.Dark; - BackgroundImage = _selectedTheme.BackgroundImage; - - BackColor = _selectedTheme.Primary; - pnlLogo.BackColor = _selectedTheme.PrimaryVeryDark; - flpnlStart.BackColor = _selectedTheme.PrimaryLight; - flpnlContribute.BackColor = _selectedTheme.PrimaryVeryLight; - lblContribute.ForeColor = _selectedTheme.SecondaryHeadingText; - userRepositoriesList.BranchNameColor = _selectedTheme.SecondaryText; - userRepositoriesList.FavouriteColor = _selectedTheme.AccentedText; - userRepositoriesList.ForeColor = _selectedTheme.PrimaryText; - userRepositoriesList.HeaderColor = _selectedTheme.SecondaryHeadingText; - userRepositoriesList.HeaderBackColor = _selectedTheme.PrimaryDark; - userRepositoriesList.HoverColor = _selectedTheme.PrimaryLight; - userRepositoriesList.MainBackColor = _selectedTheme.Primary; + BackgroundImage = selectedTheme.BackgroundImage; + + BackColor = selectedTheme.Primary; + pnlLogo.BackColor = selectedTheme.PrimaryVeryDark; + flpnlStart.BackColor = selectedTheme.PrimaryLight; + flpnlContribute.BackColor = selectedTheme.PrimaryVeryLight; + lblContribute.ForeColor = selectedTheme.SecondaryHeadingText; + userRepositoriesList.BranchNameColor = selectedTheme.SecondaryText; + userRepositoriesList.FavouriteColor = selectedTheme.AccentedText; + userRepositoriesList.ForeColor = selectedTheme.PrimaryText; + userRepositoriesList.HeaderColor = selectedTheme.SecondaryHeadingText; + userRepositoriesList.HeaderBackColor = selectedTheme.PrimaryDark; + userRepositoriesList.HoverColor = selectedTheme.PrimaryLight; + userRepositoriesList.MainBackColor = selectedTheme.Primary; foreach (var item in flpnlContribute.Controls.OfType().Union(flpnlStart.Controls.OfType())) { - item.LinkColor = _selectedTheme.PrimaryText; + item.LinkColor = selectedTheme.PrimaryText; } Invalidate(true); @@ -177,8 +175,8 @@ Control CreateLink(Control container, string text, Image icon, EventHandler hand Text = text, TextAlign = ContentAlignment.MiddleLeft }; - linkLabel.MouseHover += (s, e) => linkLabel.LinkColor = _selectedTheme.AccentedText; - linkLabel.MouseLeave += (s, e) => linkLabel.LinkColor = _selectedTheme.PrimaryText; + linkLabel.MouseHover += (s, e) => linkLabel.LinkColor = selectedTheme.AccentedText; + linkLabel.MouseLeave += (s, e) => linkLabel.LinkColor = selectedTheme.PrimaryText; if (handler is not null) {