Skip to content

Commit

Permalink
Added the possibility to highlight selected color in Grid (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Mar 17, 2024
1 parent 46b27bd commit 80d47cf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
1 change: 0 additions & 1 deletion ColorPicker/Pages/ContrastPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@
Style="{DynamicResource DefaultToggleButton}" />
</StackPanel>
<Grid x:Name="ContrastGrid" Grid.Row="3">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="60" />
<ColumnDefinition Width="60" />
Expand Down
28 changes: 27 additions & 1 deletion ColorPicker/Pages/ContrastPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,33 @@ internal void InitGrid(double limit)
}
}


Border ColBorder = new()
{
Name = "ColBorder",
BorderBrush = Global.GetColorFromResource("AccentColor"),
BorderThickness = new Thickness(2),
CornerRadius = new CornerRadius(5)
};

Border RowBorder = new()
{
Name = "RowBorder",
BorderBrush = Global.GetColorFromResource("AccentColor"),
BorderThickness = new Thickness(2),
CornerRadius = new CornerRadius(5)
};

Grid.SetColumn(ColBorder, 11-lumValues.IndexOf(ColorInfo.HSL.L) );
Grid.SetRow(RowBorder, 11-lumValues.IndexOf(ColorInfo.HSL.L));
Grid.SetRowSpan(ColBorder, 12);
Grid.SetColumnSpan(RowBorder, 12);
Panel.SetZIndex(ColBorder, 10);
Panel.SetZIndex(RowBorder, 10);

ContrastGrid.Children.Add(ColBorder);
ContrastGrid.Children.Add(RowBorder);

// Load the bookmark icon
if (!Global.Bookmarks.ColorBookmarks.Contains($"#{ColorInfo.HEX.Value}"))
{
Expand All @@ -417,7 +444,6 @@ internal void InitGrid(double limit)
}
BookmarkBtn.Content = "\uF1F8";
BookmarkToolTip.Content = Properties.Resources.RemoveBookmark;

}

private void ScoreAllToggle_Checked(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 80d47cf

Please sign in to comment.