Skip to content

Commit

Permalink
Added the possibility to get details of a color (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Feb 24, 2024
1 parent ecb12da commit c72afc8
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 1 deletion.
18 changes: 18 additions & 0 deletions ColorPicker/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ColorPicker/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -729,4 +729,10 @@
<data name="ScoreAll" xml:space="preserve">
<value>All</value>
</data>
<data name="ForegroundDetails" xml:space="preserve">
<value>Foreground color details</value>
</data>
<data name="BackgroundDetails" xml:space="preserve">
<value>Background color details</value>
</data>
</root>
6 changes: 6 additions & 0 deletions ColorPicker/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -733,4 +733,10 @@
<data name="ScoreAll" xml:space="preserve">
<value>Tout</value>
</data>
<data name="ForegroundDetails" xml:space="preserve">
<value>Détails de la couleur de premier plan</value>
</data>
<data name="BackgroundDetails" xml:space="preserve">
<value>Détails de la couleur d'arrière-plan</value>
</data>
</root>
6 changes: 6 additions & 0 deletions ColorPicker/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -709,4 +709,10 @@
<data name="ScoreAll" xml:space="preserve">
<value>All</value>
</data>
<data name="ForegroundDetails" xml:space="preserve">
<value>Foreground color details</value>
</data>
<data name="BackgroundDetails" xml:space="preserve">
<value>Background color details</value>
</data>
</root>
6 changes: 6 additions & 0 deletions ColorPicker/Properties/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -737,4 +737,10 @@
<data name="ScoreAll" xml:space="preserve">
<value>全部</value>
</data>
<data name="ForegroundDetails" xml:space="preserve">
<value>前景色细节</value>
</data>
<data name="BackgroundDetails" xml:space="preserve">
<value>背景颜色细节</value>
</data>
</root>
22 changes: 21 additions & 1 deletion ColorPicker/UserControls/ColorGridItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lang="clr-namespace:ColorPicker.Properties"
xmlns:local="clr-namespace:ColorPicker.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Width="Auto"
Expand All @@ -13,6 +14,25 @@
Margin="1"
d:Background="White"
CornerRadius="5">
<TextBlock x:Name="RatioTxt" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBlock
x:Name="RatioTxt"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<Border.ContextMenu>
<ContextMenu Style="{DynamicResource ContextMenuStyle}">
<MenuItem
x:Name="ForegroundDetails"
Click="ForegroundDetails_Click"
Foreground="{DynamicResource Foreground1}"
Header="{x:Static lang:Resources.ForegroundDetails}"
Style="{DynamicResource MenuStyle}" />
<MenuItem
x:Name="BackgroundDetails"
Click="BackgroundDetails_Click"
Foreground="{DynamicResource Foreground1}"
Header="{x:Static lang:Resources.BackgroundDetails}"
Style="{DynamicResource MenuStyle}" />
</ContextMenu>
</Border.ContextMenu>
</Border>
</UserControl>
11 changes: 11 additions & 0 deletions ColorPicker/UserControls/ColorGridItem.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ MIT License

using ColorHelper;
using ColorPicker.Classes;
using ColorPicker.Windows;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -73,5 +74,15 @@ private void InitUI(double limit)

RatioTxt.Text = contrast.ToString();
}

private void ForegroundDetails_Click(object sender, RoutedEventArgs e)
{
new ColorDetailsWindow(new SolidColorBrush { Color = Color.FromRgb(ForegroundColor.R, ForegroundColor.G, ForegroundColor.B) }).Show();
}

private void BackgroundDetails_Click(object sender, RoutedEventArgs e)
{
new ColorDetailsWindow(new SolidColorBrush { Color = Color.FromRgb(BackgroundColor.R, BackgroundColor.G, BackgroundColor.B) }).Show();
}
}
}

0 comments on commit c72afc8

Please sign in to comment.