Skip to content

Commit

Permalink
Added the possibility to set the steps for monochromatic color harmon…
Browse files Browse the repository at this point in the history
…ies (#362)
  • Loading branch information
lpeyr committed Jan 14, 2024
1 parent 12df8af commit 5947fb1
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 5 deletions.
79 changes: 75 additions & 4 deletions ColorPicker/Pages/HarmoniesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,30 @@
x:Name="AnalogousPanel"
Margin="10"
Orientation="Horizontal" />
<TextBlock
Margin="5"
FontWeight="Bold"
Text="{x:Static lang:Resources.Monochromatic}" />
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="5"
FontWeight="Bold"
Text="{x:Static lang:Resources.Monochromatic}" />
<Button
x:Name="MonochromaticSettingsBtn"
Grid.Column="3"
Padding="5"
VerticalAlignment="Center"
Background="{DynamicResource Background3}"
Click="MonochromaticSettingsBtn_Click"
Content="&#xF6AA;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}">
<Button.ToolTip>
<ToolTip
Background="{DynamicResource Background1}"
Content="{x:Static lang:Resources.Settings}"
Foreground="{DynamicResource Foreground1}" />
</Button.ToolTip>
</Button>
</StackPanel>
<WrapPanel
x:Name="MonochromaticPanel"
Margin="10"
Expand Down Expand Up @@ -565,5 +585,56 @@
</StackPanel>
</Border>
</Popup>
<Popup
x:Name="MonochromaticPopup"
AllowsTransparency="True"
Placement="Top"
PlacementTarget="{Binding ElementName=AnalogousSettingsBtn}"
StaysOpen="False">
<Border
Margin="10"
Padding="5"
Background="{DynamicResource CardBackground}"
CornerRadius="10">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{DynamicResource Accent}" />
</Border.Effect>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0 0 10 0"
VerticalAlignment="Center"
Text="{x:Static lang:Resources.Steps}" />
<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="StepsTxt"
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>
</Border>
</Popup>
</Grid>
</Page>
7 changes: 6 additions & 1 deletion ColorPicker/Pages/HarmoniesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ internal void InitHarmonies()

// Monochromatic
MonochromaticPanel.Children.Clear();
var monoColors = Global.GenerateMonochromaticColors(color, 6, 6);
var monoColors = Global.GenerateMonochromaticColors(color, 6, int.Parse(StepsTxt.Text));
for (int i = 0; i < monoColors.Length; i++)
{
CornerRadius radius = i == 0 ? new(10, 0, 0, 10) : new(0);
Expand Down Expand Up @@ -476,5 +476,10 @@ private void AngleTxt_TextChanged(object sender, TextChangedEventArgs e)
}
catch { }
}

private void MonochromaticSettingsBtn_Click(object sender, RoutedEventArgs e)
{
MonochromaticPopup.IsOpen = true;
}
}
}
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 @@ -642,4 +642,7 @@
<data name="Angle" xml:space="preserve">
<value>Angle</value>
</data>
<data name="Steps" xml:space="preserve">
<value>Steps</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 @@ -646,4 +646,7 @@
<data name="Angle" xml:space="preserve">
<value>Angle</value>
</data>
<data name="Steps" xml:space="preserve">
<value>Pas</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 @@ -622,4 +622,7 @@
<data name="Angle" xml:space="preserve">
<value>Angle</value>
</data>
<data name="Steps" xml:space="preserve">
<value>Steps</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 @@ -650,4 +650,7 @@
<data name="Angle" xml:space="preserve">
<value>角度</value>
</data>
<data name="Steps" xml:space="preserve">
<value>步骤</value>
</data>
</root>

0 comments on commit 5947fb1

Please sign in to comment.