Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link style was not applied to the dashboard #8860

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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