Skip to content

Commit

Permalink
Added DEC section to color details (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Mar 17, 2024
1 parent d8e5bb6 commit 46b27bd
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
50 changes: 48 additions & 2 deletions ColorPicker/Windows/ColorDetailsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{x:Static lang:Resources.Details}"
Width="450"
Height="520"
Height="575"
MinWidth="450"
MinHeight="520"
MinHeight="575"
AllowsTransparency="True"
Background="Transparent"
FontFamily="/Fonts/#Hauora"
Expand Down Expand Up @@ -406,6 +406,52 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<TextBlock FontWeight="ExtraBold" Text="{x:Static lang:Resources.DEC}" />
<Button
x:Name="CopyDecBtn"
Grid.Row="1"
Grid.Column="2"
Margin="0 3 3 3"
Padding="5"
VerticalAlignment="Top"
Background="{DynamicResource Background3}"
Click="CopyDecBtn_Click"
Content="&#xF32C;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Style="{DynamicResource DefaultButton}">
<Button.ToolTip>
<ToolTip
Background="{DynamicResource Background1}"
Content="{x:Static lang:Resources.CopyDEC}"
Foreground="{DynamicResource Foreground1}" />
</Button.ToolTip>
</Button>

<TextBlock
x:Name="DecTxt"
Grid.Row="1"
VerticalAlignment="Center"
FontSize="18"
FontWeight="ExtraBold"
Text="N/A" />
</Grid>
</Border>
<Border
Padding="5"
CornerRadius="10"
MouseEnter="Border_MouseEnter"
MouseLeave="Border_MouseLeave">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<TextBlock FontWeight="ExtraBold" Text="{x:Static lang:Resources.XYZ}" />
<Button
x:Name="CopyXyzBtn"
Expand Down
8 changes: 8 additions & 0 deletions ColorPicker/Windows/ColorDetailsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private void InitUI()
CopyHsvBtn.Background = bgBtn;
CopyHslBtn.Background = bgBtn;
CopyCmykBtn.Background = bgBtn;
CopyDecBtn.Background = bgBtn;
CopyXyzBtn.Background = bgBtn;
CopyYiqBtn.Background = bgBtn;
CopyYuvBtn.Background = bgBtn;
Expand All @@ -69,6 +70,7 @@ private void InitUI()
CopyHsvBtn.Foreground = BackgroundSolidBrush;
CopyHslBtn.Foreground = BackgroundSolidBrush;
CopyCmykBtn.Foreground = BackgroundSolidBrush;
CopyDecBtn.Foreground = BackgroundSolidBrush;
CopyXyzBtn.Foreground = BackgroundSolidBrush;
CopyYiqBtn.Foreground = BackgroundSolidBrush;
CopyYuvBtn.Foreground = BackgroundSolidBrush;
Expand All @@ -79,6 +81,7 @@ private void InitUI()
HsvTxt.Text = $"{ColorInfo.HSV.H}, {ColorInfo.HSV.S}, {ColorInfo.HSV.V}";
HslTxt.Text = $"{ColorInfo.HSL.H}, {ColorInfo.HSL.S}, {ColorInfo.HSL.L}";
CmykTxt.Text = $"{ColorInfo.CMYK.C}, {ColorInfo.CMYK.M}, {ColorInfo.CMYK.Y}, {ColorInfo.CMYK.K}";
DecTxt.Text = $"{ColorInfo.DEC.Value}";
XyzTxt.Text = $"{ColorInfo.XYZ.X}; {ColorInfo.XYZ.Y}; {ColorInfo.XYZ.Z}";
YiqTxt.Text = $"{ColorInfo.YIQ.Y}; {ColorInfo.YIQ.I}; {ColorInfo.YIQ.Q}";
YuvTxt.Text = $"{ColorInfo.YUV.Y}; {ColorInfo.YUV.U}; {ColorInfo.YUV.V}";
Expand Down Expand Up @@ -167,4 +170,9 @@ private void Border_MouseLeave(object sender, System.Windows.Input.MouseEventArg
{
((Border)sender).Background = null;
}

private void CopyDecBtn_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(DecTxt.Text);
}
}

0 comments on commit 46b27bd

Please sign in to comment.