Skip to content

Commit

Permalink
Add option to edit highlight color
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrietS committed Oct 20, 2024
1 parent 7c299d5 commit 1e91db2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/LogAlligator.App/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<!--<ResourceInclude Source="/ThemeCustomizations.axaml" />-->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application.Resources>

<Application.Styles>
<SimpleTheme />

<Styles>
<Styles.Resources>
<ResourceDictionary>
Expand All @@ -22,7 +22,7 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<StyleInclude Source="StyleCustomizations.axaml" />
<StyleInclude Source="StyleCustomizations.axaml" />
</Styles>
</Application.Styles>

Expand Down
11 changes: 10 additions & 1 deletion src/LogAlligator.App/Controls/Dialogs/EditHighlightDialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Title="Edit highlight"
Width="300"
Height="95"
Height="500"
CanResize="False"
ShowInTaskbar="False"
ExtendClientAreaChromeHints="NoChrome"
Expand All @@ -21,6 +21,15 @@
<TextBlock FontSize="{DynamicResource FontSizeNormal}">Edit highlight</TextBlock>
<Separator Background="Transparent"/>
<TextBox Name="HighlightPatternTextBox" Focusable="True" Watermark="Highlight pattern"/>
<ColorView Name="HighlightColorPicker"
IsAccentColorsVisible="False"
IsAlphaEnabled="False"
IsColorModelVisible="False"
IsColorComponentsVisible="False"
IsColorPaletteVisible="False"
IsComponentSliderVisible="False"
IsColorSpectrumVisible="True"
IsColorPreviewVisible="True"/>
<Separator Height="6" Background="Transparent"/>
<StackPanel Orientation="Horizontal" Spacing="5" HorizontalAlignment="Center">
<Button Command="{Binding OnOkClick}" Width="60" IsDefault="True">OK</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void Initialize(Highlight highlight)
{
_highlightToEdit = highlight;
HighlightPatternTextBox.Text = highlight.Pattern.Pattern.ToString();
HighlightColorPicker.Color = highlight.Background;
}

public void OnEscape()
Expand All @@ -31,6 +32,7 @@ public void OnOkClick()
if (!string.IsNullOrEmpty(HighlightPatternTextBox.Text))
{
_highlightToEdit!.Pattern.Pattern = HighlightPatternTextBox.Text.AsMemory();
_highlightToEdit!.Background = HighlightColorPicker.Color;
}

Close();
Expand Down
1 change: 1 addition & 0 deletions src/LogAlligator.App/LogAlligator.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ItemGroup>
<!-- Avalonia -->
<PackageReference Include="Avalonia" Version="11.2.0-beta1" />
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.2.0-beta1" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.0-beta1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.0-beta1" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.2.0-beta1" />
Expand Down
7 changes: 5 additions & 2 deletions src/LogAlligator.App/StyleCustomizations.axaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Styles xmlns="https://github.com/avaloniaui"
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Simple/Simple.xaml" />

<Design.PreviewWith>
<Border Width="400"
Height="400">
Expand All @@ -8,7 +11,7 @@
<StackPanel>
<TextBlock>Hello world!</TextBlock>
<Button>Normal button</Button>
<ToggleButton>Some text</ToggleButton>
<ToggleButton>Some text</ToggleButton>
</StackPanel>
</TabItem>
<TabItem Header="Panel2"></TabItem>
Expand Down

0 comments on commit 1e91db2

Please sign in to comment.