Skip to content

Commit

Permalink
Merge pull request #8860 from gerhardol/feature/dashboard-link-theme
Browse files Browse the repository at this point in the history
Link style was not applied to the dashboard
  • Loading branch information
gerhardol committed Feb 17, 2021
2 parents 26361af + 1b93f87 commit 424ccf2
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions GitUI/CommandsDialogs/BrowseDialog/DashboardControl/Dashboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<GitModuleEventArgs> GitModuleChanged;

public Dashboard()
Expand Down Expand Up @@ -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<LinkLabel>().Union(flpnlStart.Controls.OfType<LinkLabel>()))
{
item.LinkColor = _selectedTheme.PrimaryText;
item.LinkColor = selectedTheme.PrimaryText;
}

Invalidate(true);
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 424ccf2

Please sign in to comment.