Skip to content

Commit

Permalink
Added the possibility to set the number of analogous colors to genera…
Browse files Browse the repository at this point in the history
…te (#363)
  • Loading branch information
lpeyr committed Jan 14, 2024
1 parent 5947fb1 commit 63a6519
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 31 deletions.
93 changes: 63 additions & 30 deletions ColorPicker/Pages/HarmoniesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -552,36 +552,69 @@
ShadowDepth="0"
Color="{DynamicResource Accent}" />
</Border.Effect>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0 0 10 0"
VerticalAlignment="Center"
Text="{x:Static lang:Resources.Angle}" />
<Border
Width="50"
HorizontalAlignment="Center"
Background="{DynamicResource CardBackground}"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{DynamicResource Accent}" />
</Border.Effect>
<TextBox
x:Name="AngleTxt"
Margin="3"
Padding="3"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{DynamicResource DarkGray}"
PreviewTextInput="AngleTxt_PreviewTextInput"
Text="15"
TextAlignment="Center"
TextChanged="AngleTxt_TextChanged" />
</Border>
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0 0 10 0"
VerticalAlignment="Center"
Text="{x:Static lang:Resources.Angle}" />
<Border
Width="50"
HorizontalAlignment="Center"
Background="{DynamicResource CardBackground}"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{DynamicResource Accent}" />
</Border.Effect>
<TextBox
x:Name="AngleTxt"
Margin="3"
Padding="3"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{DynamicResource DarkGray}"
PreviewTextInput="AngleTxt_PreviewTextInput"
Text="15"
TextAlignment="Center"
TextChanged="AngleTxt_TextChanged" />
</Border>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0 0 10 0"
VerticalAlignment="Center"
Text="{x:Static lang:Resources.AmountToGenerate}" />
<Border
Width="50"
HorizontalAlignment="Center"
Background="{DynamicResource CardBackground}"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{DynamicResource Accent}" />
</Border.Effect>
<TextBox
x:Name="AmountTxt"
Margin="3"
Padding="3"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{DynamicResource DarkGray}"
PreviewTextInput="AngleTxt_PreviewTextInput"
Text="6"
TextAlignment="Center"
TextChanged="AngleTxt_TextChanged" />
</Border>
</StackPanel>
</StackPanel>
</Border>
</Popup>
Expand Down
2 changes: 1 addition & 1 deletion ColorPicker/Pages/HarmoniesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ internal void InitHarmonies()

// Analogous
AnalogousPanel.Children.Clear();
var analogousColors = Global.GenerateAnalogousColors(color, 6, int.Parse(AngleTxt.Text));
var analogousColors = Global.GenerateAnalogousColors(color, int.Parse(AmountTxt.Text), int.Parse(AngleTxt.Text));
for (int i = 0; i < analogousColors.Length; i++)
{
CornerRadius radius = i == 0 ? new(10, 0, 0, 10) : new(0);
Expand Down
9 changes: 9 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.

3 changes: 3 additions & 0 deletions ColorPicker/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -645,4 +645,7 @@
<data name="Steps" xml:space="preserve">
<value>Steps</value>
</data>
<data name="AmountToGenerate" xml:space="preserve">
<value>Amount to generate</value>
</data>
</root>
3 changes: 3 additions & 0 deletions ColorPicker/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -649,4 +649,7 @@
<data name="Steps" xml:space="preserve">
<value>Pas</value>
</data>
<data name="AmountToGenerate" xml:space="preserve">
<value>Nombre de couleurs à générer</value>
</data>
</root>
3 changes: 3 additions & 0 deletions ColorPicker/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -625,4 +625,7 @@
<data name="Steps" xml:space="preserve">
<value>Steps</value>
</data>
<data name="AmountToGenerate" xml:space="preserve">
<value>Amount to generate</value>
</data>
</root>
3 changes: 3 additions & 0 deletions ColorPicker/Properties/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -653,4 +653,7 @@
<data name="Steps" xml:space="preserve">
<value>步骤</value>
</data>
<data name="AmountToGenerate" xml:space="preserve">
<value>产生金额</value>
</data>
</root>

0 comments on commit 63a6519

Please sign in to comment.