Skip to content

Commit

Permalink
Added Decimal color type in Chromatic wheel page (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Sep 2, 2023
1 parent 5c3a37e commit 44761f4
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
55 changes: 55 additions & 0 deletions ColorPicker/Pages/ChromaticWheelPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,62 @@
</StackPanel>
</Grid>
</Border>
<Border
MinWidth="150"
Margin="5"
Padding="5"
HorizontalAlignment="Left"
Background="{Binding Source={StaticResource CardBackground}}"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Direction="135"
Opacity="0.2"
ShadowDepth="0"
Color="#000" />
</Border.Effect>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>

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

<TextBlock
x:Name="DecTxt"
VerticalAlignment="Center"
FontSize="18"
FontWeight="ExtraBold"
Text="N/A" />
</StackPanel>
</Grid>
</Border>
<Border
MinWidth="150"
Margin="5"
Expand Down
6 changes: 6 additions & 0 deletions ColorPicker/Pages/ChromaticWheelPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private void LoadDetails(ColorInfo colorInfo)
XyzTxt.Text = $"{colorInfo.XYZ.X:0.00}..; {colorInfo.XYZ.Y:0.00}..; {colorInfo.XYZ.Z:0.00}..";
YiqTxt.Text = $"{colorInfo.YIQ.Y:0.00}..; {colorInfo.YIQ.I:0.00}..; {colorInfo.YIQ.Q:0.00}..";
YuvTxt.Text = $"{colorInfo.YUV.Y:0.00}..; {colorInfo.YUV.U:0.00}..; {colorInfo.YUV.V:0.00}..";
DecTxt.Text = colorInfo.DEC.Value.ToString();
}
ColorInfo ColorInfo { get; set; } = new(new(0, 0, 0));
private void UnCheckAllButtons()
Expand Down Expand Up @@ -173,4 +174,9 @@ private void PreviewBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs
Global.PalettePage.InitFromColor(ColorInfo);
GoClick?.Invoke(this, new(AppPages.ColorPalette));
}

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

0 comments on commit 44761f4

Please sign in to comment.