Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ Avalonia 12. Use the `avalonia-docs` MCP before reaching for an API from memory.
- App types are `internal` (CA1515): a view sets `x:ClassModifier="internal"` to match.
- Code-behind is view-only: focus and forwarding events to commands.
- Every text-less control gets an `AutomationProperties.Name`.
- Freizeichen opens from inside Lagebuch and wears Lagebuch's theme: `Theme/Tokens.axaml` and
`Theme/Styles.axaml` are a trimmed copy of Lagebuch's, with the same token names so a change
there carries across by diff. Use the tokens and classes (`display`, `overline`, `secondary`,
`metric`, `status`, `Button.signal`), never a hard-coded colour or font in a view.
- Every new top-level `Window` calls `WindowsTitleBar.ApplyDarkMode` in `OnOpened`. Windows 10
gets no dark title bar otherwise.

## Security

Expand Down
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<ItemGroup>
<PackageVersion Include="Avalonia" Version="12.1.4" />
<PackageVersion Include="Avalonia.Desktop" Version="12.1.4" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="12.1.4" />
<PackageVersion Include="Avalonia.Headless.XUnit" Version="12.1.4" />
<PackageVersion Include="Avalonia.Skia" Version="12.1.4" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="12.1.4" />
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions src/Freizeichen.App/Assets/Fonts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Bundled fonts

All fonts below are licensed under the **SIL Open Font License, Version 1.1**
(<https://openfontlicense.org/>), which permits bundling and redistribution
within an application. Each family retains its own copyright and Reserved Font
Name as stated in its upstream `OFL.txt`.

| File(s) | Family | Copyright |
| -------------------------------------------- | -------------- | ------------------------------------------------------------------------- |
| `Oswald-Medium.ttf`, `Oswald-SemiBold.ttf` | Oswald | Copyright 2016 The Oswald Project Authors (github.com/googlefonts/OswaldFont) |
| `Barlow-*.ttf` | Barlow | Copyright 2017 The Barlow Project Authors (github.com/jpt/barlow) |
| `JetBrainsMono-Regular.ttf`, `-Medium.ttf` | JetBrains Mono | Copyright 2020 The JetBrains Mono Project Authors (github.com/JetBrains/JetBrainsMono) |

## Notes

- The Oswald files are **static weight instances** renamed to share the family
name `Oswald` (OS/2 weight class 500 / 600). The upstream variable font is not
used because variable-font weight realization fails in the headless Skia text
backend used by the headless view tests.
- Fonts are embedded via `<AvaloniaResource>` and referenced as
`avares://Freizeichen/Assets/Fonts#<Family>` in `Theme/Tokens.axaml`.
6 changes: 5 additions & 1 deletion src/Freizeichen.App/Freizeichen.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Fonts.Inter" />
<PackageReference Include="Avalonia.Themes.Fluent" />
</ItemGroup>

<ItemGroup>
<!-- Lagebuch's fonts (SIL OFL 1.1, see Assets/Fonts/README.md), referenced from Theme/Tokens.axaml. -->
<AvaloniaResource Include="Assets\Fonts\*.ttf" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Freizeichen.AppLogic\Freizeichen.AppLogic.csproj" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Freizeichen.App/FreizeichenApp.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Freizeichen.App.FreizeichenApp"
x:ClassModifier="internal"
RequestedThemeVariant="Default">
RequestedThemeVariant="Dark">
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Freizeichen/Theme/Styles.axaml" />
</Application.Styles>
</Application>
3 changes: 1 addition & 2 deletions src/Freizeichen.App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ public static void Main(string[] args) =>

public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<FreizeichenApp>()
.UsePlatformDetect()
.WithInterFont();
.UsePlatformDetect();
}
208 changes: 208 additions & 0 deletions src/Freizeichen.App/Theme/Styles.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<!-- Lagebuch's styles for the controls Freizeichen uses, after Lagebuch's Theme/Styles.axaml. -->

<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Freizeichen/Theme/Tokens.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>

<!-- =========================================================
TEXT
========================================================= -->
<Style Selector="TextBlock, SelectableTextBlock">
<Setter Property="FontFamily" Value="{StaticResource BodyFont}" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="14" />
</Style>

<!-- Display / heading -->
<Style Selector="TextBlock.display">
<Setter Property="FontFamily" Value="{StaticResource DisplayFont}" />
<Setter Property="FontWeight" Value="Medium" />
<Setter Property="FontSize" Value="22" />
</Style>

<!-- Section / overline label: condensed, tracked-out, muted -->
<Style Selector="TextBlock.overline">
<Setter Property="FontFamily" Value="{StaticResource DisplayFont}" />
<Setter Property="FontSize" Value="11" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Foreground" Value="{StaticResource TextSecondaryBrush}" />
<Setter Property="LetterSpacing" Value="2.5" />
</Style>

<Style Selector="TextBlock.secondary">
<Setter Property="Foreground" Value="{StaticResource TextSecondaryBrush}" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>

<!-- Tactical monospace: the number about to be dialled -->
<Style Selector="SelectableTextBlock.metric">
<Setter Property="FontFamily" Value="{StaticResource MonoFont}" />
<Setter Property="FontWeight" Value="Medium" />
<Setter Property="FontSize" Value="28" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
<Setter Property="SelectionBrush" Value="#40FF3D2E" />
</Style>

<!-- The outcome of a dial or a test; the blocking red when it failed. -->
<Style Selector="TextBlock.status">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<Style Selector="TextBlock.status.error">
<Setter Property="Foreground" Value="{StaticResource ErrorBrush}" />
</Style>

<Style Selector="Label">
<Setter Property="FontFamily" Value="{StaticResource BodyFont}" />
<Setter Property="FontSize" Value="13" />
<Setter Property="Foreground" Value="{StaticResource TextSecondaryBrush}" />
<Setter Property="Padding" Value="0,0,0,2" />
</Style>

<!-- =========================================================
BUTTONS — default = quiet outline; .signal = primary
========================================================= -->
<Style Selector="Button">
<Setter Property="FontFamily" Value="{StaticResource DisplayFont}" />
<Setter Property="FontSize" Value="13" />
<Setter Property="FontWeight" Value="Medium" />
<Setter Property="Height" Value="{StaticResource ControlHeight}" />
<Setter Property="Padding" Value="16,0" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{StaticResource SurfaceTopBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderStrongBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{StaticResource RadiusSm}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Transitions">
<Transitions>
<BrushTransition Property="Background" Duration="0:0:0.15" />
<BrushTransition Property="BorderBrush" Duration="0:0:0.15" />
</Transitions>
</Setter>
</Style>
<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#2C3848" />
<Setter Property="BorderBrush" Value="{StaticResource BorderStrongBrush}" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#161D27" />
</Style>
<Style Selector="Button:pressed">
<Setter Property="RenderTransform" Value="scale(0.97)" />
</Style>
<Style Selector="Button:disabled">
<Setter Property="Opacity" Value="0.4" />
</Style>
<Style Selector="Button:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{StaticResource SurfaceTopBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderStrongBrush}" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
</Style>

<!-- Primary signal button -->
<Style Selector="Button.signal">
<Setter Property="Background" Value="{StaticResource SignalGradientBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource SignalHotBrush}" />
<Setter Property="Foreground" Value="#FFFFFF" />
</Style>
<Style Selector="Button.signal:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{StaticResource SignalHotBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource SignalHotBrush}" />
<Setter Property="Foreground" Value="#FFFFFF" />
</Style>
<Style Selector="Button.signal:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{StaticResource SignalDeepBrush}" />
</Style>
<Style Selector="Button.signal:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{StaticResource SignalGradientBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource SignalHotBrush}" />
<Setter Property="Foreground" Value="#FFFFFF" />
</Style>

<!-- =========================================================
INPUTS — TextBox / ComboBox
========================================================= -->
<Style Selector="TextBox">
<Setter Property="FontFamily" Value="{StaticResource BodyFont}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="MinHeight" Value="{StaticResource ControlHeight}" />
<Setter Property="Padding" Value="11,7" />
<Setter Property="Background" Value="#0C1119" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
<Setter Property="CaretBrush" Value="{StaticResource SignalBrush}" />
<Setter Property="SelectionBrush" Value="#40FF3D2E" />
<Setter Property="BorderBrush" Value="{StaticResource HairlineBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{StaticResource RadiusSm}" />
<!-- With a MinHeight and a Padding, Avalonia top-aligns the text by default; centre it. -->
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style Selector="TextBox /template/ Border#PART_BorderElement">
<Setter Property="Transitions">
<Transitions>
<BrushTransition Property="BorderBrush" Duration="0:0:0.15" />
</Transitions>
</Setter>
</Style>
<Style Selector="TextBox:pointerover /template/ Border#PART_BorderElement">
<Setter Property="BorderBrush" Value="{StaticResource BorderStrongBrush}" />
<Setter Property="Background" Value="#0C1119" />
</Style>
<!-- Text inputs show focus on their own edge, on any focus: a click into a field must show where
the typing goes too. So they take the focus colour on :focus and no adorner. -->
<Style Selector="TextBox, ComboBox">
<Setter Property="FocusAdorner" Value="{x:Null}" />
</Style>
<Style Selector="TextBox:focus /template/ Border#PART_BorderElement">
<Setter Property="BorderBrush" Value="{StaticResource FocusBrush}" />
<Setter Property="Background" Value="#0C1119" />
</Style>
<Style Selector="TextBox /template/ TextBlock#PART_Watermark, TextBox /template/ TextBlock#PART_FloatingWatermark">
<Setter Property="Foreground" Value="{StaticResource TextMutedBrush}" />
</Style>

<Style Selector="ComboBox">
<Setter Property="FontFamily" Value="{StaticResource BodyFont}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="MinHeight" Value="{StaticResource ControlHeight}" />
<Setter Property="Padding" Value="11,5" />
<Setter Property="Background" Value="#0C1119" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource HairlineBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{StaticResource RadiusSm}" />
<Setter Property="PlaceholderForeground" Value="{StaticResource TextMutedBrush}" />
</Style>
<Style Selector="ComboBox:pointerover /template/ Border#Background">
<Setter Property="BorderBrush" Value="{StaticResource BorderStrongBrush}" />
<Setter Property="Background" Value="#0C1119" />
</Style>
<Style Selector="ComboBox:focus /template/ Border#Background">
<Setter Property="BorderBrush" Value="{StaticResource FocusBrush}" />
<Setter Property="Background" Value="#0C1119" />
</Style>
<Style Selector="ComboBoxItem">
<Setter Property="FontFamily" Value="{StaticResource BodyFont}" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
<Setter Property="Padding" Value="11,8" />
</Style>

<!-- Indeterminate progress in the signal colour, as the only moving thing on screen. -->
<Style Selector="ProgressBar">
<Setter Property="Foreground" Value="{StaticResource SignalBrush}" />
<Setter Property="Background" Value="{StaticResource HairlineBrush}" />
<Setter Property="MinHeight" Value="3" />
<Setter Property="Height" Value="3" />
</Style>
</Styles>
85 changes: 85 additions & 0 deletions src/Freizeichen.App/Theme/Tokens.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<!-- Lagebuch's "dispatch console" tokens, trimmed to what Freizeichen uses. Freizeichen opens
from inside Lagebuch, so it wears the same theme; the names match Lagebuch's
Theme/Tokens.axaml so a change there can be carried across by diff. -->

<!-- Typography -->

<FontFamily x:Key="DisplayFont">avares://Freizeichen/Assets/Fonts#Oswald</FontFamily>
<FontFamily x:Key="BodyFont">avares://Freizeichen/Assets/Fonts#Barlow</FontFamily>
<FontFamily x:Key="MonoFont">avares://Freizeichen/Assets/Fonts#JetBrains Mono</FontFamily>

<!-- Raw colors -->

<Color x:Key="AppBgColor">#0B0E13</Color>
<Color x:Key="AppBgColor2">#10141C</Color>
<Color x:Key="SurfaceColor">#141A24</Color>
<Color x:Key="SurfaceRaisedColor">#1B2330</Color>
<Color x:Key="SurfaceTopColor">#222C3B</Color>

<Color x:Key="HairlineColor">#26303D</Color>
<Color x:Key="BorderStrongColor">#384556</Color>

<Color x:Key="TextPrimaryColor">#EEF2F8</Color>
<Color x:Key="TextSecondaryColor">#9AA7B8</Color>
<Color x:Key="TextMutedColor">#65728580</Color>

<Color x:Key="SignalColor">#FF3D2E</Color>
<Color x:Key="SignalHotColor">#FF5A3C</Color>
<Color x:Key="SignalDeepColor">#C71E12</Color>

<!-- Blocking red, softer than SignalColor, which is reserved for the emergency accent. -->
<Color x:Key="ErrorColor">#F87171</Color>

<!-- Keyboard focus, and nothing else. Deliberately not SignalColor: a red ring roaming every
control would wear out the meaning of red. -->
<Color x:Key="FocusColor">#2DD4E8</Color>

<Color x:Key="ActiveColor">#37D17C</Color>

<!-- Brushes -->

<SolidColorBrush x:Key="SurfaceBrush" Color="{StaticResource SurfaceColor}" />
<SolidColorBrush x:Key="SurfaceRaisedBrush" Color="{StaticResource SurfaceRaisedColor}" />
<SolidColorBrush x:Key="SurfaceTopBrush" Color="{StaticResource SurfaceTopColor}" />
<SolidColorBrush x:Key="HairlineBrush" Color="{StaticResource HairlineColor}" />
<SolidColorBrush x:Key="BorderStrongBrush" Color="{StaticResource BorderStrongColor}" />

<SolidColorBrush x:Key="TextPrimaryBrush" Color="{StaticResource TextPrimaryColor}" />
<SolidColorBrush x:Key="TextSecondaryBrush" Color="{StaticResource TextSecondaryColor}" />
<SolidColorBrush x:Key="TextMutedBrush" Color="{StaticResource TextMutedColor}" />

<SolidColorBrush x:Key="SignalBrush" Color="{StaticResource SignalColor}" />
<SolidColorBrush x:Key="SignalHotBrush" Color="{StaticResource SignalHotColor}" />
<SolidColorBrush x:Key="SignalDeepBrush" Color="{StaticResource SignalDeepColor}" />
<SolidColorBrush x:Key="ErrorBrush" Color="{StaticResource ErrorColor}" />
<SolidColorBrush x:Key="ActiveBrush" Color="{StaticResource ActiveColor}" />
<SolidColorBrush x:Key="FocusBrush" Color="{StaticResource FocusColor}" />

<!-- Fluent draws its focus adorner on every control that is :focus-visible (keyboard focus,
never a click): a 2px ring with a 1px line inside it. Recolouring only the brushes gives
every control the one focus edge; overriding the margin or thickness keys makes Fluent draw
no ring at all. -->
<SolidColorBrush x:Key="SystemControlFocusVisualPrimaryBrush" Color="{StaticResource FocusColor}" />
<SolidColorBrush x:Key="SystemControlFocusVisualSecondaryBrush" Color="{StaticResource AppBgColor}" />

<!-- Atmospheric app background: vertical charcoal wash -->
<LinearGradientBrush x:Key="AppBackgroundBrush" StartPoint="0%,0%" EndPoint="0%,100%">
<GradientStop Color="{StaticResource AppBgColor2}" Offset="0" />
<GradientStop Color="{StaticResource AppBgColor}" Offset="1" />
</LinearGradientBrush>

<!-- Signal accent gradient (brand bar, primary buttons) -->
<LinearGradientBrush x:Key="SignalGradientBrush" StartPoint="0%,0%" EndPoint="0%,100%">
<GradientStop Color="{StaticResource SignalHotColor}" Offset="0" />
<GradientStop Color="{StaticResource SignalDeepColor}" Offset="1" />
</LinearGradientBrush>

<!-- Metrics -->

<CornerRadius x:Key="RadiusSm">5</CornerRadius>
<x:Double x:Key="ControlHeight">36</x:Double>

</ResourceDictionary>
Loading
Loading