Skip to content

Commit

Permalink
Theming tweaks (#751)
Browse files Browse the repository at this point in the history
* - Replace fluent theme with semi for data grids.
- Fix selection highlighting in hex-editor
- Centralize Spice86 theming additions and overrides.
 - Add hyperlink style

* Whitespace formatting
  • Loading branch information
JorisVanEijden authored Jun 30, 2024
1 parent 4beb477 commit 716ff19
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/Spice86/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
RequestedThemeVariant="Default">

<Application.Resources>
<FontFamily x:Key="RobotoMonoFont">avares://Spice86/Assets#Roboto Mono</FontFamily>
<FontFamily x:Key="ConsolasFont">Consolas</FontFamily>
</Application.Resources>
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->

<Application.Styles>
<FluentTheme DensityStyle="Compact" />
<dialogHostAvalonia:DialogHostStyles />
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<StyleInclude Source="avares://AvaloniaHex/Themes/Simple/AvaloniaHex.axaml" />
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.TreeDataGrid/Index.axaml" />
<StyleInclude Source="Styles/Spice86.axaml" />
</Application.Styles>
</Application>

</Application>
3 changes: 2 additions & 1 deletion src/Spice86/Spice86.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.11" />
<PackageReference Include="Iced" Version="1.21.0" />
<PackageReference Include="Semi.Avalonia" Version="11.0.7.3" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.0.7.2" />
<PackageReference Include="Semi.Avalonia.TreeDataGrid" Version="11.0.1" />
<PackageReference Include="bodong.Avalonia.PropertyGrid" Version="11.0.10.1" />
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
Expand All @@ -67,7 +69,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Avalonia" Version="11.0.11" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.11" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.11" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.11" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
Expand Down
37 changes: 37 additions & 0 deletions src/Spice86/Styles/Spice86.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Design.PreviewWith>
<ThemeVariantScope RequestedThemeVariant="Dark">
<Border Padding="20">
<StackPanel>
<Button Content="This is a &quot;hyperlink&quot;" Classes="hyperlink" />
<TextBlock Foreground="{DynamicResource HighlightColor}">This is highlighted</TextBlock>
</StackPanel>
</Border>
</ThemeVariantScope>
</Design.PreviewWith>

<Style Selector="Button.hyperlink">
<Setter Property="Template">
<ControlTemplate>
<TextBlock Text="{TemplateBinding Content}" Foreground="{StaticResource SystemAccentColor}" TextDecorations="Underline">
<TextBlock.Styles>
<Style Selector="TextBlock:pointerover">
<Setter Property="Foreground" Value="{StaticResource SystemAccentColorLight1}" />
</Style>
</TextBlock.Styles>
</TextBlock>
</ControlTemplate>
</Setter>
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Style>

<Style>
<Style.Resources>
<SolidColorBrush x:Key="HighlightColor">Yellow</SolidColorBrush>
</Style.Resources>
</Style>

</Styles>

0 comments on commit 716ff19

Please sign in to comment.