Skip to content

Commit

Permalink
Merge pull request #312 from AvaloniaUI/search-fix-simple-theme
Browse files Browse the repository at this point in the history
Fix simple theme in SearchPanel
  • Loading branch information
danipen authored Mar 6, 2023
2 parents 62895f5 + 3672c68 commit ae08362
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/AvaloniaEdit.Demo/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RequestedThemeVariant="Dark">
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />

<!--Code completion-->
<Style Selector="cc|CompletionList">
Expand Down
8 changes: 3 additions & 5 deletions src/AvaloniaEdit.Demo/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
MinHeight="300"
Width="950"
Title="AvaloniaEdit Demo"
x:Class="AvaloniaEdit.Demo.MainWindow"
Background="#1E1E1E">
x:Class="AvaloniaEdit.Demo.MainWindow">
<DockPanel>
<StackPanel Orientation="Horizontal"
DockPanel.Dock="Top"
Spacing="5"
Margin="3">
<ToggleButton Name="wordWrap" ToolTip.Tip="Word wrap" IsChecked="{Binding #Editor.WordWrap}">
<ToggleButton.Content>
<Path Fill="White" Data="M2.75 5C2.33579 5 2 5.33579 2 5.75C2 6.16421 2.33579 6.5 2.75 6.5H21.25C21.6642 6.5 22 6.16421 22 5.75C22 5.33579 21.6642 5 21.25 5H2.75Z M2.75 11.5C2.33579 11.5 2 11.8358 2 12.25C2 12.6642 2.33579 13 2.75 13H19C20.3807 13 21.5 14.1193 21.5 15.5C21.5 16.8807 20.3807 18 19 18H14.5607L15.2803 17.2803C15.5732 16.9874 15.5732 16.5126 15.2803 16.2197C14.9874 15.9268 14.5126 15.9268 14.2197 16.2197L12.2197 18.2197C11.9268 18.5126 11.9268 18.9874 12.2197 19.2803L14.2197 21.2803C14.5126 21.5732 14.9874 21.5732 15.2803 21.2803C15.5732 20.9874 15.5732 20.5126 15.2803 20.2197L14.5607 19.5H19C21.2091 19.5 23 17.7091 23 15.5C23 13.2909 21.2091 11.5 19 11.5H2.75Z M2 18.75C2 18.3358 2.33579 18 2.75 18H9.25C9.66421 18 10 18.3358 10 18.75C10 19.1642 9.66421 19.5 9.25 19.5H2.75C2.33579 19.5 2 19.1642 2 18.75Z" />
<Path Fill="{Binding $parent.Foreground}" Data="M2.75 5C2.33579 5 2 5.33579 2 5.75C2 6.16421 2.33579 6.5 2.75 6.5H21.25C21.6642 6.5 22 6.16421 22 5.75C22 5.33579 21.6642 5 21.25 5H2.75Z M2.75 11.5C2.33579 11.5 2 11.8358 2 12.25C2 12.6642 2.33579 13 2.75 13H19C20.3807 13 21.5 14.1193 21.5 15.5C21.5 16.8807 20.3807 18 19 18H14.5607L15.2803 17.2803C15.5732 16.9874 15.5732 16.5126 15.2803 16.2197C14.9874 15.9268 14.5126 15.9268 14.2197 16.2197L12.2197 18.2197C11.9268 18.5126 11.9268 18.9874 12.2197 19.2803L14.2197 21.2803C14.5126 21.5732 14.9874 21.5732 15.2803 21.2803C15.5732 20.9874 15.5732 20.5126 15.2803 20.2197L14.5607 19.5H19C21.2091 19.5 23 17.7091 23 15.5C23 13.2909 21.2091 11.5 19 11.5H2.75Z M2 18.75C2 18.3358 2.33579 18 2.75 18H9.25C9.66421 18 10 18.3358 10 18.75C10 19.1642 9.66421 19.5 9.25 19.5H2.75C2.33579 19.5 2 19.1642 2 18.75Z" />
</ToggleButton.Content>
</ToggleButton>
<ToggleButton Name="viewTabs" Content="View tabs" IsChecked="{Binding #Editor.Options.ShowTabs}" VerticalAlignment="Stretch" VerticalContentAlignment="Center"/>
Expand All @@ -27,12 +26,11 @@
<Button Name="changeThemeBtn" Content="Change theme" VerticalAlignment="Stretch" VerticalContentAlignment="Center"/>
</StackPanel>
<StackPanel Name="StatusBar" Background="Purple" Height="25" DockPanel.Dock="Bottom" Orientation="Horizontal">
<TextBlock Name="StatusText" Text="Ready" Margin="5 0 0 0" VerticalAlignment="Center" FontSize="12"/>
<TextBlock Foreground="White" Name="StatusText" Text="Ready" Margin="5 0 0 0" VerticalAlignment="Center" FontSize="12"/>
</StackPanel>
<AvalonEdit:TextEditor Name="Editor"
FontFamily="Cascadia Code,Consolas,Menlo,Monospace"
Margin="30"
Foreground="#D4D4D4"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Visible"
FontWeight="Light"
Expand Down
11 changes: 0 additions & 11 deletions src/AvaloniaEdit/AvaloniaEdit.xaml

This file was deleted.

40 changes: 20 additions & 20 deletions src/AvaloniaEdit/Search/SearchPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
VerticalAlignment="Center"
HorizontalAlignment="Center"
Height="13"
Fill="{DynamicResource TextControlButtonForeground}"
Stroke="{DynamicResource TextControlButtonForeground}"
Fill="{TemplateBinding Foreground}"
Stroke="{TemplateBinding Foreground}"
StrokeThickness="1" />
</Border>
</ControlTemplate>
Expand Down Expand Up @@ -60,12 +60,12 @@
<Style Selector="search|SearchPanel">
<Setter Property="BorderThickness" Value="1 0 1 1" />
<Setter Property="CornerRadius" Value="0 0 4 4" />
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlForegroundBaseLowBrush}" />
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource SearchPanelBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource SearchPanelBackgroundBrush}" />
<Setter Property="Focusable" Value="True" />
<Setter Property="Margin" Value="0 0 18 0" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{DynamicResource SearchPanelFontSize}" />
<Setter Property="FontFamily" Value="{DynamicResource SearchPanelFontFamily}" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="PART_Border"
Expand Down Expand Up @@ -113,8 +113,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="12"
Fill="{DynamicResource ButtonForeground}"
Stroke="{DynamicResource ButtonForeground}"
Fill="{Binding $parent.Foreground}"
Stroke="{Binding $parent.Foreground}"
StrokeThickness="1" />
</ToggleButton>
<ToggleButton
Expand All @@ -129,8 +129,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="14"
Fill="{DynamicResource ButtonForeground}"
Stroke="{DynamicResource ButtonForeground}"
Fill="{Binding $parent.Foreground}"
Stroke="{Binding $parent.Foreground}"
StrokeThickness="1" />
</ToggleButton>
<ToggleButton
Expand All @@ -145,8 +145,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="12"
Fill="{DynamicResource ButtonForeground}"
Stroke="{DynamicResource ButtonForeground}"
Fill="{Binding $parent.Foreground}"
Stroke="{Binding $parent.Foreground}"
StrokeThickness="1" />
</ToggleButton>
</StackPanel>
Expand All @@ -164,8 +164,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="16"
Fill="{DynamicResource ButtonForeground}"
Stroke="{DynamicResource ButtonForeground}"
Fill="{Binding $parent.Foreground}"
Stroke="{Binding $parent.Foreground}"
StrokeThickness="1" />
</Button>
<Button Margin="3,0,0,0"
Expand All @@ -180,8 +180,8 @@
VerticalAlignment="Center"
Stretch="Uniform"
Width="16"
Fill="{DynamicResource ButtonForeground}"
Stroke="{DynamicResource ButtonForeground}"
Fill="{Binding $parent.Foreground}"
Stroke="{Binding $parent.Foreground}"
StrokeThickness="1" />
</Button>
<Button Margin="3,0,0,0"
Expand All @@ -195,8 +195,8 @@
VerticalAlignment="Center"
Stretch="Uniform"
Width="12"
Fill="{DynamicResource ButtonForeground}"
Stroke="{DynamicResource ButtonForeground}"
Fill="{Binding $parent.Foreground}"
Stroke="{Binding $parent.Foreground}"
StrokeThickness="1" />
</Button>
</StackPanel>
Expand Down Expand Up @@ -226,7 +226,7 @@
VerticalAlignment="Center"
Stretch="Uniform"
Width="12"
Fill="{DynamicResource ButtonForeground}"
Fill="{Binding $parent.Foreground}"
StrokeThickness="1" />
</Button>
<Button Margin="3, 0, 0, 0"
Expand All @@ -242,7 +242,7 @@
VerticalAlignment="Center"
Stretch="Uniform"
Width="18"
Fill="{DynamicResource ButtonForeground}" />
Fill="{Binding $parent.Foreground}" />
</Button>
</StackPanel>
<StackPanel Name="PART_MessageView"
Expand Down
19 changes: 19 additions & 0 deletions src/AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Styles xmlns="https://github.com/avaloniaui">

<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<MergeResourceInclude Source="/Themes/Fluent/Base.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>

<StyleInclude Source="avares://AvaloniaEdit/TextEditor.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Editing/TextArea.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/CodeCompletion/CompletionList.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/CodeCompletion/InsightWindow.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Rendering/VisualLineDrawingVisual.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Search/DropDownButton.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Search/SearchPanel.xaml" />

</Styles>
16 changes: 16 additions & 0 deletions src/AvaloniaEdit/Themes/Fluent/Base.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="using:System">
<StaticResource x:Key="SearchPanelFontSize" ResourceKey="ControlContentThemeFontSize" />
<StaticResource x:Key="SearchPanelFontFamily" ResourceKey="ContentControlThemeFontFamily" />
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="SearchPanelBackgroundBrush" Color="{DynamicResource SystemChromeMediumColor}" />
<SolidColorBrush x:Key="SearchPanelBorderBrush" Color="{DynamicResource SystemBaseLowColor}" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="SearchPanelBackgroundBrush" Color="{DynamicResource SystemChromeMediumColor}" />
<SolidColorBrush x:Key="SearchPanelBorderBrush" Color="{DynamicResource SystemBaseLowColor}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
19 changes: 19 additions & 0 deletions src/AvaloniaEdit/Themes/Simple/AvaloniaEdit.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Styles xmlns="https://github.com/avaloniaui">

<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<MergeResourceInclude Source="/Themes/Simple/Base.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>

<StyleInclude Source="avares://AvaloniaEdit/TextEditor.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Editing/TextArea.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/CodeCompletion/CompletionList.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/CodeCompletion/InsightWindow.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Rendering/VisualLineDrawingVisual.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Search/DropDownButton.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Search/SearchPanel.xaml" />

</Styles>
16 changes: 16 additions & 0 deletions src/AvaloniaEdit/Themes/Simple/Base.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="using:System">
<StaticResource x:Key="SearchPanelFontSize" ResourceKey="FontSizeNormal" />
<StaticResource x:Key="SearchPanelFontFamily" ResourceKey="ContentControlThemeFontFamily" />
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="SearchPanelBackgroundBrush" Color="{DynamicResource ThemeBackgroundColor}" />
<SolidColorBrush x:Key="SearchPanelBorderBrush" Color="{DynamicResource ThemeBorderLowColor}" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="SearchPanelBackgroundBrush" Color="{DynamicResource ThemeBackgroundColor}" />
<SolidColorBrush x:Key="SearchPanelBorderBrush" Color="{DynamicResource ThemeBorderLowColor}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>

0 comments on commit ae08362

Please sign in to comment.