Compare commits

...
Author SHA1 Message Date
poli0981andClaude Opus 5.5 59dc22637d release: 0.1.0-beta.35 - its changelog file (accessibility: the statement, a screen reader's names and announcements, headings and charts, contrast themes, focus), HANDOFF's beta.35 section (D88-D92), owner-only item 32, the release lines (beta.35 PR-7)
docs/changelog/0.1.0-beta.35.md takes [Unreleased] as it stood (#366-#371) under a
summary and the update paragraph: the legal texts keep their versions, schema 22
and rules 2026.11.2 unchanged. HANDOFF's beta.34 START HERE (with its alpha.3
lines) moves verbatim to docs/handoff/history/0.1.0-beta.34.md with its row; the
new START HERE carries D88-D92, the choices, what was measured and the traps (a
ContentDialog test needs the dispatcher's context, a static event hears every
test's, WPF UI's throwing brushes fall back to the Fluent fills inside the App, a
resource reference's callback runs on an equal value, a forward StaticResource
fails only when used, Python's "\b", RenderTargetBitmap's offset); owner-only item
32 is beta.35 on real hardware; D88-D92's rows, and D82's and D87's rows now point
at the history files they moved to. README, ACCURACY, the Disclaimer's accuracy
block and LIMITATIONS name 0.1.0-beta.35; ACCESSIBILITY.md's checks paragraph
rewrapped.

No alpha with this release (D92): alpha.4 moves the alpha line to .NET 11's
release as a task of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:15:56 +07:00
poli0981andClaude Opus 5.5 731f6d3082 feat: focus and motion - Ctrl+1 to 5 put the keyboard in the page they open and say its title, a message box is owned by the window it opens over, and pages slide in only while Windows animates (beta.35 PR-6) (#371)
* feat: focus and motion - Ctrl+1 to 5 put the keyboard in the page they open and say its title, a message box is owned by the window it opens over, and pages slide in only while Windows animates (beta.35 PR-6)

PageFocus: after a page shortcut the page shown takes the focus once laid out (its first
control) and its first-level heading is announced; the shell tells it each page shown
from NavigationView.Navigated. PageMotion: the NavigationView's Transition is None while
SystemParameters.ClientAreaAnimation is off, followed as it changes (WPF UI 4.3.0 played
FadeInWithSlide whatever it was). MessageBoxes: WPF UI's MessageBox sets no owner
(measured: null before and after it is shown), so every box is owned by the App's
active window - six call sites, and a scan holds it.

Measured, and left alone: a ContentDialog already gives the focus back to its opener
(WPF UI's ContentDialogHostController stores and restores it); a test pins it. A first
measurement said otherwise because it ran with no dispatcher context, where the
dialog's own finally never resumed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(native): the tiny ring's case retries until one attempt both overlapped the writer and was lapped by it - CI's single attempt kept up with all 200000 records (beta.35 PR-6)

ci.yml's check on #371 failed in fl_ring, "a tiny ring, so the writer laps the
reader constantly": attempts 1, most overlapped drains 167058, dropped 0. The loop
repeated an attempt only when it had not overlapped the writer (#308); an attempt
that overlapped and was never lapped ended it, and CHECK(dropped > 0) failed. Both
now hold in the same attempt, the last, repeated up to kMaxAttempts (8): a reader
that never counts a drop still fails every attempt. 40 local runs of the case and
the native suite (32/32) pass; nothing outside the test changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 06:11:02 +00:00
poli0981andClaude Opus 5.5 cea7d87ff8 feat: Windows contrast themes followed - every colour the theme's own, the accent its highlight, the charts in its colours; and the title bar, the snackbars and a Danger button read (D91) (beta.35 PR-5) (#370)
* feat: Windows contrast themes followed - every colour the theme's own, by role from WPF UI's four contrast files, the accent its highlight and the highlight's text, the charts in its colours, the Remove button its own button, on and off at once (D91) (beta.35 PR-5)

While SystemParameters.HighContrast is on, the light or the dark Fluent theme (as the
contrast theme is) lies under Services/ContrastOverlay: every key of WPF UI 4.3.0's HC1,
HC2, HCBlack and HCWhite in the user's own SystemColors colour for its role
(Services/ContrastRoles: the colour a key has in all four, opaque colours only; ties and
placeholders by name), the transparent keys transparent, the 21 accent keys as the
highlight and the text on the accent as the highlight's text. No Mica, no
SystemThemeWatcher (it would apply WPF UI's files: 84 of 97 colours a red placeholder,
17 brushes that throw). A switch, an edit or turning it off is followed at once.

What the App draws itself reads ContrastTheme.Active: ChartPalette.ForContrast,
ChartTheme.TextOn, the artwork band, the Import list, the update footer. The Remove
button takes the DangerButton style (WPF UI's Danger is a fixed #F44336). Settings >
Theme says a contrast theme is in use.

Red first: the sweep under four default and two edited themes found the chips at
1.26-1.78:1, the Remove button at 3.06-4.42:1, the badges' black, and the pressed
menu item white on white.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: what no sweep rendered reads - the agent's pill on the theme's own fills, every snackbar in the theme's colours, a Danger button's dark text on its red and the theme's own button under a contrast theme (beta.35 PR-5)

Measured 2026-11-09 against WPF UI 4.3.0's styles, outside any surface the sweeps render:
the title bar's agent pill was a ui:Badge with a bound palette appearance (light theme
2.78, 2.63, 2.16 and 3.68:1), the Success and Caution snackbars white on fixed green and
orange (2.78 and 2.16:1 in both themes), and a Danger button white on #F44336 in the dark
theme (3.68:1), out of any contrast theme's reach.

AgentPill (a Pill on the theme's success, caution and critical fills), the strip's
messages all Secondary, and an implicit ui:Button style: a Danger button's text is
TextFillColorDarkPrimaryBrush (5.3 and 5.7:1), and the theme's own button while a
contrast theme is on, message boxes included. The DangerButton style of the first
commit is gone; a bound badge appearance and the other five button appearances are
refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 05:46:12 +00:00
51 changed files with 2483 additions and 202 deletions

No files matched your search

+14 -9
View File
@@ -29,7 +29,7 @@ notices Windows shows for it. It draws nothing inside a game, so it cannot make
| Keys | What they do |
|---|---|
| **Ctrl+1** … **Ctrl+5** (also with the numeric keypad) | Open Dashboard, Games, Compare, Logs and Settings. |
| **Ctrl+1** … **Ctrl+5** (also with the numeric keypad) | Open Dashboard, Games, Compare, Logs and Settings, and move the keyboard into that page; a screen reader hears its title. |
| **Alt** or **F10**, then the arrow keys and **Enter** | Move to the menus. **Alt** with a menu's underlined letter opens it (*File*, *Tools*, *Help* in English). |
| **Tab** and **Shift+Tab** | Move through a page or a dialog in reading order. |
| The **arrow keys**, **Home**, **End**, **Page Up**, **Page Down** | Move inside a list or a table — a game's sessions, the games list, the Compare list, the import checklist. |
@@ -61,12 +61,17 @@ The same keys are in the user guide, [The screens](guide/07-screens.md#keyboard-
- **The notices above the page can be read where they are shown**, and the button that answers one says which notice it
answers.
- **Tab goes from control to control**: pictures, lists and the rows of Settings are not stops of their own.
- **Dialogs say they are dialogs** and keep the focus inside them until they close.
- **Dialogs say they are dialogs**, keep the focus inside them until they close, and then give it back to the control
that opened them. A message box opens over FrameLedger's window, never behind it.
### Seeing the screen
- **Light, dark, or the same as Windows** (Settings ▸ Theme). FrameLedger takes every colour from the theme, and every
text is measured against what is painted under it, in both themes.
- **Windows contrast themes** (Settings ▸ Accessibility ▸ Contrast themes) — Aquatic, Desert, Dusk, Night sky, or one
whose colours you changed: every colour in the window becomes one of the theme's, whatever Settings ▸ Theme says, as
soon as you turn one on, edit it or turn it off. The charts draw in its colours too, their lines and marks still told
apart by pattern, and Settings ▸ Theme says a contrast theme is in use.
- **The colour a game's picture lends its page** is used only as far as every text on it still reads, and never under a
contrast theme.
- **Windows display scaling** at any size, on every screen; **Magnifier** (Windows logo key + Plus) works as with any
@@ -88,12 +93,15 @@ from the same translations. The documents — the user guide, this page, the leg
reader inside a control, no two buttons in a list share a name; each thing that appears is said once, in its words;
every page has one first-level heading and every section title a level; no chart tells two series apart by colour
alone; a chart's keys move it and stay its own; every control that shows no text has a name; no colour is written
into a screen; every text reads against its background in both themes and after a theme switch; **Esc** closes the
open dialog without an answer; **Ctrl+1** … **Ctrl+5** open the pages in their order; the program declares it follows
each screen's scaling.
into a screen; every text reads against its background in both themes and after a theme switch, and under Windows'
four contrast themes and two edited ones is drawn in the theme's own colours at 4.5:1 or better; **Esc** closes the
open dialog without an answer, and a dialog gives the focus back; **Ctrl+1** … **Ctrl+5** open the pages in their
order and move the keyboard into them; a page slides in only while Windows' animation effects are on; the program
declares it follows each screen's scaling.
- **By hand**: the owner's pass of 2026-11-09 above, repeated for each release that changes a screen.
- **Not tested yet**: NVDA, JAWS, Voice Access, touch, Windows 10, and other people's PCs. They should work through the
same Windows interface Narrator uses, but nobody has checked.
same Windows interface Narrator uses, but nobody has checked. Contrast themes are checked by the tests above and have
not yet been looked at on a screen.
## Known limitations
@@ -104,13 +112,10 @@ Each one with what to do instead. A barrier that is not on this list is worth re
and the list of changes under a trend chart, and **File ▸ Export ▸ Session CSV** or **Session JSON**.
- **In the user guide and the other documents the app shows, headings are read as ordinary text**: Windows' document
view gives them no heading role. Their links and their order work as on any page.
- **Windows contrast themes are not followed.** With Settings ▸ Theme on *System*, a contrast theme can give parts of
the window the wrong colours. Choose **Light** or **Dark** there: both keep their contrast.
- **The short messages at the bottom of the window close after four seconds**, and cannot be read again once closed. A
screen reader is told each one as it appears.
- **Windows' text size setting** (Settings ▸ Accessibility ▸ Text size) **is not followed.** Use display scaling
(Settings ▸ System ▸ Display ▸ Scale) or Magnifier.
- **Page changes slide in** even when Windows' animation effects are off.
- **Pausing capture is only in the menu of the icon by the clock.**
- **The windows Windows itself shows** — choosing a file, the administrator prompt — are Windows', not FrameLedger's.
+1 -51
View File
@@ -35,63 +35,13 @@ numeric core and does not move; the heading is the full version — corrected 20
## [Unreleased]
### Added
- **An accessibility statement** (owner request 2026-11-09, decision D88). `ACCESSIBILITY.md` says what FrameLedger aims
for — WCAG 2.2 at level AA as W3C's WCAG2ICT applies it to desktop software, a goal and not a claim of conformance —
what works with the keyboard alone, a screen reader, a contrast theme or Magnifier, how it is checked (the project's
tests, and the owner's pass of 2026-11-09: keyboard only and Narrator on 0.1.0-beta.34 and 0.1.0-alpha.3, no fault),
what does not work yet and what to do instead, and how a barrier is reported and handled — by severity, with no
promised times. The app shows it under **Help ▸ Accessibility**, and after Limitations in the user guide's window; the
wiki gets an *Accessibility* page.
- **An *Accessibility problem* issue form** (`.github/ISSUE_TEMPLATE/accessibility.yml`) asking what was tried, what
happened and what the reporter uses — never anything about the reporter themself — and a user-interface section in the
pull-request template. The `accessibility` label exists, and so do `safety` and `priority-high`, which the *Safety gap*
form had named since its first day without either existing — so GitHub had never applied them.
- **A screen reader reads what the window shows** (decision D88's goal; measured in the UI Automation tree WPF builds on
every page, window and dialog, every tab — `PagesLoadTests.Automation`). Drop-down options were read as an internal
record (*Choice { Value = dark, Label = Dark }*), lists and table rows by their program names, table cells drawn by a
template as *Item: …, Column Display Index: n*, and the terms window's list by each document's whole text; each now
reads the words it shows, and an empty cell reads *empty*. The frame-rate readout says Native, Displayed and the
factor together (CLAUDE.md rule 6, in speech), a ray-tracing chip its value and where it came from, a change badge its
number. The safety notices' title and message reach a screen reader (they were hidden inside the notice's template),
and the notice's button says which notice it answers. A button repeated on each row names its row (*Open: …*, *Play:
…*, *Turn off: …*). Tab no longer stops on pictures, lists, Settings' rows, the FPS readout, the chips or the dialog
host, where it found nothing to say; an expander's button is named after its header.
- **A screen reader is told what appears** (owner decision D89): a safety notice as it arrives, the capture agent going
offline and coming back, an update's steps (not each percent), every short message at the bottom of the window, a
notice on a game's page and each result of Tools ▸ Database maintenance — in the words shown, and only while
FrameLedger's window is the active one, so a game that has the screen is never interrupted. The database line's live
region, which announced nothing, is gone.
- **Headings and charts a screen reader can use** (owner decision D90). Every page's title is a first-level heading and
each section title a second-level one, so a screen reader's heading keys move between sections. Every chart says what
it is and where its numbers are written as text; its keys — arrows to move, Ctrl with an arrow to zoom, A to see all of
it — now stay with the chart instead of also scrolling the page or moving the focus on, and its focus is drawn. No
chart tells two series apart by colour alone any more: Compare's five sessions, the GPU's temperature and its hot spot,
the two kinds of stutter, the two lows and the two limits each have their own line pattern, marker or hatch.
### Fixed
- **A double-click on a chart shows all of it again**, as the user guide said; it toggled ScottPlot's render-time overlay.
### Changed
- **Documents corrected**: charts do take focus and keys (`docs/08_UI.md` said neither — `ChartKeyboardTests` measures
it); the database-maintenance result's live region announced nothing, since WPF raises one only when the app does; the
"no Narrator pass" gap is the owner's pass now, beside what that pass could not show; the open question "Accessibility
/ DPI: no design anywhere" is closed; NFR-9 names screen readers and contrast themes (D88–D91). `LIMITATIONS.md` gains an
*Accessibility* section and loses its one struck sentence — a screen reader reads struck text as current, so no page
the app shows strikes text through. The guide's menu table names its menu on every row, read one row at a time.
## Releases
Newest first. Each file holds that release's section exactly as it stood here.
| Version | Date | Notes |
|---|---|---|
| `0.1.0-beta.35` | 2026-11-09 | [`docs/changelog/0.1.0-beta.35.md`](docs/changelog/0.1.0-beta.35.md) |
| `0.1.0-alpha.3` | 2026-11-06 | [`docs/changelog/0.1.0-alpha.3.md`](docs/changelog/0.1.0-alpha.3.md) |
| `0.1.0-beta.34` | 2026-11-06 | [`docs/changelog/0.1.0-beta.34.md`](docs/changelog/0.1.0-beta.34.md) |
| `0.1.0-alpha.2` | 2026-11-03 | [`docs/changelog/0.1.0-alpha.2.md`](docs/changelog/0.1.0-alpha.2.md) |
+1 -2
View File
@@ -5,7 +5,7 @@ hooking on for — and reading the graphics calls the game makes. That is why it
resolution, the upscaler, frame generation and ray tracing apart. It is also where its limits come from. This
page lists them in plain words; each item links to the document that has the details.
*Beta software: this page describes version 0.1.0-beta.34.*
*Beta software: this page describes version 0.1.0-beta.35.*
## Games it will not measure
@@ -210,7 +210,6 @@ a barrier is on its own page: [Accessibility](ACCESSIBILITY.md) (in the app: Hel
- **A chart's points cannot be read one by one.** A screen reader hears its name and where its numbers are written —
the session's figures, the tables, **File ▸ Export**; its keys move it.
- **Windows' text size setting is not followed** — use display scaling or Magnifier.
- **Windows contrast themes are not followed yet** — choose **Light** or **Dark** in Settings ▸ Theme.
## Play
+2 -2
View File
@@ -13,7 +13,7 @@ app too (Help ▸ User guide, Help ▸ Limitations, Help ▸ Accessibility), and
<!-- accuracy-block:begin -->
> ⚠ **What FrameLedger actually measures today — 2026-11-06.** The software is a beta; its latest
> **beta is `0.1.0-beta.34`** (2026-11-06), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.35`** (2026-11-09), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds on a prerelease .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
@@ -177,7 +177,7 @@ Elevation is **optional — for everything.** Hooked capture is the normal path
## Install
> **The latest beta is `v0.1.0-beta.34` (2026-11-06); before it `v0.1.0-beta.33` (2026-11-03), `v0.1.0-beta.32` (2026-10-31), `v0.1.0-beta.31` (2026-10-26), `v0.1.0-beta.30` (2026-10-26), `v0.1.0-beta.29` (2026-10-25), `v0.1.0-beta.28` (2026-10-20), `v0.1.0-beta.27` (2026-10-20), `v0.1.0-beta.26` (2026-10-19), `v0.1.0-beta.25` (2026-10-19), `v0.1.0-beta.24` (2026-10-19), `v0.1.0-beta.23` (2026-10-14), `v0.1.0-beta.22` (2026-10-13), `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read the notes of the one you install — `CHANGELOG.md` links each release's own file under `docs/changelog/` — for what it measures, what it does not yet, and how to update, before installing. A source build is `docs/12_BUILD.md`.
> **The latest beta is `v0.1.0-beta.35` (2026-11-09); before it `v0.1.0-beta.34` (2026-11-06), `v0.1.0-beta.33` (2026-11-03), `v0.1.0-beta.32` (2026-10-31), `v0.1.0-beta.31` (2026-10-26), `v0.1.0-beta.30` (2026-10-26), `v0.1.0-beta.29` (2026-10-25), `v0.1.0-beta.28` (2026-10-20), `v0.1.0-beta.27` (2026-10-20), `v0.1.0-beta.26` (2026-10-19), `v0.1.0-beta.25` (2026-10-19), `v0.1.0-beta.24` (2026-10-19), `v0.1.0-beta.23` (2026-10-14), `v0.1.0-beta.22` (2026-10-13), `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read the notes of the one you install — `CHANGELOG.md` links each release's own file under `docs/changelog/` — for what it measures, what it does not yet, and how to update, before installing. A source build is `docs/12_BUILD.md`.
1. Download the latest `FrameLedger.App-win-Setup.exe` from [Releases](https://github.com/poli0981/frameledger/releases). It installs into `%LOCALAPPDATA%\FrameLedger.App`; your data stays in `%LOCALAPPDATA%\FrameLedger`, and uninstalling asks before touching it.
2. SmartScreen may warn — releases are not code-signed (free, open-source project). Verify the SHA-256 checksum published with each release, then **More info → Run anyway**.
+56 -5
View File
@@ -3,7 +3,7 @@
WPF + **WPF UI (Wpf.Ui, Fluent)**. Shell = `ui:FluentWindow` with custom `ui:TitleBar`, a thin classic **Menu bar** (file-level operations), and a left **`ui:NavigationView`** (`PaneDisplayMode="LeftFluent"`) as primary navigation *(since beta.34, D86, its items use
our copy of WPF UI 4.3.0's LeftFluent item template — `FlLeftFluentNavigationViewItemTemplate` in `Styles/FrameLedger.xaml` —
whose only change is that the selected page keeps its label; WPF UI's animates it away, and the owner's screenshot of
Compare showed the icon alone)*. Light/Dark/System themes via `ApplicationThemeManager` + `SystemThemeWatcher`; Mica backdrop on Windows 11 with automatic solid fallback on Windows 10. All XAML follows `16_WPFUI_SYNTAX.md` — that doc is mandatory reading before writing views.
Compare showed the icon alone)*. Light/Dark/System themes via `ApplicationThemeManager` + `SystemThemeWatcher`; Mica backdrop on Windows 11 with automatic solid fallback on Windows 10. *(beta.35, D91: a Windows contrast theme wins over all three while it is on — §Contrast.)* All XAML follows `16_WPFUI_SYNTAX.md` — that doc is mandatory reading before writing views.
## Shell
@@ -883,7 +883,7 @@ Tail view of `ui-*.log` / `agent-*.log` (toggle), level filter, search (`ui:Auto
> (`Settings_RemoveUninstalled_Applied`), not at the next session — the detection sweep reads it at every pass. Tests:
> `ViewerModeTests.EverySettingTheAgentReadsIsOffInAViewer`, `GuideDocumentsTests.TheSettingsPageOfTheGuideNamesEverySetting`.
Sections per FR-10 using the WPF UI settings idiom: `ui:CardControl`/`ui:CardExpander` rows with `ToggleSwitch`, `ComboBox`, `ui:NumberBox` (numeric inputs — min session length, sensor interval, retention). Language switch applies immediately (09_I18N). Theme selector (Light/Dark/System) drives `ApplicationThemeManager` (16 §Theming). **Capture section (top, most important):** the global **hooking kill switch** (`ToggleSwitch`, prominent) with a one-line summary of what it does; a list of games currently hook-enabled with a per-game revoke; Vulkan layer registration state + Register/Unregister; a link to the safety documentation. Turning the global switch off must take effect immediately, including for the Vulkan layer.
Sections per FR-10 using the WPF UI settings idiom: `ui:CardControl`/`ui:CardExpander` rows with `ToggleSwitch`, `ComboBox`, `ui:NumberBox` (numeric inputs — min session length, sensor interval, retention). Language switch applies immediately (09_I18N). Theme selector (Light/Dark/System) drives `ApplicationThemeManager` (16 §Theming) *(beta.35, D91: a Windows contrast theme wins while it is on, §Contrast, and a line under the selector says so, bound to `ContrastTheme.IsOn` so it comes and goes with the page shown)*. **Capture section (top, most important):** the global **hooking kill switch** (`ToggleSwitch`, prominent) with a one-line summary of what it does; a list of games currently hook-enabled with a per-game revoke; Vulkan layer registration state + Register/Unregister; a link to the safety documentation. Turning the global switch off must take effect immediately, including for the Vulkan layer.
**System (2026-09-21, FR "show the user's hardware"):** a card above Legal stating this PC as a session's hardware snapshot would record it right now — processor, graphics card, graphics driver, memory, Windows build, primary display — through the same `IHardwareSnapshotSource` the Agent stamps sessions with, read on the thread pool when the page opens, a field that could not be read as N/A, with **Copy** (the same lines as text) and a note that nothing is sent anywhere and what CPU temperature needs. Its own `SystemInfoViewModel`, not `SettingsViewModel`'s. The same snapshot is one tertiary line under the session summary's header (it was loaded for the export and shown nowhere), and `--diag` prints it; the bug bundle's `sysinfo.json` is deliberately NOT given it — its keys are the issue link's prefill.
@@ -1030,7 +1030,7 @@ the requirement was one bullet under §UX rules, and nothing checked it.
| Keys | Does | Where |
|---|---|---|
| **Ctrl+1 … Ctrl+5** (and the numeric keypad's 1–5) | Dashboard · Games · Compare · Logs · Settings | `MainWindow` `InputBindings` → `MainWindowViewModel.NavigateToCommand` → `ShellShortcuts` |
| **Ctrl+1 … Ctrl+5** (and the numeric keypad's 1–5) | Dashboard · Games · Compare · Logs · Settings — and since beta.35 the page's first control takes the focus once it is shown, its title (the page's first-level heading) said to a screen reader; before, the focus stayed where it was, often on the page that had just gone | `MainWindow` `InputBindings` → `MainWindowViewModel.NavigateToCommand` → `ShellShortcuts`, then `Services/PageFocus` (the shell tells it each page shown, from `NavigationView.Navigated`) |
| **Alt**, **F10** | Focuses the menu bar; arrows and Enter walk File / Tools / Help | WPF `Menu`, nothing custom |
| **Alt** + a menu's access key | Opens that menu — `_File` `_Tools` `_Help`; `_Tệp` `_Công cụ` `Trợ _giúp`; `ファイル(_F)` `ツール(_T)` `ヘルプ(_H)` *(row added 2026-11-09: the keys existed since P3 and this table did not name them)* | the `Menu_*` strings' `_` |
| **Tab / Shift+Tab** | Moves through a page in reading order | layout order; no `TabIndex` overrides |
@@ -1039,6 +1039,17 @@ the requirement was one bullet under §UX rules, and nothing checked it.
| **Esc** | Closes the open `ContentDialog` or `MessageBox` with no result — the same as its Close/Cancel button | `DialogKeyboard`, one class handler per dialog type registered at start-up |
| **Enter** | In the consent dialog's phrase box: enables hooking once the phrase is typed exactly, does nothing before (beta.30, D69); elsewhere in a `ContentDialog`, the default button | WPF's default button (`ConsentPrompt`: `DefaultButton = Primary`) and `ConsentDialogContent.SwallowsEnter` |
**Focus after a dialog, and motion (beta.35).** A `ContentDialog` gives the focus back to the control that opened it: WPF
UI 4.3.0's `ContentDialogHostController` stores `Keyboard.FocusedElement` when the dialog opens and focuses it again, at
`DispatcherPriority.Input`, when it closes — the App adds nothing, and
`FocusAndMotionTests.AContentDialogGivesTheFocusBackToTheControlThatOpenedIt` holds it (a first measurement said
otherwise; it ran on a thread with no dispatcher context, where the dialog's own `finally` never resumed). A WPF UI
`MessageBox` sets no owner — null before and after it is shown — so `Services/MessageBoxes` gives it the App's active
window: it opens over it and hands the focus back to it, not to another program; every box goes through it
(`EveryMessageBoxGoesThroughMessageBoxes`). A page slides in only while Windows' animation effects are on
(`SystemParameters.ClientAreaAnimation`, followed as it changes): `Services/PageMotion` sets the `NavigationView`'s
`Transition` to `None` while they are off, where WPF UI 4.3.0 played `FadeInWithSlide` whatever they were.
**Esc is the Close button, never the primary one.** On the consent dialog (FR-2.1) that is ~~"Keep it off"~~ "Keep hooking
off" *(the button's text, corrected 2026-10-07)*: nothing is
stamped. A dialog that offers no Close button is not dismissed by Esc, and the Legal Gate (FR-11) is a window of its own
@@ -1190,6 +1201,45 @@ theme's background, as it was before; the badge and the list carry its informati
> under it, in both themes. `EveryTextFollowsAThemeSwitch` hosts its pages in the presenter too since, and went red with
> them: a page made after a switch stayed black. All three went red on the unfixed XAML before they went green.
> **Windows contrast themes, followed (beta.35, owner decision D91).** WPF UI 4.3.0 cannot be asked to do it:
> `ApplicationTheme.HighContrast` names no dictionary; its four high-contrast files (HC1 Dusk, HC2 Night sky, HCBlack
> Aquatic, HCWhite Desert) each hold 84 red `#FFFF0000` placeholders among 97 colours and 17 brushes that throw when the
> file is read alone; their colours are Windows 11's defaults, not the user's; and they put the window text on the accent.
> So while `SystemParameters.HighContrast` is on, `Services/WpfThemeApplier` applies the light or the dark Fluent theme as
> the contrast theme is (by its window colour), with no Mica and no `SystemThemeWatcher`, and `Services/ContrastOverlay`
> over it: every key of those four files in the user's colour for its role (`Services/ContrastRoles` — a key's role is the
> colour it has in all four, opaque colours only, because inside the App a brush that throws alone falls back to the
> Fluent theme's translucent fill: `MenuBarItemBackgroundPressed` read as the white of the window text, and a pressed menu
> item was white on white; ties and placeholders by the key's name), the keys transparent there transparent, three
> Fluent-only keys by role, the 21 accent keys WPF UI writes into the application's resources as the highlight, and the
> text on the accent as the highlight's text. The colours are `SystemColors` (`ContrastPalette.FromSystem`) — the user's
> own, edited or not, Windows 10's as well — and turning a theme on, editing it or turning it off is followed at once
> (`SystemContrastSource`). What the App draws itself reads `ContrastTheme.Active`: the charts (`ChartPalette.ForContrast`,
> the theme's colours only, the series told apart by `ChartPatterns`), a badge's text (`ChartTheme.TextOn`, the theme's
> colour that reads best on the fill), the mix bar, the artwork band (no tint), the Import list (no dimmed rows), the
> unsigned-update footer (the secondary text style, not an opacity). WPF UI's Danger button paints a fixed `#F44336` in its
> style, out of any resource's reach, so every `ui:Button` takes the App's implicit style (`Styles/FrameLedger.xaml`): a
> Danger button is the theme's own button while one is on, the message boxes' Delete included. Held by `ContrastThemeTests` — the four files still placeholders; every key a role or
> transparent, none red; the roles the same over either Fluent theme; with each default theme's own colours the overlay
> is WPF UI's colours key for key, the text on the accent apart; an edited theme's colours reach every key; every Fluent
> colour key covered; every resource the App reads resolves; `ThemePlan`; the applier on and off at once — and
> `PagesLoadTests.EveryTextIsInTheContrastThemesColoursAndReadable`: every surface rendered under the four default themes
> and two edited ones, every text the theme's colour on the theme's colour at 4.5:1 or better. It went red first on the
> chips (window text on the highlight, 1.26–1.78:1), the Remove button (3.06–4.42:1 on `#F44336`) and the badges' black.
> **A sixth hole, closed 2026-11-09 (beta.35), found by measuring what no sweep renders.** The title bar and the snackbars
> are no surface, and the 3:1 sweep let 3.68:1 pass. The capture agent's pill was a `ui:Badge` whose appearance was
> BOUND — Success, Info, Caution, Danger, WPF UI's `Palette*Brush` under `BadgeForeground` — so `ContrastTests`, which reads
> literal attributes, never saw it: in the light theme 2.78, 2.63, 2.16 and 3.68:1. It is `AgentPill` now (a `Pill` on
> `SystemFillColor{Success,Caution,Critical}BackgroundBrush`, the theme's text), and a bound badge appearance is refused.
> WPF UI's Success and Caution snackbars are fixed colours under white in both themes, 2.78:1 and 2.16:1: the strip shows
> every message as Secondary, the theme's, 13.97:1 and 16.53:1, its icon saying the kind. And a Danger button's text was
> the theme's button text on `#F44336` — white in the dark theme, 3.68:1: the App's implicit button style puts
> `TextFillColorDarkPrimaryBrush` there, 5.3:1 and 5.7:1. `ContrastThemeTests.TheTitleBarsMarksReadInEveryState`,
> `ADangerButtonReadsInBothThemesAndIsTheThemesOwnButtonUnderAContrastTheme`,
> `NoButtonOrBadgeTakesAnAppearanceThatPaintsAFixedColour` and
> `AnnouncementsTests.EveryMessageOfTheStripIsDrawnInTheThemesOwnColours` hold the three.
### DPI
`app.manifest` declares Per-Monitor V2 (`AccessibilityTests.TheManifestIsPerMonitorV2`). A chart reads the pointer
@@ -1215,6 +1265,7 @@ ScottPlot reads once when the control is made, before it has a window.
chart, the FPS readout, the RT/PT/RR chips, the game's artwork — is a Tab stop Narrator says nothing about; text inside
a control template (the safety notices' title and message, the readout, the chips) is hidden from the control view;
nothing is announced; no text is a heading; several charts tell series apart by colour alone~~ *(closed the same day,
§Screen readers above)*; page transitions play with Windows' animation effects off; Windows contrast themes are not
followed. `ACCESSIBILITY.md` §Known limitations
§Screen readers above)*; ~~page transitions play with Windows' animation effects off~~ *(not since beta.35,
§Keyboard)*; ~~Windows contrast themes are not
followed~~ *(followed since beta.35, D91 — §Contrast)*. `ACCESSIBILITY.md` §Known limitations
states each to users with what to do instead.
+27 -1
View File
@@ -62,6 +62,7 @@ private static readonly IHost _host = Host.CreateDefaultBuilder()
Theme rules:
- Manual Light/Dark: `ApplicationThemeManager.Apply(ApplicationTheme.Dark)`.
- System: `SystemThemeWatcher.Watch(mainWindow)` — call it in the window's `Loaded` handler (needs an HWND), and unwatch when switching to manual.
- A Windows contrast theme (beta.35, D91): wins over all three while it is on, and is never left to the watcher, which would apply WPF UI's own high-contrast files (§Gotchas). `Services/ThemePlan.For` is the table, `Services/WpfThemeApplier` applies it.
- Persist the choice in `settings`; re-apply before the main window shows to avoid a flash. **Measured 2026-09-13: this is a correctness rule, not a cosmetic one** — `ApplicationThemeManager.Apply(theme, backdrop, updateAccent: true)` is what registers the `SystemAccentColor*` resources the control templates `StaticResource` at first Measure; a `FluentWindow` shown before any `Apply` throws `XamlParseException: Cannot find resource named 'SystemAccentColorPrimary'`. The shell applies the theme in its constructor before `InitializeComponent()` and again from `Loaded` for the watcher.
- Subscribe `ApplicationThemeManager.Changed` once, centrally, to re-theme ScottPlot (below).
@@ -172,6 +173,22 @@ Native `Menu`, `TabControl`, `ComboBox`, `Slider`~~, `ListView`~~ are fine — t
WCAG contrast, black in both themes. The chart reads `ChartTheme.Current` at every render; the WPF chip in the list
(`Controls/ChangeBadge`) follows a switch through the same resource reference as `ArtTint` and `FgMixBar`
(`ChartPalette.ForBackground`). No colour in XAML.
- Third exception (beta.35, D91): **a Windows contrast theme's colours**, read from `SystemColors` in one place
(`Services/ContrastPalette.FromSystem`) and laid over the theme by `Services/ContrastOverlay` — never written in XAML. A
colour the App works out itself reads `Services.ContrastTheme.Active` first (the charts, the badges, the artwork band);
XAML that must change with it binds `{Binding Path=(services:ContrastTheme.IsOn)}`, a static property WPF hears through
its `StaticPropertyChanged` event.
- **`ui:Button Appearance="Danger"` / `Info` / `Success` / `Caution` / `Dark` / `Light` paint fixed colours** — values in
WPF UI 4.3.0's button style (`#F44336` for Danger), not resources, so no theme and no contrast theme reaches them, under
the theme's button text (white on the red in the dark theme, 3.68:1). Danger is the one the App uses: its implicit
`ui:Button` style (`Styles/FrameLedger.xaml`) puts the theme's dark text on the red, and the theme's own button under a
contrast theme — message boxes' buttons included. The other five are refused
(`ContrastThemeTests.NoButtonOrBadgeTakesAnAppearanceThatPaintsAFixedColour`).
- **A snackbar's appearances are fixed colours too** (`ISnackbarService.Show`): Success, Caution, Info, Danger, Primary,
Dark and Light are values under white or black text — Success 2.78:1, Caution 2.16:1 in both themes. Only Secondary is
the theme's: `Services/SnackbarStrip`, the one place a snackbar is shown, uses it for every message.
- **A `ui:Badge` with a BOUND palette appearance** is the same hole as a literal one, and no XAML scan of literals sees it
(the agent's pill, beta.35: `AgentPill` now). A bound badge appearance is refused by the same test.
## FlowDocument (rendered documents, beta.12)
@@ -242,7 +259,9 @@ On startup and on `ApplicationThemeManager.Changed`: for every live plot set fig
> `ChartTheme.Attach` adds `Charts/ChartKeys` (arrows and A marked handled after ScottPlot's class handler has acted — an
> instance handler runs after it) and `ResetOnDoubleClick` (`DoubleLeftClickBenchmark(false)` and a `DoubleClickResponse` on
> the left button that autoscales). A series takes `ChartPatterns.Line` / `Points` / `Hatch` by its index — a new series
> without one is red in `NoChartTellsTwoSeriesApartByColourAlone`.
> without one is red in `NoChartTellsTwoSeriesApartByColourAlone`. Under a Windows contrast theme `ChartTheme.Current` is
> `ChartPalette.ForContrast(ContrastTheme.Active)` — the theme's window under every plot, its text, link, highlight,
> button text and disabled text for the rest — and the patterns carry the series apart (D91).
>
> **The trend's change markers, beta.30 (D70):** `Charts/ChangeMarkerPlottable`, an `IPlottable` + `IRenderLast` added
> with `Add.Plottable` (which assigns no axes: the chart sets `Axes.XAxis`/`YAxis` itself), draws the dashed lines in
@@ -264,6 +283,13 @@ On startup and on `ApplicationThemeManager.Changed`: for every live plot set fig
- [ ] **`WpfPlot.DisplayScale` is read once, in the constructor**, from `VisualTreeHelper.GetDpi` before the control has
a window. Read a pointer with `GetPlotPixelPosition(e)` (the element's DPI now); ScottPlot's pixels are device
pixels while no `Plot.ScaleFactor` is set, and none is.
- [ ] **WPF UI 4.3.0's high-contrast theme cannot be applied as it is** (beta.35, D91). `ApplicationTheme.HighContrast` has
no dictionary (the watcher picks HC1/HC2/HCBlack/HCWhite by Windows' theme name); each of those holds 84 `#FFFF0000`
placeholders among 97 colours and 17 brushes (`SystemFillColor*Brush`, `MenuBar*`) that throw when the file is read
alone — inside the App their forward references fall back to the application's resources and read as the Fluent
theme's fills; their colours are Windows 11's defaults, not the user's; their text on the accent is the window text.
Never let `SystemThemeWatcher` watch while a contrast theme is on: it would apply them. The App reads them for each
key's role only (§Theming & brushes; `08_UI` §Contrast).
- [ ] `SystemThemeWatcher.Watch` after HWND exists (`Loaded`), not in the constructor — but `ApplicationThemeManager.Apply(…, updateAccent: true)` BEFORE the first window's XAML loads, or the accent resources are missing at first Measure (§App bootstrap).
- [ ] Menu row lives **outside** `ui:TitleBar` (its area is the drag region; a Menu inside becomes undraggable/unclickable territory).
- [ ] Don't set `AllowsTransparency`/`WindowStyle` on `FluentWindow` — it manages its own chrome.
+80 -76
View File
@@ -73,6 +73,7 @@ owner-only items stay below; the history of every train, the passed owner-only i
| `§beta.31` | [`handoff/history/0.1.0-beta.31.md`](handoff/history/0.1.0-beta.31.md) |
| `§beta.32` | [`handoff/history/0.1.0-beta.32.md`](handoff/history/0.1.0-beta.32.md) |
| `§beta.33` | [`handoff/history/0.1.0-beta.33.md`](handoff/history/0.1.0-beta.33.md) |
| `§beta.34` | [`handoff/history/0.1.0-beta.34.md`](handoff/history/0.1.0-beta.34.md) |
| `§Owner-only`, an open item | [§Owner-only](#owner-only--no-pr-can-close-these) below |
| `§Owner-only`, a passed item (3, 12, 14–19) | [`handoff/owner-only-passed.md`](handoff/owner-only-passed.md) |
| `§Traps`, `§Two corrections carried forward` | [`handoff/traps.md`](handoff/traps.md) |
@@ -80,92 +81,76 @@ owner-only items stay below; the history of every train, the passed owner-only i
---
## **START HERE** — 2026-11-06, 0.1.0-beta.34: DLSS 5 and DLSS 4.5 from what the game and the driver did; filters; Games at once
## **START HERE** — 2026-11-09, 0.1.0-beta.35: accessibility — a statement, what a screen reader is given and told, headings and charts, contrast themes, focus
*Status is `docs/changelog/0.1.0-beta.34.md`; this is what no other file carries.* The owner asked for seven things, the
usual train: (1) how DLSS 5 Neural Rendering is detected on Hogwarts Legacy (Neural Rendering on in the game), and its
version; (2) under the NVIDIA App's *Dynamic* multi frame generation the label read DLSS 4, though Dynamic and ×6 exist
only in DLSS 4.5 (Phantom Blade Zero); (3) filters on Games and Compare; (4) the Compare page's layout, from a
screenshot; (5) the documents and the tested-games list, from the database; (6) switching to Games stalled 0.5–1.5 s;
(7) a language change landed on the last content page instead of Settings. And while planning: "Bạn check Streamline các
bản gần đây có gì thay đổi và sửa luôn nếu thật sự cần nhé." — check what changed in recent Streamline versions and fix it
if really needed. #356 (two fixes from a self-review of #351 and #352), #357 (D83), #358 (D84, Streamline `v2.14.16`),
#359 (items 6 and 7), #360 (items 3 and 4, D85, D86), #361 (item 5) and this release; `0.1.0-alpha.3` follows (D87) —
the owner's screenshot is of an alpha, so the alpha is how these reach the owner's PC.
*Status is `docs/changelog/0.1.0-beta.35.md`; this is what no other file carries.* The owner: "Bạn lên plan và thêm
phiên bản mới (nếu thực sự cần) cho mục accessibility: 1. đọc docs, check, sync và sửa, cập nhật thêm file
ACCESSIBILITY.md vào đúng vị trí. 2. Check các Accessibility đã có, đề xuất thêm accessibility nếu cần. 3. Đã dùng: bàn
phím only (tắt chuột) và narrators, không lỗi." — plan accessibility, with a new version if it is really needed: read,
check, sync and fix the documents and add `ACCESSIBILITY.md` where it belongs; check what exists and propose more; the
owner had used the keyboard alone, mouse disconnected, and Narrator, with no fault. With opensource.guide's
accessibility practices and the open-source-accessibility toolkit's `ACCESSIBILITY.md` template (MIT: its structure,
not its text). #366 (the statement, D88), #367 (names and peers), #368 (announcements, D89), #369 (headings and charts,
D90), #370 (contrast themes, D91, and three contrast holes outside them), #371 (focus and motion) and this release; no alpha (D92).
**Decisions (asked while planning, do not re-ask):**
- **D83 — Dynamic frame generation is DLSS 4.5's**: the owner's rule, "Dynamic and ×6 exist only in DLSS 4.5". The
evidence is the game's driver profile setting Dynamic (`NGX_DLSSG_MODE` = 4) **and** the driver reporting its
frame-generation override applied in the game's process (`FG_MODE` in its FG word), in a session where DLSS
Frame Generation was identified (`fg_mode = dlssg`; its factor need not have been counted); a state measured at ×5 or more still ranks first, and a *Fixed* multiplier names nothing by itself
(amends D64). The driver's `frameGenerationMode` — 3 under Dynamic and 1 under Fixed in every session read, and unnamed
by NVIDIA — is recorded in `spike-notes` §26, not keyed on.
- **D84 — DLSS 5 is the session's generation where its neural rendering was measured running**: the Overlay decodes
`kFeatureDLSS_NR` in its `slEvaluateFeature` detour and the Agent keeps its share of the Streamline batches
(`sessions.dlss_nr_pct`, schema 0022) — *DLSS 5 (neural rendering on N % of rendered frames)*; loaded and seen not
running, *runtime loaded, not seen running*; where nothing could tell, *runtime loaded*, as before (amends D64).
- **D85 — the filters**: Games — store, engine, state, installed, played; Compare — game, tier, frame generation, no
period; Compare lists every session (it listed the newest 200).
- **D86 — the left pane's selected item keeps its label**: our copy of WPF UI 4.3.0's LeftFluent item template, whose
`IsActive` trigger animated it away.
- **D87 — alpha.3 right after beta.34**, on RC3: the train reaches it before .NET 11's release on 2026-11-10.
Streamline was re-vendored at `v2.14.16` on the owner's instruction above, not as a decision of its own. The wording of
the Disclaimer 2.13 and the Privacy Policy 2.14, and the tested-games list (D35), were approved with the plan (D36).
- **D88 — the accessibility statement**: `ACCESSIBILITY.md` at the repository's root, in the App under Help ▸
Accessibility and on the wiki. WCAG 2.2 at level AA, as W3C's WCAG2ICT applies it to desktop software, is a goal and
never a claim; a report is handled by severity, with no promised times; the owner's pass of 2026-11-09 — keyboard only
and Narrator, on 0.1.0-beta.34 and 0.1.0-alpha.3, no fault — is its first evidence by hand.
- **D89 — what appears is said to a screen reader**: UI Automation notifications for a safety notice, the agent's and
the update's banners, every snackbar, a game page's notice and Database maintenance's results, only while
FrameLedger's window is the active one.
- **D90 — headings and charts**: a page's title is a heading of level 1, a section's title level 2; every chart is
named with where its numbers are written; no chart tells two series apart by colour alone.
- **D91 — Windows contrast themes are followed**, whatever Settings ▸ Theme says.
- **D92 — beta.35 in this train and no alpha**; alpha.4 is the move to .NET 11's release (SDK `11.0.100`, packages
`11.0.0`), a task of its own after 2026-11-10.
**Choices made here:**
- **Neural rendering's share is over the Streamline batches**, not every present: a generated frame evaluates nothing,
and a title that never drains a batch reads *nothing could tell* (null), never 0 %.
- **A writer older than beta.34 is told apart by its family bit**, `FL_HOOK_SL_NEURAL_RENDERING` (bit 12), published with
the detour — an old Overlay's silence leaves `dlss_nr_pct` null instead of a measured 0 %; no layout change.
- **The Games page is the window's**, kept by our own page provider (`WindowPageCache`), not `NavigationCacheMode`: WPF UI
4.3.0 reads that only when neither a service provider nor a page provider is set, and `SetNavigationControl` sets one
(`16_WPFUI_SYNTAX` §Navigation). One per window, so a language change's window builds its own.
- **The cards come before the executable checks** — 39 of the owner's 41 Steam games are on a USB drive that sleeps — and
each card gets its *Not installed* pill when its check answers.
- **The pane's item template is a copy changed in one place**, reading WPF UI's own `NavigationViewConstants.xaml`: before
the WPF UI pin moves, the upstream template is read again.
- **A contrast theme is the user's colours by role**, not WPF UI's high-contrast files (84 red placeholders among 97
colours, 17 brushes that throw, Windows 11's defaults) and not a hand list of keys: every key of the four files takes
the colour of the role it has in all of them, opaque colours only (`ContrastRoles`), over the light or the dark Fluent
theme as the contrast theme is; the text on the accent is the highlight's text, the App's choice.
- **What must change while it is shown binds `ContrastTheme.IsOn`**, a static property WPF hears through
`StaticPropertyChanged`: the implicit button style, the Settings line. The charts, the badges and the artwork band read
`ContrastTheme.Active` when they draw.
- **The snackbars lost their green and orange** (white on fixed colours, 2.16–2.78:1 in both themes): every message is
Secondary, its icon saying the kind. **The agent's pill is a `Pill` on the theme's fills**, no longer a badge.
- **A content dialog's focus is WPF UI's**: its host stores and restores the focused element; a test pins it. Message
boxes get the App's active window as owner (`MessageBoxes`), which WPF UI's leaves null.
- **A page shortcut focuses the page's first control and says its first level-1 heading** (`PageFocus`); a click in the
pane leaves the focus where WPF UI puts it.
- **Left as limitations, with what to do instead** (`ACCESSIBILITY.md` §Known limitations): a chart's points one by
one, headings inside the documents the App shows (a FlowDocument paragraph has no peer), the snackbars' four seconds,
Windows' text size, pausing only from the tray.
**Measured on the way:** the owner's DLSS sessions of 2026-11-01 → 11-06, the driver's frame-generation numbering and
Streamline's `v2.12.0` → `v2.14.16` changes are `spike-notes` §26 (the ledger read read-only; the vendored copy was
`v2.12.0` byte for byte); the Games page before and after is §27 (first cards 822–830 ms → 10–15 ms with the first
executable check held 800 ms; a revisit 181–215 ms → 15–16 ms). The neural-rendering decode costs nothing measurable in
the detour and 0.14–0.19 ns on the present's feature byte (#358's body; NFR-1's budget is 1 µs per present).
**Measured on the way:** the UI Automation tree WPF builds, on .NET 10.0.14 — items named by `ToString()`, peerless
focusable controls, a template's text hidden from the control view, template cells read as *Item: …* (`16_WPFUI_SYNTAX`
§Gotchas); WPF UI 4.3.0's high-contrast files, its Button, Badge and Snackbar appearances (fixed colours, the ratios
above), its message box's missing owner and its content dialog host's focus restore; ScottPlot 5.1.59's keys (focusable,
none marked handled) and its double-click benchmark.
**Traps met on the way:**
- **`notice-check` reads the tracked tree**: a file deleted from the working tree but not from the index fails it with
*Could not find file* — after every build and test had passed (#360's first local gate). Stage the change
(`git add -A`) before the gate.
- **A new hook family bit belongs in the native token test's exact mask** (`guard_test.cpp`), and a new Streamline fact
in the 0xF00D case's list of facts it must not light — #358's first gate (`0x100f` against `15`).
- **WPF UI 4.3.0**: `NavigationCacheMode` is ignored once a page provider is set; `INavigationService.SetNavigationControl`
hands the NavigationView the container's provider, so ours is set after it; LeftFluent's item template collapses the
selected item's label.
- **Microsoft.Data.Sqlite's async methods run synchronously**: a read awaited on the UI thread blocks it — `Task.Run` it.
- **A `ContentDialog` test needs the dispatcher's context.** `ContentDialog.ShowAsync` takes the dialog out of its host
in a `finally` after an await; on a test thread with no `DispatcherSynchronizationContext` that never resumes on the UI
thread, the dialog stays in its host and the focus on its button — a first measurement concluded WPF UI kept the focus
there; it does not.
- **A test that listens to a static event hears every test's**: subscribe inside the one STA work item.
- **Inside the App, a brush that throws when WPF UI's file is read alone falls back to the application's resources**, the
Fluent theme's translucent fills: `MenuBarItemBackgroundPressed` read as the window text's white. Count only opaque
colours as evidence.
- **WPF calls a resource reference's callback when a merged dictionary changes, even for an equal value** (Aquatic's
window is the dark theme's `#202020`): no second signal was needed, measured and pinned.
- **A forward `StaticResource` in a style dictionary fails only when that resource is first used** — `AgentPill`
`BasedOn` `Pill`, placed above it: the dictionary loaded, the style threw when found.
- **Python's `"\b"` in a non-raw string is a backspace** — it went into a C# regex twice; write regexes raw.
- **`RenderTargetBitmap.Render(child)` draws the child at its offset**: sample a child's pixel through its parent.
**Owner-only:** item 30 — beta.34 on real hardware.
### 0.1.0-alpha.3 — the third alpha, the same day (D87)
`alpha` takes main at this pull request — `v0.1.0-beta.34` and these notes, no other change — by a merge commit, as
`13_CI_CD` §The alpha line says. One file the switch holds moved on main — `legal/THIRD_PARTY_NOTICES.md`, its
Streamline row (#358) — on a line the switch does not touch (the switch changes the *Transitive* row), so the merge
takes both without a conflict (`git merge-tree` before the pull request); main's package set did not move, and the
switch stays the first alpha's (SDK `11.0.100-rc.3.26522.148`, the three packages at `11.0.0-rc.3.26522.148`, the same
NuGet licence texts) — the train reached it before .NET 11's release. Its gate on the 11 SDK must pass before the pull
request into `alpha` is merged by
hand (the branch has no auto-merge); the release runs from the signed tag `v0.1.0-alpha.3` on `alpha`, with its delta
from alpha.2. Its notes are `docs/changelog/0.1.0-alpha.3.md`, which open with the experimental-build warning. It is
the first alpha whose ledger moves (schema 22): the copy it makes first is the database as alpha.2 left it, and going
back is to the newest beta, which opens schema 22.
- **The next alpha moves to .NET 11's release**: from 2026-11-10 the switch is SDK `11.0.100` and the packages `11.0.0`,
and RC3 is out of support — move the alpha even if no beta comes.
**Owner-only:** item 31 — the third alpha on real hardware.
**Owner-only:** item 32 — beta.35 on real hardware.
## Owner-only — no PR can close these
@@ -396,6 +381,20 @@ back is to the newest beta, which opens schema 22.
window shows the Disclaimer 2.13, the Privacy Policy 2.14 and the Alpha notice with its box again, and Accept waits for
the tick. (c) `%LOCALAPPDATA%\FrameLedger\backups\ledger-before-0.1.0-alpha.3.db` exists beside alpha.2's, and opens;
the ledger it left is at schema 22. (d) Item 30's checks, on the alpha.
32. **beta.35 on real hardware** (D88–D91). (a) **The update from beta.34** (or alpha.3's): no terms window, the ledger
unchanged. (b) **Narrator**: a safety notice is read as it appears; the agent's banner going and coming; Tools ▸
Database maintenance ▸ Check reads its result; a short message at the bottom is read; **H** moves between each page's
title and its sections; Settings ▸ Theme's options read their words; the Sessions table's cells read their values;
Tab to a chart says its name and where its numbers are, and its arrows, Ctrl+arrows and A move it without scrolling
the page; a double-click shows all of it. (c) **Contrast themes**: Aquatic and Desert, and one with an edited colour
(Windows 10 if at hand) — every page, a dialog, the title bar's agent pill, a short message, a chart; turned on and
off with FrameLedger open, it follows at once; Settings ▸ Theme shows its line. (d) **Ctrl+1 … Ctrl+5** put the
keyboard in the page and Narrator says its title. (e) **Animation effects off** (Settings ▸ Accessibility ▸ Visual
effects): no page slides in. (f) **Remove** on a game's page: the box opens over the window, its Cancel puts the focus
back on Remove; the light theme's agent pill and a *done* message read clearly. (g) Help ▸ Accessibility shows the
statement. (h) The 35 `ja` strings this release adds, all marked `review`: `Menu_Help_Accessibility`,
`Accessibility_Title`, `Settings_Theme_ContrastOn` and 32 `A11y_*` (the names, the chart names and keys, the
announcements).
**Answered 2026-08-05, do not re-ask:** remove `gameguard` and keep `guard` (approved
over a red `Rules` gate, with the reasoning recorded in the merge commit); vendor NVAPI
headers **and** `amd64/nvapi64.lib`; Windows 11 is the **measurement scope** only —
@@ -491,12 +490,17 @@ Where each owner decision is recorded — the file and its section, and a label
| D79 | [`05_DETECTION.md`](05_DETECTION.md) §Platform signatures & metadata | the platform is "Xbox" (`xbox`), in full: import, artwork, Play, capture, detection, docs and legal |
| D80 | [`08_UI.md`](08_UI.md) §Games | Play on an Xbox game always activates its package, in both modes; the Agent answers `PackagedGame` and records it in attach mode |
| D81 | [`20_OPEN_QUESTIONS.md`](20_OPEN_QUESTIONS.md) §G | title lists stay keyed by Steam id; an Xbox copy is matched by everything but that entry |
| D82 | [`HANDOFF.md`](HANDOFF.md) §START HERE | alpha.2 right after beta.33; on RC3 unless the train reaches it after .NET 11 ships (then SDK 11.0.100, packages 11.0.0) |
| D82 | [`handoff/history/0.1.0-beta.33.md`](handoff/history/0.1.0-beta.33.md) | alpha.2 right after beta.33; on RC3 unless the train reaches it after .NET 11 ships (then SDK 11.0.100, packages 11.0.0) |
| D83 | [`05_DETECTION.md`](05_DETECTION.md) §DLSS generation | the NVIDIA App's Dynamic frame generation, reported applied by the driver in a session where DLSS Frame Generation was identified, is DLSS 4.5 (amends D64) |
| D84 | [`05_DETECTION.md`](05_DETECTION.md) §DLSS generation | DLSS 5 heads the DLSS line where its neural rendering was measured running (`kFeatureDLSS_NR`, `dlss_nr_pct`); loaded only reads "runtime loaded" (amends D64) |
| D85 | [`08_UI.md`](08_UI.md) §Games, §Compare | filters: Games — store, engine, state, installed, played; Compare — game, tier, frame generation (no period); Compare lists every session |
| D86 | [`08_UI.md`](08_UI.md) (the shell) | the left pane's selected item keeps its label: our copy of WPF UI 4.3.0's LeftFluent item template |
| D87 | [`HANDOFF.md`](HANDOFF.md) §START HERE | alpha.3 right after beta.34, on RC3 (before .NET 11's release, 2026-11-10) |
| D87 | [`handoff/history/0.1.0-beta.34.md`](handoff/history/0.1.0-beta.34.md) | alpha.3 right after beta.34, on RC3 (before .NET 11's release, 2026-11-10) |
| D88 | [`../ACCESSIBILITY.md`](../ACCESSIBILITY.md) | the accessibility statement at the root, under Help ▸ Accessibility and on the wiki: WCAG 2.2 AA through WCAG2ICT is a goal, never a claim; reports by severity, no promised times |
| D89 | [`08_UI.md`](08_UI.md) §Screen readers | what appears is said to a screen reader — notices, the agent's and the update's banners, the snackbars, a game page's notice, Database maintenance's results — while FrameLedger's window is active |
| D90 | [`08_UI.md`](08_UI.md) §Screen readers | page titles heading 1, section titles heading 2; every chart named with where its numbers are; no series told apart by colour alone |
| D91 | [`08_UI.md`](08_UI.md) §Contrast | Windows contrast themes are followed, whatever Settings ▸ Theme says |
| D92 | [`HANDOFF.md`](HANDOFF.md) §START HERE | beta.35 in this train, no alpha; alpha.4 is the move to .NET 11's release (SDK 11.0.100, packages 11.0.0), a task of its own after 2026-11-10 |
---
+91
View File
@@ -0,0 +1,91 @@
<!-- Moved from CHANGELOG.md's [Unreleased] when 0.1.0-beta.35 was cut, 2026-11-09 (D66). CHANGELOG.md lists every release. -->
## [0.1.0-beta.35] - 2026-11-09
**The thirty-fifth pre-release: accessibility.** An accessibility statement (Help ▸ Accessibility); a screen reader
that reads every control and value in its words and is told what appears; headings and charts it can use; Windows
contrast themes followed; the keyboard following a page shortcut, and a message box opening over the window. And three
places where text read below WCAG's 4.5:1 in a Fluent theme, found on the way: the agent's pill, two kinds of short
message, a destructive button. The same unsigned installer: verify its hash against `SHA256SUMS.txt`, then *More info →
Run anyway*.
**Updating from `0.1.0-beta.34`:** Help ▸ Check for updates, then *Restart to update* with no game running. The legal
texts keep their versions, so nothing is shown for you to accept; the ledger stays at schema 22 and the detection rules
at `2026.11.2`. Nothing about capture or measurement changes.
### Added␍
␍
- **An accessibility statement** (owner request 2026-11-09, decision D88). `ACCESSIBILITY.md` says what FrameLedger aims␍
for — WCAG 2.2 at level AA as W3C's WCAG2ICT applies it to desktop software, a goal and not a claim of conformance —␍
what works with the keyboard alone, a screen reader, a contrast theme or Magnifier, how it is checked (the project's␍
tests, and the owner's pass of 2026-11-09: keyboard only and Narrator on 0.1.0-beta.34 and 0.1.0-alpha.3, no fault),␍
what does not work yet and what to do instead, and how a barrier is reported and handled — by severity, with no␍
promised times. The app shows it under **Help ▸ Accessibility**, and after Limitations in the user guide's window; the␍
wiki gets an *Accessibility* page.␍
- **An *Accessibility problem* issue form** (`.github/ISSUE_TEMPLATE/accessibility.yml`) asking what was tried, what␍
happened and what the reporter uses — never anything about the reporter themself — and a user-interface section in the␍
pull-request template. The `accessibility` label exists, and so do `safety` and `priority-high`, which the *Safety gap*␍
form had named since its first day without either existing — so GitHub had never applied them.␍
␍
- **A screen reader reads what the window shows** (decision D88's goal; measured in the UI Automation tree WPF builds on␍
every page, window and dialog, every tab — `PagesLoadTests.Automation`). Drop-down options were read as an internal␍
record (*Choice { Value = dark, Label = Dark }*), lists and table rows by their program names, table cells drawn by a␍
template as *Item: …, Column Display Index: n*, and the terms window's list by each document's whole text; each now␍
reads the words it shows, and an empty cell reads *empty*. The frame-rate readout says Native, Displayed and the␍
factor together (CLAUDE.md rule 6, in speech), a ray-tracing chip its value and where it came from, a change badge its␍
number. The safety notices' title and message reach a screen reader (they were hidden inside the notice's template),␍
and the notice's button says which notice it answers. A button repeated on each row names its row (*Open: …*, *Play:␍
…*, *Turn off: …*). Tab no longer stops on pictures, lists, Settings' rows, the FPS readout, the chips or the dialog␍
host, where it found nothing to say; an expander's button is named after its header.␍
␍
- **A screen reader is told what appears** (owner decision D89): a safety notice as it arrives, the capture agent going␍
offline and coming back, an update's steps (not each percent), every short message at the bottom of the window, a␍
notice on a game's page and each result of Tools ▸ Database maintenance — in the words shown, and only while␍
FrameLedger's window is the active one, so a game that has the screen is never interrupted. The database line's live␍
region, which announced nothing, is gone.␍
␍
- **Headings and charts a screen reader can use** (owner decision D90). Every page's title is a first-level heading and␍
each section title a second-level one, so a screen reader's heading keys move between sections. Every chart says what␍
it is and where its numbers are written as text; its keys — arrows to move, Ctrl with an arrow to zoom, A to see all of␍
it — now stay with the chart instead of also scrolling the page or moving the focus on, and its focus is drawn. No␍
chart tells two series apart by colour alone any more: Compare's five sessions, the GPU's temperature and its hot spot,␍
the two kinds of stutter, the two lows and the two limits each have their own line pattern, marker or hatch.␍
␍
- **Windows contrast themes are followed** (owner decision D91). With a contrast theme on — Aquatic, Desert, Dusk, Night␍
sky, or one whose colours were edited, on Windows 10 or 11 — every colour in FrameLedger's windows is one of that␍
theme's, whatever Settings ▸ Theme says, and it changes the moment the theme is turned on, edited or turned off;␍
Settings ▸ Theme says so under its box. Before, *System* could apply WPF UI's own high-contrast files, most of whose␍
colours are a red placeholder, and the next window opened put the light or the dark theme back. The charts draw in the␍
theme's colours, their patterns telling the series apart; the frame-generation, ray-tracing and upscaler chips are the␍
theme's highlight and its text (WPF UI's files put the window text there, 1.26–1.78:1); a destructive button is the␍
theme's own button; a pressed menu item is no longer white on white; nothing is drawn translucent, and a game's picture␍
lends its page no colour, as before.␍
␍
- **The keyboard follows a page shortcut.** **Ctrl+1** … **Ctrl+5** now move the focus into the page they open — its␍
first control — and a screen reader hears the page's title; before, the focus stayed where it was, often on the page␍
that had just gone, and Tab began again at the top of the window.␍
- **Pages no longer slide in while Windows' animation effects are off** (Settings ▸ Accessibility ▸ Visual effects),␍
followed as the setting changes.␍
␍
### Fixed␍
␍
- **A message box opens over FrameLedger's window** — Remove game, Delete sessions, the database's and the update's␍
questions. It had no owner, so it could fall behind the window it came from and, closing, give the focus to another␍
program; it is owned by the window that opened it now, and the focus comes back there.␍
- **A double-click on a chart shows all of it again**, as the user guide said; it toggled ScottPlot's render-time overlay.␍
- **The capture agent's state in the title bar reads in the light theme.** It was drawn on WPF UI's fixed green, blue,␍
orange and red under white — 2.78, 2.63, 2.16 and 3.68:1 — and is on the theme's own success, caution and critical␍
fills now, as the notices are; its words say the state.␍
- **The short messages at the bottom of the window read.** A *done* or a *warning* message was white on a fixed green or␍
orange, 2.78:1 and 2.16:1 in both themes; every message is in the theme's colours now, its icon saying which kind.␍
- **A destructive button's label reads in the dark theme** — Remove on a game's page, Delete in the confirmations: the␍
theme's dark text on the red, 5.3:1 and 5.7:1, where white read 3.68:1.␍
␍
### Changed␍
␍
- **Documents corrected**: charts do take focus and keys (`docs/08_UI.md` said neither — `ChartKeyboardTests` measures␍
it); the database-maintenance result's live region announced nothing, since WPF raises one only when the app does; the␍
"no Narrator pass" gap is the owner's pass now, beside what that pass could not show; the open question "Accessibility␍
/ DPI: no design anywhere" is closed; NFR-9 names screen readers and contrast themes (D88–D91). `LIMITATIONS.md` gains an␍
*Accessibility* section and loses its one struck sentence — a screen reader reads struck text as current, so no page␍
the app shows strikes text through. The guide's menu table names its menu on every row, read one row at a time.
+90
View File
@@ -0,0 +1,90 @@
# HANDOFF history — 0.1.0-beta.34
*Moved verbatim from `docs/HANDOFF.md` when 0.1.0-beta.35 was cut, 2026-11-09 (owner decision D66); `docs/HANDOFF.md` §How this file is split lists every part. Nothing below was edited, so its "below" and "above" mean HANDOFF.md as it stood.*
## **START HERE** — 2026-11-06, 0.1.0-beta.34: DLSS 5 and DLSS 4.5 from what the game and the driver did; filters; Games at once
*Status is `docs/changelog/0.1.0-beta.34.md`; this is what no other file carries.* The owner asked for seven things, the
usual train: (1) how DLSS 5 Neural Rendering is detected on Hogwarts Legacy (Neural Rendering on in the game), and its
version; (2) under the NVIDIA App's *Dynamic* multi frame generation the label read DLSS 4, though Dynamic and ×6 exist
only in DLSS 4.5 (Phantom Blade Zero); (3) filters on Games and Compare; (4) the Compare page's layout, from a
screenshot; (5) the documents and the tested-games list, from the database; (6) switching to Games stalled 0.5–1.5 s;
(7) a language change landed on the last content page instead of Settings. And while planning: "Bạn check Streamline các
bản gần đây có gì thay đổi và sửa luôn nếu thật sự cần nhé." — check what changed in recent Streamline versions and fix it
if really needed. #356 (two fixes from a self-review of #351 and #352), #357 (D83), #358 (D84, Streamline `v2.14.16`),
#359 (items 6 and 7), #360 (items 3 and 4, D85, D86), #361 (item 5) and this release; `0.1.0-alpha.3` follows (D87) —
the owner's screenshot is of an alpha, so the alpha is how these reach the owner's PC.
**Decisions (asked while planning, do not re-ask):**
- **D83 — Dynamic frame generation is DLSS 4.5's**: the owner's rule, "Dynamic and ×6 exist only in DLSS 4.5". The
evidence is the game's driver profile setting Dynamic (`NGX_DLSSG_MODE` = 4) **and** the driver reporting its
frame-generation override applied in the game's process (`FG_MODE` in its FG word), in a session where DLSS
Frame Generation was identified (`fg_mode = dlssg`; its factor need not have been counted); a state measured at ×5 or more still ranks first, and a *Fixed* multiplier names nothing by itself
(amends D64). The driver's `frameGenerationMode` — 3 under Dynamic and 1 under Fixed in every session read, and unnamed
by NVIDIA — is recorded in `spike-notes` §26, not keyed on.
- **D84 — DLSS 5 is the session's generation where its neural rendering was measured running**: the Overlay decodes
`kFeatureDLSS_NR` in its `slEvaluateFeature` detour and the Agent keeps its share of the Streamline batches
(`sessions.dlss_nr_pct`, schema 0022) — *DLSS 5 (neural rendering on N % of rendered frames)*; loaded and seen not
running, *runtime loaded, not seen running*; where nothing could tell, *runtime loaded*, as before (amends D64).
- **D85 — the filters**: Games — store, engine, state, installed, played; Compare — game, tier, frame generation, no
period; Compare lists every session (it listed the newest 200).
- **D86 — the left pane's selected item keeps its label**: our copy of WPF UI 4.3.0's LeftFluent item template, whose
`IsActive` trigger animated it away.
- **D87 — alpha.3 right after beta.34**, on RC3: the train reaches it before .NET 11's release on 2026-11-10.
Streamline was re-vendored at `v2.14.16` on the owner's instruction above, not as a decision of its own. The wording of
the Disclaimer 2.13 and the Privacy Policy 2.14, and the tested-games list (D35), were approved with the plan (D36).
**Choices made here:**
- **Neural rendering's share is over the Streamline batches**, not every present: a generated frame evaluates nothing,
and a title that never drains a batch reads *nothing could tell* (null), never 0 %.
- **A writer older than beta.34 is told apart by its family bit**, `FL_HOOK_SL_NEURAL_RENDERING` (bit 12), published with
the detour — an old Overlay's silence leaves `dlss_nr_pct` null instead of a measured 0 %; no layout change.
- **The Games page is the window's**, kept by our own page provider (`WindowPageCache`), not `NavigationCacheMode`: WPF UI
4.3.0 reads that only when neither a service provider nor a page provider is set, and `SetNavigationControl` sets one
(`16_WPFUI_SYNTAX` §Navigation). One per window, so a language change's window builds its own.
- **The cards come before the executable checks** — 39 of the owner's 41 Steam games are on a USB drive that sleeps — and
each card gets its *Not installed* pill when its check answers.
- **The pane's item template is a copy changed in one place**, reading WPF UI's own `NavigationViewConstants.xaml`: before
the WPF UI pin moves, the upstream template is read again.
**Measured on the way:** the owner's DLSS sessions of 2026-11-01 → 11-06, the driver's frame-generation numbering and
Streamline's `v2.12.0` → `v2.14.16` changes are `spike-notes` §26 (the ledger read read-only; the vendored copy was
`v2.12.0` byte for byte); the Games page before and after is §27 (first cards 822–830 ms → 10–15 ms with the first
executable check held 800 ms; a revisit 181–215 ms → 15–16 ms). The neural-rendering decode costs nothing measurable in
the detour and 0.14–0.19 ns on the present's feature byte (#358's body; NFR-1's budget is 1 µs per present).
**Traps met on the way:**
- **`notice-check` reads the tracked tree**: a file deleted from the working tree but not from the index fails it with
*Could not find file* — after every build and test had passed (#360's first local gate). Stage the change
(`git add -A`) before the gate.
- **A new hook family bit belongs in the native token test's exact mask** (`guard_test.cpp`), and a new Streamline fact
in the 0xF00D case's list of facts it must not light — #358's first gate (`0x100f` against `15`).
- **WPF UI 4.3.0**: `NavigationCacheMode` is ignored once a page provider is set; `INavigationService.SetNavigationControl`
hands the NavigationView the container's provider, so ours is set after it; LeftFluent's item template collapses the
selected item's label.
- **Microsoft.Data.Sqlite's async methods run synchronously**: a read awaited on the UI thread blocks it — `Task.Run` it.
**Owner-only:** item 30 — beta.34 on real hardware.
### 0.1.0-alpha.3 — the third alpha, the same day (D87)
`alpha` takes main at this pull request — `v0.1.0-beta.34` and these notes, no other change — by a merge commit, as
`13_CI_CD` §The alpha line says. One file the switch holds moved on main — `legal/THIRD_PARTY_NOTICES.md`, its
Streamline row (#358) — on a line the switch does not touch (the switch changes the *Transitive* row), so the merge
takes both without a conflict (`git merge-tree` before the pull request); main's package set did not move, and the
switch stays the first alpha's (SDK `11.0.100-rc.3.26522.148`, the three packages at `11.0.0-rc.3.26522.148`, the same
NuGet licence texts) — the train reached it before .NET 11's release. Its gate on the 11 SDK must pass before the pull
request into `alpha` is merged by
hand (the branch has no auto-merge); the release runs from the signed tag `v0.1.0-alpha.3` on `alpha`, with its delta
from alpha.2. Its notes are `docs/changelog/0.1.0-alpha.3.md`, which open with the experimental-build warning. It is
the first alpha whose ledger moves (schema 22): the copy it makes first is the database as alpha.2 left it, and going
back is to the newest beta, which opens schema 22.
- **The next alpha moves to .NET 11's release**: from 2026-11-10 the switch is SDK `11.0.100` and the packages `11.0.0`,
and RC3 is out of support — move the alpha even if no beta comes.
**Owner-only:** item 31 — the third alpha on real hardware.
+1 -1
View File
@@ -133,7 +133,7 @@ is ready.
## Keyboard and mouse
- **Ctrl+1** … **Ctrl+5** open Dashboard, Games, Compare, Logs and Settings.
- **Ctrl+1** … **Ctrl+5** open Dashboard, Games, Compare, Logs and Settings, and put the keyboard in that page.
- **Alt** or **F10** moves to the menus; **Alt** with a menu's underlined letter opens it (**Alt+F**, **Alt+T** and
**Alt+H** for File, Tools and Help in English).
- **Esc** closes a dialog the way its Close or Cancel button does.
+1 -1
View File
@@ -41,7 +41,7 @@ The link under them, *Read what the hook does and does not do*, opens the safety
| Setting | What it does | Default |
|---|---|---|
| **Theme** | Follow system, Light or Dark. Applies at once. | Follow system |
| **Theme** | Follow system, Light or Dark. Applies at once. While a Windows contrast theme is on, FrameLedger uses that theme's colours whatever you choose here, and says so under the box. | Follow system |
| **Language** | English, Tiếng Việt or 日本語. The window is rebuilt in the new language at once, and stays on Settings (since 0.1.0-beta.34; before, it could open on the last game you looked at). | English |
## Games
+1 -1
View File
@@ -12,7 +12,7 @@
HTML comments are not part of the block.
-->
> ⚠ **What FrameLedger actually measures today — 2026-11-06.** The software is a beta; its latest
> **beta is `0.1.0-beta.34`** (2026-11-06), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.35`** (2026-11-09), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds on a prerelease .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
+1 -1
View File
@@ -116,7 +116,7 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
<!-- accuracy-block:begin -->
> ⚠ **What FrameLedger actually measures today — 2026-11-06.** The software is a beta; its latest
> **beta is `0.1.0-beta.34`** (2026-11-06), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.35`** (2026-11-09), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds on a prerelease .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
+2
View File
@@ -329,6 +329,7 @@ public partial class App : System.Windows.Application
builder.Services.AddSingleton(appearance);
builder.Services.AddSingleton(registered);
builder.Services.AddSingleton(closePolicy);
builder.Services.AddSingleton<IContrastSource, SystemContrastSource>(); // beta.35 (D91): a contrast theme wins
builder.Services.AddSingleton<IThemeApplier, WpfThemeApplier>();
// The Agent link, the Run entry, the Agent's maintenance flags and the updater: a viewer's composition holds none of
@@ -378,6 +379,7 @@ public partial class App : System.Windows.Application
services.AddSingleton<TrayViewModel>();
services.AddSingleton<TrayHost>();
services.AddTransient<MainWindow>();
services.AddSingleton<PageFocus>(); // beta.35: Ctrl+1…5 put the keyboard in the page they open
services.AddSingleton<MainWindowViewModel>();
services.AddSingleton<ILanguageFollower>(static sp => sp.GetRequiredService<TrayHost>());
services.AddSingleton<ILanguageFollower>(static sp => sp.GetRequiredService<MainWindowViewModel>());
+20 -2
View File
@@ -62,8 +62,26 @@ public sealed record ChartPalette(
/// element drawn in the chart colours follows a theme switch: a resource reference to <c>ApplicationBackgroundColor</c>,
/// read here (<c>FgMixBar</c>, <c>ChangeBadge</c>).
/// </summary>
public static ChartPalette ForBackground(System.Windows.Media.Color background) =>
For(Services.ColorMath.Luminance(background) < 0.5 ? ApplicationTheme.Dark : ApplicationTheme.Light);
public static ChartPalette ForBackground(System.Windows.Media.Color background) => Services.ContrastTheme.Active is { } contrast
? ForContrast(contrast)
: For(Services.ColorMath.Luminance(background) < 0.5 ? ApplicationTheme.Dark : ApplicationTheme.Light);
/// <summary>
/// The palette under a Windows contrast theme (beta.35, D91): only the theme's own colours — the window under every plot,
/// its text for the axes and the first series, then the link, the highlight, the button text and the disabled text in
/// turn — the series told apart by their patterns as well (<see cref="ChartPatterns"/>), since a contrast theme has few.
/// </summary>
public static ChartPalette ForContrast(Services.ContrastPalette contrast)
{
ArgumentNullException.ThrowIfNull(contrast);
Color window = ChartTheme.ToScottPlot(contrast.Window);
Color text = ChartTheme.ToScottPlot(contrast.WindowText);
Color link = ChartTheme.ToScottPlot(contrast.HotTrack);
Color highlight = ChartTheme.ToScottPlot(contrast.Highlight);
Color button = ChartTheme.ToScottPlot(contrast.ButtonText);
Color gray = ChartTheme.ToScottPlot(contrast.GrayText);
return new ChartPalette(window, window, text, gray, text, link, highlight, link, text, link, highlight, highlight, text, button, gray, button);
}
/// <summary>A palette from any dictionary carrying the keys (the tests hand in a parsed file).</summary>
public static ChartPalette FromDictionary(ResourceDictionary dictionary)
+13 -3
View File
@@ -20,8 +20,8 @@ public static class ChartTheme
private static readonly Lock _lock = new();
private static bool _subscribed;
/// <summary>The palette of the theme WPF UI has applied.</summary>
public static ChartPalette Current => ChartPalette.For(ApplicationThemeManager.GetAppTheme());
/// <summary>The palette of the theme WPF UI has applied — or, under a Windows contrast theme, of its colours (beta.35, D91).</summary>
public static ChartPalette Current => Services.ContrastTheme.Active is { } contrast ? ChartPalette.ForContrast(contrast) : ChartPalette.For(ApplicationThemeManager.GetAppTheme());
/// <summary>Colours one plot for the current theme; the series keep their own palette colours.</summary>
public static void Apply(Plot plot)
@@ -48,7 +48,8 @@ public static class ChartTheme
ArgumentException.ThrowIfNullOrWhiteSpace(path);
Color figure = plot.FigureBackground.Color;
Color data = plot.DataBackground.Color;
Color window = ApplicationThemeManager.GetAppTheme() == ApplicationTheme.Light ? Color.FromHex("#F3F3F3") : Color.FromHex("#202020");
Color window = Services.ContrastTheme.Active is { } contrast ? ToScottPlot(contrast.Window)
: ApplicationThemeManager.GetAppTheme() == ApplicationTheme.Light ? Color.FromHex("#F3F3F3") : Color.FromHex("#202020");
try
{
plot.FigureBackground.Color = Over(figure, window);
@@ -70,6 +71,12 @@ public static class ChartTheme
internal static Color TextOn(Color fill)
{
System.Windows.Media.Color under = ToWpf(fill);
if (Services.ContrastTheme.Active is { } contrast)
{
// beta.35 (D91): under a contrast theme the text is one of its colours too — the one that reads best on the fill.
return ToScottPlot(contrast.Colors.MaxBy(c => Services.ColorMath.Contrast(c, under)));
}
return Services.ColorMath.Contrast(System.Windows.Media.Colors.Black, under) >= Services.ColorMath.Contrast(System.Windows.Media.Colors.White, under)
? Colors.Black
: Colors.White;
@@ -78,6 +85,9 @@ public static class ChartTheme
/// <summary>A chart colour as WPF's.</summary>
internal static System.Windows.Media.Color ToWpf(Color c) => System.Windows.Media.Color.FromArgb(c.A, c.R, c.G, c.B);
/// <summary>A WPF colour as ScottPlot draws it (a contrast theme's colours, beta.35).</summary>
internal static Color ToScottPlot(System.Windows.Media.Color c) => new(c.R, c.G, c.B, c.A);
/// <summary>Source-over: <paramref name="top"/> composited on an opaque <paramref name="under"/>.</summary>
internal static Color Over(Color top, Color under)
{
+1 -1
View File
@@ -96,7 +96,7 @@ public static class ArtTint
return;
}
if (GetColor(band) is { } dominant && !SystemParameters.HighContrast && BandColour(band, dominant) is { } colour)
if (GetColor(band) is { } dominant && !SystemParameters.HighContrast && Services.ContrastTheme.Active is null && BandColour(band, dominant) is { } colour)
{
var brush = new SolidColorBrush(colour);
brush.Freeze();
@@ -42,7 +42,7 @@
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource DefaultDataGridRowStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsExisting}" Value="True">
<DataTrigger Binding="{Binding IsDimmed}" Value="True">
<Setter Property="Opacity" Value="0.55" />
</DataTrigger>
</Style.Triggers>
+4 -4
View File
@@ -53,10 +53,10 @@
Content="{x:Static res:Strings.Alpha_Badge}"
ToolTip="{Binding ViewModel.AlphaBadgeTooltip}"
Visibility="{Binding ViewModel.IsAlpha, Mode=OneTime, Converter={StaticResource BoolToVis}}" />
<ui:Badge Margin="0,0,12,0"
VerticalAlignment="Center"
Appearance="{Binding ViewModel.AgentStatusAppearance}"
Content="{Binding ViewModel.AgentStatusText}" />
<!-- beta.35: the theme's own fills under its text, never WPF UI's palette badge (Styles/FrameLedger.xaml, AgentPill). -->
<Border DataContext="{Binding ViewModel}" Style="{StaticResource AgentPill}">
<TextBlock Foreground="{DynamicResource TextFillColorPrimaryBrush}" Text="{Binding AgentStatusText}" />
</Border>
</StackPanel>
</ui:TitleBar.TrailingContent>
</ui:TitleBar>
+23 -1
View File
@@ -2,6 +2,7 @@
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Diagnostics;
using System.Windows;
using System.Windows.Threading;
using FrameLedger.App.Services;
using FrameLedger.App.ViewModels;
@@ -19,6 +20,8 @@ namespace FrameLedger.App;
/// </summary>
public partial class MainWindow : FluentWindow
{
private readonly PageMotion _motion;
public MainWindow(
MainWindowViewModel viewModel,
INavigationService navigation,
@@ -26,7 +29,8 @@ public partial class MainWindow : FluentWindow
IContentDialogService dialogs,
INavigationViewPageProvider pages,
IThemeApplier theme,
AppearanceSettings appearance)
AppearanceSettings appearance,
PageFocus pageFocus)
{
ArgumentNullException.ThrowIfNull(navigation);
ArgumentNullException.ThrowIfNull(snackbar);
@@ -34,6 +38,7 @@ public partial class MainWindow : FluentWindow
ArgumentNullException.ThrowIfNull(pages);
ArgumentNullException.ThrowIfNull(theme);
ArgumentNullException.ThrowIfNull(appearance);
ArgumentNullException.ThrowIfNull(pageFocus);
ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
DataContext = this;
@@ -55,6 +60,17 @@ public partial class MainWindow : FluentWindow
Loaded += (_, _) => theme.Apply(appearance.Theme, this);
TimeNavigations();
// beta.35: a page slides in only while Windows' animation effects are on, followed while the window lives; and the
// page a shortcut opens takes the keyboard (PageFocus) — the shell says which page is shown after every navigation.
_motion = PageMotion.Follow(RootNavigation);
RootNavigation.Navigated += (_, e) =>
{
if (e.Page is FrameworkElement page)
{
pageFocus.Shown(page);
}
};
}
/// <summary>
@@ -78,4 +94,10 @@ public partial class MainWindow : FluentWindow
}
public MainWindowViewModel ViewModel { get; }
protected override void OnClosed(EventArgs e)
{
_motion.Dispose();
base.OnClosed(e);
}
}
@@ -6,6 +6,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:res="clr-namespace:FrameLedger.App"
xmlns:services="clr-namespace:FrameLedger.App.Services"
xmlns:vm="clr-namespace:FrameLedger.App.ViewModels"
Title="{x:Static res:Strings.Settings_Header}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
@@ -290,6 +291,10 @@
SelectedValue="{Binding ViewModel.SelectedTheme, Mode=TwoWay}"
SelectedValuePath="Value" />
</ui:CardControl>
<!-- beta.35 (D91): a Windows contrast theme's colours win; this says so while one is on, and goes when it is off. -->
<ui:TextBlock Margin="12,4,0,0" Style="{StaticResource SecondaryText}" TextWrapping="Wrap"
Text="{x:Static res:Strings.Settings_Theme_ContrastOn}"
Visibility="{Binding Path=(services:ContrastTheme.IsOn), Converter={StaticResource BoolToVis}}" />
<ui:CardControl Margin="0,8,0,0" Header="{x:Static vm:SettingsViewModel.LanguageLabel}" Icon="{ui:SymbolIcon LocalLanguage24}">
<ComboBox MinWidth="180"
AutomationProperties.Name="{x:Static vm:SettingsViewModel.LanguageLabel}"
@@ -22,7 +22,7 @@ public sealed class Confirmations : IConfirmations
SecondaryButtonAppearance = ControlAppearance.Danger,
CloseButtonText = Strings.Common_Cancel,
};
MessageBoxResult result = await box.ShowDialogAsync(cancellationToken: ct).ConfigureAwait(true);
MessageBoxResult result = await MessageBoxes.ShowAsync(box, ct).ConfigureAwait(true);
return result switch
{
MessageBoxResult.Primary => RemoveGameChoice.KeepSessions,
@@ -45,6 +45,6 @@ public sealed class Confirmations : IConfirmations
PrimaryButtonAppearance = ControlAppearance.Danger,
CloseButtonText = Strings.Common_Cancel,
};
return await box.ShowDialogAsync(cancellationToken: ct).ConfigureAwait(true) == MessageBoxResult.Primary;
return await MessageBoxes.ShowAsync(box, ct).ConfigureAwait(true) == MessageBoxResult.Primary;
}
}
@@ -0,0 +1,153 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Windows;
using System.Windows.Media;
namespace FrameLedger.App.Services;
/// <summary>
/// A contrast theme's colours over the App's Fluent theme (beta.35, D91): every WPF UI theme resource given the user's colour
/// for its role (<see cref="ContrastRoles"/>), as one merged dictionary on top of the theme — the light or the dark one, as
/// the contrast theme is light or dark — and the accent's resources, which WPF UI's accent manager writes straight into the
/// application's resources and which outrank any merged dictionary, written there too. Removing it leaves the Fluent theme;
/// <c>ApplicationThemeManager.Apply(…, updateAccent: true)</c> then writes the accent back.
/// </summary>
public static class ContrastOverlay
{
/// <summary>
/// The accent's resources: the 21 WPF UI 4.3.0's <c>ApplicationAccentColorManager</c> sets in the application's own
/// resources (measured 2026-11-09), each with its role.
/// </summary>
public static IReadOnlyDictionary<string, (ContrastRole Role, bool Brush)> AccentKeys { get; } = new Dictionary<string, (ContrastRole, bool)>(StringComparer.Ordinal)
{
["SystemAccentColor"] = (ContrastRole.Highlight, false),
["SystemAccentColorPrimary"] = (ContrastRole.Highlight, false),
["SystemAccentColorSecondary"] = (ContrastRole.Highlight, false),
["SystemAccentColorTertiary"] = (ContrastRole.Highlight, false),
["SystemAccentBrush"] = (ContrastRole.Highlight, true),
["SystemFillColorAttentionBrush"] = (ContrastRole.Highlight, true),
["AccentFillColorDefault"] = (ContrastRole.Highlight, false),
["AccentFillColorSecondary"] = (ContrastRole.Highlight, false),
["AccentFillColorTertiary"] = (ContrastRole.Highlight, false),
["AccentFillColorDefaultBrush"] = (ContrastRole.Highlight, true),
["AccentFillColorSecondaryBrush"] = (ContrastRole.Highlight, true),
["AccentFillColorTertiaryBrush"] = (ContrastRole.Highlight, true),
["AccentFillColorSelectedTextBackgroundBrush"] = (ContrastRole.Highlight, true),
["AccentTextFillColorPrimaryBrush"] = (ContrastRole.HotTrack, true),
["AccentTextFillColorSecondaryBrush"] = (ContrastRole.HotTrack, true),
["AccentTextFillColorTertiaryBrush"] = (ContrastRole.HotTrack, true),
["AccentTextFillColorDisabled"] = (ContrastRole.GrayText, false),
["TextOnAccentFillColorPrimary"] = (ContrastRole.HighlightText, false),
["TextOnAccentFillColorSecondary"] = (ContrastRole.HighlightText, false),
["TextOnAccentFillColorSelectedText"] = (ContrastRole.HighlightText, false),
["TextOnAccentFillColorDisabled"] = (ContrastRole.GrayText, false),
};
/// <summary>
/// The colours of WPF UI 4.3.0's Fluent themes that none of its contrast dictionaries has (measured 2026-11-09), each with a
/// role: the navigation pane's separator, a gradient there, a line in the window text; the snowflake effect's two, the window.
/// </summary>
public static IReadOnlyDictionary<string, (ContrastRole Role, bool Brush)> FluentOnlyKeys { get; } = new Dictionary<string, (ContrastRole, bool)>(StringComparer.Ordinal)
{
["LeftNavigationViewSeparatorBrush"] = (ContrastRole.WindowText, true),
["SnowflakeGradientTop"] = (ContrastRole.Window, false),
["SnowflakeGradientBottom"] = (ContrastRole.Window, false),
};
/// <summary>
/// The text on the accent, which the overlay makes the highlight: the highlight's text. WPF UI's contrast dictionaries make
/// it the window text over an accent they leave as Windows' (measured 2026-11-09: white on Dusk's highlight, 1.62:1, in
/// every chip the App draws on the accent), so these are the App's roles, not inferred ones.
/// </summary>
public static IReadOnlyDictionary<string, (ContrastRole Role, bool Brush)> OnAccentKeys { get; } = new Dictionary<string, (ContrastRole, bool)>(StringComparer.Ordinal)
{
["TextOnAccentFillColorPrimary"] = (ContrastRole.HighlightText, false),
["TextOnAccentFillColorPrimaryBrush"] = (ContrastRole.HighlightText, true),
["TextOnAccentFillColorSecondary"] = (ContrastRole.HighlightText, false),
["TextOnAccentFillColorSecondaryBrush"] = (ContrastRole.HighlightText, true),
["TextOnAccentFillColorSelectedText"] = (ContrastRole.HighlightText, false),
["TextOnAccentFillColorSelectedTextBrush"] = (ContrastRole.HighlightText, true),
};
/// <summary>The overlay: every role-mapped key in the palette's colour for its role, and the transparent keys transparent.</summary>
public static ResourceDictionary Build(ContrastPalette palette)
{
ArgumentNullException.ThrowIfNull(palette);
var overlay = new Overlay();
foreach ((string key, (ContrastRole role, bool brush)) in ContrastRoles.Map)
{
overlay[key] = Value(palette.Of(role), brush);
}
foreach ((string key, (ContrastRole role, bool brush)) in OnAccentKeys)
{
overlay[key] = Value(palette.Of(role), brush);
}
foreach ((string key, bool brush) in ContrastRoles.Clear)
{
overlay[key] = Value(Colors.Transparent, brush);
}
foreach ((string key, (ContrastRole role, bool brush)) in FluentOnlyKeys.Where(k => !overlay.Contains(k.Key)))
{
overlay[key] = Value(palette.Of(role), brush);
}
return overlay;
}
/// <summary>Puts the palette over <paramref name="resources"/> (the application's), replacing an earlier overlay.</summary>
public static void Install(ResourceDictionary resources, ContrastPalette palette)
{
ArgumentNullException.ThrowIfNull(resources);
ArgumentNullException.ThrowIfNull(palette);
TakeOff(resources);
ContrastTheme.Active = palette;
resources.MergedDictionaries.Add(Build(palette));
foreach ((string key, (ContrastRole role, bool brush)) in AccentKeys)
{
resources[key] = Value(palette.Of(role), brush);
}
}
/// <summary>Takes the overlay away; the accent's own resources are the theme manager's to write back.</summary>
public static void Remove(ResourceDictionary resources)
{
ArgumentNullException.ThrowIfNull(resources);
TakeOff(resources);
ContrastTheme.Active = null;
}
/// <summary>Whether an overlay is on <paramref name="resources"/>.</summary>
public static bool IsInstalled(ResourceDictionary resources)
{
ArgumentNullException.ThrowIfNull(resources);
return resources.MergedDictionaries.OfType<Overlay>().Any();
}
// The overlays only: a palette replaced by another is never "off" in between.
private static void TakeOff(ResourceDictionary resources)
{
foreach (ResourceDictionary overlay in resources.MergedDictionaries.OfType<Overlay>().ToList())
{
_ = resources.MergedDictionaries.Remove(overlay);
}
}
private static object Value(Color colour, bool brush)
{
if (!brush)
{
return colour;
}
var solid = new SolidColorBrush(colour);
solid.Freeze();
return solid;
}
/// <summary>The overlay's own type, so it can be found and taken away again.</summary>
private sealed class Overlay : ResourceDictionary;
}
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Windows;
using System.Windows.Media;
namespace FrameLedger.App.Services;
/// <summary>
/// A Windows contrast theme's colours (beta.35, D91): the eight the user sees — and may edit — in Settings ▸ Accessibility ▸
/// Contrast themes. <see cref="FromSystem"/> reads the ones Windows has on now; a test builds its own.
/// </summary>
public sealed record ContrastPalette(Color Window, Color WindowText, Color Highlight, Color HighlightText, Color HotTrack, Color GrayText, Color ButtonFace, Color ButtonText)
{
/// <summary>The theme Windows has on now — the user's colours, edited or not, on Windows 10 and 11 alike.</summary>
public static ContrastPalette FromSystem() => new(
SystemColors.WindowColor, SystemColors.WindowTextColor, SystemColors.HighlightColor, SystemColors.HighlightTextColor,
SystemColors.HotTrackColor, SystemColors.GrayTextColor, SystemColors.ControlColor, SystemColors.ControlTextColor);
/// <summary>A dark window (Aquatic, Dusk, Night sky) rather than a light one (Desert): which Fluent theme lies under it.</summary>
public bool IsDark => ColorMath.Luminance(Window) < 0.5;
/// <summary>The colour of a role, fully opaque — a contrast theme has no translucent colours.</summary>
public Color Of(ContrastRole role)
{
Color c = role switch
{
ContrastRole.Window => Window,
ContrastRole.WindowText => WindowText,
ContrastRole.Highlight => Highlight,
ContrastRole.HighlightText => HighlightText,
ContrastRole.HotTrack => HotTrack,
ContrastRole.GrayText => GrayText,
ContrastRole.ButtonFace => ButtonFace,
ContrastRole.ButtonText => ButtonText,
_ => throw new ArgumentOutOfRangeException(nameof(role), role, "not a contrast role"),
};
return Color.FromRgb(c.R, c.G, c.B);
}
/// <summary>Every colour of the palette, in role order.</summary>
public IReadOnlyList<Color> Colors => [.. Enum.GetValues<ContrastRole>().Select(Of)];
}
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
namespace FrameLedger.App.Services;
/// <summary>
/// The eight colours a Windows contrast theme is made of (beta.35, D91) — what Settings ▸ Accessibility ▸ Contrast themes
/// lets the user edit, and what every colour of a contrast-themed window is one of.
/// </summary>
public enum ContrastRole
{
/// <summary>The background of a window and of what is in it.</summary>
Window,
/// <summary>Text on <see cref="Window"/>; also borders and strokes.</summary>
WindowText,
/// <summary>A selected item's background; an accent's fill.</summary>
Highlight,
/// <summary>Text on <see cref="Highlight"/>.</summary>
HighlightText,
/// <summary>A link (Windows' "hyperlink" colour).</summary>
HotTrack,
/// <summary>Disabled text and controls.</summary>
GrayText,
/// <summary>A button's background.</summary>
ButtonFace,
/// <summary>A button's text.</summary>
ButtonText,
}
@@ -0,0 +1,219 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Windows;
using System.Windows.Media;
namespace FrameLedger.App.Services;
/// <summary>
/// Which of a contrast theme's eight colours every WPF UI theme resource stands for (beta.35, D91), read from WPF UI 4.3.0's
/// own four high-contrast dictionaries (HC1 Dusk, HC2 Night sky, HCBlack Aquatic, HCWhite Desert).
/// </summary>
/// <remarks>
/// <para>
/// <b>Why not apply those dictionaries.</b> Measured 2026-11-09: each holds 459 keys, of which 84 of its 97 colours are a
/// <c>#FFFF0000</c> placeholder and 17 brushes (<c>SystemFillColor*Brush</c>, <c>MenuBar*</c>) throw when read; and their
/// colours are Windows 11's defaults, so a theme the user edited — or Windows 10's — would not be followed.
/// </para>
/// <para>
/// <b>What they are good for</b> is the role of each key: every brush there is one of the theme's eight colours (in HC1, 113
/// are the window colour, 68 the window text, 56 the highlight …). A key's role is the colour it has in all four — a key
/// that is the button face in one and the window in another is a button face — ties broken by its name, and a key with no
/// role colour anywhere (a placeholder, a throw) takes its brush twin's or its name's. <see cref="ContrastOverlay"/> then
/// gives every key the user's own colour for its role, and keeps the keys transparent there transparent.
/// </para>
/// <para>
/// <b>Only an opaque colour is evidence.</b> A brush that throws when its file is read alone does not throw in the App: its
/// forward reference falls back to the application's resources, and it reads as the Fluent theme's own fill — measured
/// 2026-11-09, <c>MenuBarItemBackgroundPressed</c> read <c>#0AFFFFFF</c> under the dark theme, the white of the window text
/// in three of the four, which made a pressed menu item white on white. A contrast theme has no translucent colour, so a
/// translucent one says nothing about a role, and the roles come out the same whichever Fluent theme lies under them.
/// </para>
/// </remarks>
public static class ContrastRoles
{
/// <summary>WPF UI 4.3.0's high-contrast theme files (<c>Resources/Theme/*.xaml</c>).</summary>
public static readonly IReadOnlyList<string> ThemeNames = ["HC1", "HC2", "HCBlack", "HCWhite"];
private static readonly Color _placeholder = Color.FromArgb(0xFF, 0xFF, 0, 0);
private static readonly Lazy<(IReadOnlyDictionary<string, (ContrastRole Role, bool Brush)> Roles, IReadOnlyDictionary<string, bool> Clear)> _inferred =
new(static () => Infer([.. ThemeNames.Select(Load)]));
/// <summary>Every key's role, and whether it is a brush (else a colour); keys transparent in a theme are in <see cref="Clear"/>.</summary>
public static IReadOnlyDictionary<string, (ContrastRole Role, bool Brush)> Map => _inferred.Value.Roles;
/// <summary>The keys transparent in one of the themes (true for a brush): the overlay keeps them transparent, so no colour of the Fluent theme under it shows through.</summary>
public static IReadOnlyDictionary<string, bool> Clear => _inferred.Value.Clear;
/// <summary>One of WPF UI's high-contrast dictionaries, read for its keys and colours — never applied.</summary>
public static ResourceDictionary Load(string theme)
{
ArgumentException.ThrowIfNullOrWhiteSpace(theme);
return new ResourceDictionary { Source = new Uri($"pack://application:,,,/Wpf.Ui;component/Resources/Theme/{theme}.xaml", UriKind.Absolute) };
}
/// <summary>The eight colours a high-contrast dictionary defines for itself (its <c>SystemColor*Color</c> keys).</summary>
public static ContrastPalette PaletteOf(ResourceDictionary dictionary)
{
ArgumentNullException.ThrowIfNull(dictionary);
return new ContrastPalette(
Read(dictionary, "SystemColorWindowColor"), Read(dictionary, "SystemColorWindowTextColor"),
Read(dictionary, "SystemColorHighlightColor"), Read(dictionary, "SystemColorHighlightTextColor"),
Read(dictionary, "SystemColorHotlightColor"), Read(dictionary, "SystemColorGrayTextColor"),
Read(dictionary, "SystemColorButtonFaceColor"), Read(dictionary, "SystemColorButtonTextColor"));
}
/// <summary>Every key's role across the dictionaries given (the four, in the App; a test's own, in a test), and the keys transparent in one.</summary>
public static (IReadOnlyDictionary<string, (ContrastRole Role, bool Brush)> Roles, IReadOnlyDictionary<string, bool> Clear) Infer(IReadOnlyList<ResourceDictionary> dictionaries)
{
ArgumentNullException.ThrowIfNull(dictionaries);
var seen = new Dictionary<string, List<HashSet<ContrastRole>>>(StringComparer.Ordinal);
var brush = new Dictionary<string, bool>(StringComparer.Ordinal);
var transparent = new HashSet<string>(StringComparer.Ordinal);
foreach (ResourceDictionary dictionary in dictionaries)
{
ContrastPalette palette = PaletteOf(dictionary);
foreach (string key in dictionary.Keys.OfType<string>())
{
object? value = TryRead(dictionary, key);
brush[key] = brush.GetValueOrDefault(key) || value is not Color;
Color? colour = value switch
{
Color c => c,
SolidColorBrush b => b.Color,
_ => null,
};
if (colour is { A: 0 })
{
_ = transparent.Add(key);
continue;
}
if (!seen.TryGetValue(key, out List<HashSet<ContrastRole>>? sets))
{
sets = [];
seen[key] = sets;
}
// Opaque only: a translucent colour is a Fluent fill a forward reference fell back to, never a contrast colour.
if (colour is { A: 0xFF } known && known != _placeholder)
{
sets.Add([.. Enum.GetValues<ContrastRole>().Where(r => palette.Of(r) == Color.FromRgb(known.R, known.G, known.B))]);
}
}
}
var roles = new Dictionary<string, (ContrastRole, bool)>(StringComparer.Ordinal);
foreach ((string key, List<HashSet<ContrastRole>> sets) in seen.Where(p => !transparent.Contains(p.Key)))
{
if (FromColours(key, sets) is { } role)
{
roles[key] = (role, brush[key]);
}
}
// A colour key with no role colour anywhere (a placeholder) takes the role of its brush twin; then the name decides.
foreach (string key in seen.Keys.Where(k => !transparent.Contains(k) && !roles.ContainsKey(k)))
{
roles[key] = (roles.TryGetValue(key + "Brush", out (ContrastRole Role, bool) twin) ? twin.Role : ByName(key), brush[key]);
}
return (roles, transparent.ToDictionary(static k => k, k => brush[k], StringComparer.Ordinal));
}
/// <summary>The role every dictionary agrees on, a tie broken by the name; null when no dictionary gave a role colour.</summary>
private static ContrastRole? FromColours(string key, List<HashSet<ContrastRole>> sets)
{
List<HashSet<ContrastRole>> informative = [.. sets.Where(static s => s.Count > 0)];
if (informative.Count == 0)
{
return null;
}
HashSet<ContrastRole> common = [.. informative[0]];
foreach (HashSet<ContrastRole> set in informative.Skip(1))
{
common.IntersectWith(set);
}
HashSet<ContrastRole> choices = common.Count > 0 ? common : [.. informative.SelectMany(static s => s)];
return choices.Count == 1 ? choices.First() : Prefer(key, choices);
}
/// <summary>Of several roles a colour fits, the one the key's name points at; a button's before a window's.</summary>
private static ContrastRole Prefer(string key, HashSet<ContrastRole> choices)
{
bool button = key.Contains("Button", StringComparison.Ordinal);
ContrastRole[] order = button
? [ContrastRole.ButtonFace, ContrastRole.ButtonText, ContrastRole.Window, ContrastRole.WindowText, ContrastRole.Highlight, ContrastRole.HighlightText, ContrastRole.HotTrack, ContrastRole.GrayText]
: [ContrastRole.Window, ContrastRole.WindowText, ContrastRole.Highlight, ContrastRole.HighlightText, ContrastRole.HotTrack, ContrastRole.GrayText, ContrastRole.ButtonFace, ContrastRole.ButtonText];
ContrastRole named = ByName(key);
if (choices.Contains(named))
{
return named;
}
return order.First(choices.Contains);
}
/// <summary>A role from the key's name alone — for a placeholder, or a brush that would not even load.</summary>
internal static ContrastRole ByName(string key)
{
ArgumentNullException.ThrowIfNull(key);
bool Has(string part) => key.Contains(part, StringComparison.Ordinal);
bool text = Has("TextFill") || Has("Foreground") || Has("Glyph") || (Has("Text") && !Has("Background"));
if (Has("Disabled"))
{
return ContrastRole.GrayText;
}
if (Has("OnAccent") || (text && (Has("Selected") || Has("Pressed"))))
{
return ContrastRole.HighlightText;
}
if (Has("AccentText") || Has("Hyperlink") || Has("Hotlight"))
{
return ContrastRole.HotTrack;
}
if (Has("Accent") || ((Has("Background") || Has("Fill")) && (Has("Selected") || Has("Pressed"))))
{
return ContrastRole.Highlight;
}
if (text)
{
return Has("Button") ? ContrastRole.ButtonText : ContrastRole.WindowText;
}
if (Has("Stroke") || (Has("Border") && !Has("MenuBar")))
{
return ContrastRole.WindowText;
}
// A system fill with no Background in its name is an icon's or a mark's colour: the text colour.
if (Has("SystemFillColor") && !Has("Background"))
{
return ContrastRole.WindowText;
}
return Has("Button") ? ContrastRole.ButtonFace : ContrastRole.Window;
}
private static object? TryRead(ResourceDictionary dictionary, string key)
{
try
{
return dictionary[key];
}
catch (Exception ex) when (ex is ResourceReferenceKeyNotFoundException or InvalidOperationException or System.Windows.Markup.XamlParseException)
{
return null;
}
}
private static Color Read(ResourceDictionary dictionary, string key) =>
TryRead(dictionary, key) is Color colour ? colour : throw new InvalidOperationException($"the high-contrast dictionary has no colour {key}");
}
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.ComponentModel;
namespace FrameLedger.App.Services;
/// <summary>
/// The contrast theme the App's own colours follow now (beta.35, D91): set while <see cref="ContrastOverlay"/> is installed,
/// null otherwise. What WPF UI's theme resources cannot carry reads it — the charts' palette, the frame-generation bar, the
/// change badges, the artwork's tint. The UI thread's: set and read there.
/// </summary>
public static class ContrastTheme
{
private static ContrastPalette? _active;
/// <summary>WPF's change notice for a static property: what a binding to <see cref="IsOn"/> listens to, weakly.</summary>
public static event EventHandler<PropertyChangedEventArgs>? StaticPropertyChanged;
/// <summary>The palette, or null while no contrast theme is followed.</summary>
public static ContrastPalette? Active
{
get => _active;
internal set
{
if (Equals(_active, value))
{
return;
}
bool was = IsOn;
_active = value;
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(nameof(Active)));
if (was != IsOn)
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(nameof(IsOn)));
}
}
}
/// <summary>
/// A contrast theme is followed now — what XAML binds to, <c>{Binding Path=(services:ContrastTheme.IsOn)}</c>, to change
/// while it is shown: the Remove button's look (<c>DangerButton</c>), the line under Settings ▸ Theme.
/// </summary>
public static bool IsOn => _active is not null;
}
@@ -59,7 +59,7 @@ public sealed class DatabaseMaintenancePrompts : IDatabaseMaintenancePrompts
PrimaryButtonAppearance = ControlAppearance.Danger,
CloseButtonText = Strings.Common_Cancel,
};
MessageBoxResult result = await box.ShowDialogAsync(cancellationToken: ct).ConfigureAwait(true);
MessageBoxResult result = await MessageBoxes.ShowAsync(box, ct).ConfigureAwait(true);
return result == MessageBoxResult.Primary;
}
}
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
namespace FrameLedger.App.Services;
/// <summary>Whether Windows has a contrast theme on, its colours, and when either changes (beta.35, D91).</summary>
public interface IContrastSource
{
/// <summary>A contrast theme is on (Settings ▸ Accessibility ▸ Contrast themes).</summary>
bool IsOn { get; }
/// <summary>Its colours, as Windows has them now — the user's own if edited.</summary>
ContrastPalette Palette { get; }
/// <summary>A contrast theme was turned on or off, or its colours were edited.</summary>
event EventHandler? Changed;
}
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Windows;
namespace FrameLedger.App.Services;
/// <summary>
/// Every message box the App shows is owned by its window (beta.35). WPF UI 4.3.0's <see cref="Wpf.Ui.Controls.MessageBox"/>
/// sets no owner (measured 2026-11-09: null before and after it is shown), and an ownerless modal window can fall behind the
/// window it was opened from and, when it closes, hand the focus to whichever program Windows activates next. Owned by the
/// App's active window, it opens over it and gives the focus back to it, where the control that had the keyboard takes it
/// again. Every box goes through here (<c>FocusAndMotionTests.EveryMessageBoxGoesThroughMessageBoxes</c>).
/// </summary>
/// <remarks>
/// The App's other dialogs need nothing of the kind: a <c>ContentDialog</c> lives inside the window, and WPF UI's host stores
/// the focused element when it opens and focuses it again when it closes (<c>ContentDialogHostController</c>,
/// <c>FocusAndMotionTests.AContentDialogGivesTheFocusBackToTheControlThatOpenedIt</c>).
/// </remarks>
public static class MessageBoxes
{
/// <summary>Shows <paramref name="box"/> as a dialog owned by the App's active window.</summary>
public static async Task<Wpf.Ui.Controls.MessageBoxResult> ShowAsync(Wpf.Ui.Controls.MessageBox box, CancellationToken ct = default)
{
ArgumentNullException.ThrowIfNull(box);
Own(box);
return await box.ShowDialogAsync(cancellationToken: ct).ConfigureAwait(true);
}
/// <summary>The App's active window, else its main one while it is shown, becomes <paramref name="box"/>'s owner.</summary>
internal static void Own(Window box)
{
ArgumentNullException.ThrowIfNull(box);
System.Windows.Application? app = System.Windows.Application.Current;
Window? owner = app?.Windows.OfType<Window>().FirstOrDefault(w => w.IsActive && w.IsVisible && !ReferenceEquals(w, box))
?? (app?.MainWindow is { IsVisible: true } main && !ReferenceEquals(main, box) ? main : null);
if (owner is not null)
{
box.Owner = owner;
}
}
}
+103
View File
@@ -0,0 +1,103 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Diagnostics.CodeAnalysis;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
namespace FrameLedger.App.Services;
/// <summary>
/// Ctrl+1 … Ctrl+5 put the keyboard in the page they open (beta.35): once it is shown, its first control takes the focus
/// and a screen reader hears its title — its first-level heading. Before, the focus stayed on the control that had it,
/// often one of the page that had just gone, and Tab began again at the top of the window. A page chosen in the pane with
/// the mouse leaves the focus where WPF UI puts it.
/// </summary>
public sealed class PageFocus
{
private readonly IAnnouncer _announcer;
private WeakReference<FrameworkElement>? _page;
public PageFocus(IAnnouncer? announcer = null) => _announcer = announcer ?? NoAnnouncer.Instance;
/// <summary>The shell's word of the page shown now, after every navigation, by a shortcut or not.</summary>
public void Shown(FrameworkElement page)
{
ArgumentNullException.ThrowIfNull(page);
_page = new WeakReference<FrameworkElement>(page);
}
/// <summary>
/// After a shortcut has navigated — or found its page already shown, when WPF UI navigates nowhere — the page shown then
/// takes the focus once the dispatcher has laid it out.
/// </summary>
[SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs", Justification = "a WPF application has no JoinableTaskFactory; this posts to the UI thread's own dispatcher, after the new page's layout, and never waits (ScrollBarHiding does the same)")]
public void Request()
{
Dispatcher? dispatcher = System.Windows.Application.Current?.Dispatcher;
if (dispatcher is null)
{
return;
}
_ = dispatcher.BeginInvoke(DispatcherPriority.Loaded, Take);
}
/// <summary>Moves the focus to the page's first control and says its title.</summary>
internal void Enter(FrameworkElement page)
{
ArgumentNullException.ThrowIfNull(page);
_ = page.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
if (Title(page) is { Length: > 0 } title)
{
_announcer.Announce(title, AnnouncementKind.Status, "Page");
}
}
/// <summary>The page's title: the text of its first first-level heading (beta.35, D90 — every page has exactly one).</summary>
internal static string? Title(DependencyObject root)
{
ArgumentNullException.ThrowIfNull(root);
if (root is TextBlock text && AutomationProperties.GetHeadingLevel(text) == AutomationHeadingLevel.Level1)
{
return text.Text;
}
int count = VisualTreeHelper.GetChildrenCount(root);
for (int i = 0; i < count; i++)
{
if (Title(VisualTreeHelper.GetChild(root, i)) is { } found)
{
return found;
}
}
return null;
}
private void Take()
{
if (_page?.TryGetTarget(out FrameworkElement? page) != true || page is null)
{
return;
}
if (page.IsLoaded)
{
Enter(page);
return;
}
void OnLoaded(object sender, RoutedEventArgs e)
{
page.Loaded -= OnLoaded;
Enter(page);
}
page.Loaded += OnLoaded;
}
}
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Windows;
using Wpf.Ui.Animations;
using Wpf.Ui.Controls;
namespace FrameLedger.App.Services;
/// <summary>
/// A page slides in only while Windows' animation effects are on (beta.35): Settings ▸ Accessibility ▸ Visual effects ▸
/// Animation effects, which WPF reads as <see cref="SystemParameters.ClientAreaAnimation"/> and announces when it changes.
/// WPF UI 4.3.0's navigation plays its own <see cref="Transition.FadeInWithSlide"/> whatever that setting says.
/// </summary>
public sealed class PageMotion : IDisposable
{
private readonly NavigationView _navigation;
private readonly Func<bool> _animations;
private PageMotion(NavigationView navigation, Func<bool> animations)
{
_navigation = navigation;
_animations = animations;
Apply();
SystemParameters.StaticPropertyChanged += OnSystemParameterChanged;
}
/// <summary>The transition for the setting: WPF UI's own while animations are on, none while they are off.</summary>
public static Transition For(bool animations) => animations ? Transition.FadeInWithSlide : Transition.None;
/// <summary>
/// Sets <paramref name="navigation"/>'s transition now and whenever the setting changes, until disposed (the shell does
/// when its window closes).
/// </summary>
public static PageMotion Follow(NavigationView navigation, Func<bool>? animations = null)
{
ArgumentNullException.ThrowIfNull(navigation);
return new PageMotion(navigation, animations ?? (static () => SystemParameters.ClientAreaAnimation));
}
public void Dispose() => SystemParameters.StaticPropertyChanged -= OnSystemParameterChanged;
/// <summary>Reads the setting again — what a change does; a test calls it with its own reader.</summary>
internal void Apply() => _navigation.Transition = For(_animations());
[SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs", Justification = "Windows' setting change can arrive off the UI thread; the navigation is its dispatcher's to change, posted and never waited on")]
private void OnSystemParameterChanged(object? sender, PropertyChangedEventArgs e)
{
if (string.Equals(e.PropertyName, nameof(SystemParameters.ClientAreaAnimation), StringComparison.Ordinal))
{
_ = _navigation.Dispatcher.BeginInvoke(new Action(Apply));
}
}
}
+10 -5
View File
@@ -11,6 +11,11 @@ namespace FrameLedger.App.Services;
/// reader as it is shown: a message at the bottom of the window that closes after four seconds was never heard. Every
/// transient message goes through here (<c>AccessibilityTests.OnlyTheStripShowsASnackbar</c>).
/// </summary>
/// <remarks>
/// Every message is drawn in the theme's colours (beta.35), its icon saying which kind it is. WPF UI 4.3.0's Success and
/// Caution appearances are fixed colours under white text, 2.78:1 and 2.16:1 in both themes, and no Windows contrast theme
/// reaches them; its Secondary one is the theme's, 13.97:1 dark and 16.53:1 light (measured 2026-11-09).
/// </remarks>
public sealed class SnackbarStrip : IMessageStrip
{
private static readonly TimeSpan _duration = TimeSpan.FromSeconds(4);
@@ -23,15 +28,15 @@ public sealed class SnackbarStrip : IMessageStrip
_announcer = announcer ?? NoAnnouncer.Instance;
}
public void Info(string title, string body) => Show(title, body, ControlAppearance.Secondary, SymbolRegular.Info24, AnnouncementKind.Status);
public void Info(string title, string body) => Show(title, body, SymbolRegular.Info24, AnnouncementKind.Status);
public void Success(string title, string body) => Show(title, body, ControlAppearance.Success, SymbolRegular.Checkmark24, AnnouncementKind.Status);
public void Success(string title, string body) => Show(title, body, SymbolRegular.Checkmark24, AnnouncementKind.Status);
public void Warn(string title, string body) => Show(title, body, ControlAppearance.Caution, SymbolRegular.Warning24, AnnouncementKind.Alert);
public void Warn(string title, string body) => Show(title, body, SymbolRegular.Warning24, AnnouncementKind.Alert);
private void Show(string title, string body, ControlAppearance appearance, SymbolRegular icon, AnnouncementKind kind)
private void Show(string title, string body, SymbolRegular icon, AnnouncementKind kind)
{
_snackbar.Show(title, body, appearance, new SymbolIcon(icon), _duration);
_snackbar.Show(title, body, ControlAppearance.Secondary, new SymbolIcon(icon), _duration);
_announcer.Announce(SpokenText.TitleAndBody(title, body), kind, "Strip");
}
}
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.ComponentModel;
using System.Windows;
using Microsoft.Win32;
namespace FrameLedger.App.Services;
/// <summary>
/// <see cref="IContrastSource"/> over Windows (beta.35, D91): <see cref="SystemParameters.HighContrast"/>, which WPF updates
/// and announces on Windows' setting change, and the user-preference event Windows raises when a contrast theme's colours
/// are edited while it is on.
/// </summary>
public sealed class SystemContrastSource : IContrastSource, IDisposable
{
public SystemContrastSource()
{
SystemParameters.StaticPropertyChanged += OnSystemParameterChanged;
SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;
}
public event EventHandler? Changed;
public bool IsOn => SystemParameters.HighContrast;
public ContrastPalette Palette => ContrastPalette.FromSystem();
public void Dispose()
{
SystemParameters.StaticPropertyChanged -= OnSystemParameterChanged;
SystemEvents.UserPreferenceChanged -= OnUserPreferenceChanged;
}
private void OnSystemParameterChanged(object? sender, PropertyChangedEventArgs e)
{
if (string.Equals(e.PropertyName, nameof(SystemParameters.HighContrast), StringComparison.Ordinal))
{
Changed?.Invoke(this, EventArgs.Empty);
}
}
private void OnUserPreferenceChanged(object? sender, UserPreferenceChangedEventArgs e)
{
if (IsOn && e.Category is UserPreferenceCategory.Color or UserPreferenceCategory.Accessibility or UserPreferenceCategory.VisualStyle)
{
Changed?.Invoke(this, EventArgs.Empty);
}
}
}
+37
View File
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
namespace FrameLedger.App.Services;
/// <summary>
/// What a theme choice comes to (beta.35, D91): the Fluent theme, the windows' backdrop, whether WPF UI watches Windows'
/// own theme, and whether a contrast theme's colours go over it. A contrast theme wins over the App's choice while it is on —
/// the theme under it is the light or the dark one as the contrast theme is, with no Mica — and the choice applies again
/// when it is off.
/// </summary>
public readonly record struct ThemePlan(ApplicationTheme Theme, WindowBackdropType Backdrop, bool WatchSystem, bool Contrast)
{
/// <summary>The plan for a choice in a state of Windows.</summary>
/// <param name="choice">Settings ▸ Theme.</param>
/// <param name="contrastOn">A Windows contrast theme is on.</param>
/// <param name="contrastDark">That contrast theme is a dark one (its window colour).</param>
/// <param name="systemDark">Windows' own app mode is dark (for <see cref="AppTheme.System"/>).</param>
public static ThemePlan For(AppTheme choice, bool contrastOn, bool contrastDark, bool systemDark)
{
if (contrastOn)
{
return new(contrastDark ? ApplicationTheme.Dark : ApplicationTheme.Light, WindowBackdropType.None, WatchSystem: false, Contrast: true);
}
return choice switch
{
AppTheme.System => new(systemDark ? ApplicationTheme.Dark : ApplicationTheme.Light, WindowBackdropType.Mica, WatchSystem: true, Contrast: false),
AppTheme.Light => new(ApplicationTheme.Light, WindowBackdropType.Mica, WatchSystem: false, Contrast: false),
AppTheme.Dark => new(ApplicationTheme.Dark, WindowBackdropType.Mica, WatchSystem: false, Contrast: false),
_ => throw new ArgumentOutOfRangeException(nameof(choice), choice, "not a theme"),
};
}
}
+97 -19
View File
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Diagnostics.CodeAnalysis;
using System.Windows;
using System.Windows.Threading;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
@@ -12,33 +14,109 @@ namespace FrameLedger.App.Services;
/// through <c>SystemThemeWatcher.Watch</c> on the window — which needs an HWND, so the caller passes the window
/// from its <c>Loaded</c> handler and never from a constructor — and <c>UnWatch</c> when switching to manual.
/// </summary>
public sealed class WpfThemeApplier : IThemeApplier
/// <remarks>
/// <b>A Windows contrast theme wins (beta.35, owner decision D91).</b> While one is on, the App's colours are its colours —
/// the light or the dark Fluent theme as the contrast theme is, under <see cref="ContrastOverlay"/>, with no Mica and no
/// system-theme watcher (WPF UI's would apply its own high-contrast dictionaries, 84 of whose 97 colours are a red
/// placeholder) — whatever Settings ▸ Theme says; the choice applies again when it is turned off. A switch in Windows is
/// followed at once (<see cref="IContrastSource.Changed"/>), and each call is the same for the same state, so the windows that
/// call it from their constructors change nothing.
/// </remarks>
public sealed class WpfThemeApplier : IThemeApplier, IDisposable
{
private readonly IContrastSource _contrast;
private AppTheme _theme = AppTheme.System;
private WeakReference<Window>? _window;
public WpfThemeApplier(IContrastSource contrast)
{
_contrast = contrast ?? throw new ArgumentNullException(nameof(contrast));
_contrast.Changed += OnContrastChanged;
}
public void Apply(AppTheme theme, Window? window)
{
switch (theme)
_theme = theme;
if (window is not null)
{
case AppTheme.System:
ApplicationThemeManager.Apply(SystemIsDark() ? ApplicationTheme.Dark : ApplicationTheme.Light, WindowBackdropType.Mica, true);
if (window is { IsLoaded: true })
{
SystemThemeWatcher.Watch(window, WindowBackdropType.Mica, true);
}
_window = new WeakReference<Window>(window);
}
break;
case AppTheme.Light:
case AppTheme.Dark:
if (window is not null)
{
SystemThemeWatcher.UnWatch(window);
}
Window? watched = window ?? (_window?.TryGetTarget(out Window? last) == true ? last : null);
bool contrastOn = _contrast.IsOn;
ContrastPalette? palette = contrastOn ? _contrast.Palette : null;
ThemePlan plan = ThemePlan.For(theme, contrastOn, palette?.IsDark ?? false, SystemIsDark());
ResourceDictionary resources = System.Windows.Application.Current.Resources;
if (plan.Contrast && palette is not null)
{
if (watched is not null)
{
SystemThemeWatcher.UnWatch(watched);
}
ApplicationThemeManager.Apply(theme == AppTheme.Dark ? ApplicationTheme.Dark : ApplicationTheme.Light, WindowBackdropType.Mica, true);
break;
default:
throw new ArgumentOutOfRangeException(nameof(theme), theme, "not a theme");
// The charts re-read their palette on the theme manager's Changed, which Apply raises: say the contrast first.
ContrastTheme.Active = palette;
ApplicationThemeManager.Apply(plan.Theme, plan.Backdrop, updateAccent: false);
ContrastOverlay.Install(resources, palette);
Backdrops(plan.Backdrop);
return;
}
bool wasContrast = ContrastOverlay.IsInstalled(resources);
ContrastOverlay.Remove(resources);
if (plan.WatchSystem)
{
ApplicationThemeManager.Apply(plan.Theme, plan.Backdrop, true);
if (watched is { IsLoaded: true })
{
SystemThemeWatcher.Watch(watched, plan.Backdrop, true);
}
}
else
{
if (watched is not null)
{
SystemThemeWatcher.UnWatch(watched);
}
ApplicationThemeManager.Apply(plan.Theme, plan.Backdrop, true);
}
if (wasContrast)
{
Backdrops(plan.Backdrop);
}
}
public void Dispose() => _contrast.Changed -= OnContrastChanged;
private static bool SystemIsDark() => ApplicationThemeManager.GetSystemTheme() is SystemTheme.Dark or SystemTheme.HCBlack or SystemTheme.Glow or SystemTheme.CapturedMotion;
/// <summary>Every FluentWindow's backdrop now, and again once a window being built has set its own from its XAML.</summary>
[SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs", Justification = "a WPF application has no JoinableTaskFactory; this posts to the windows' own dispatcher, after a window being built has loaded its XAML, and never waits (ScrollBarHiding does the same)")]
private static void Backdrops(WindowBackdropType backdrop)
{
static void Sweep(WindowBackdropType type)
{
foreach (FluentWindow window in System.Windows.Application.Current?.Windows.OfType<FluentWindow>() ?? [])
{
window.WindowBackdropType = type;
}
}
Sweep(backdrop);
_ = System.Windows.Application.Current?.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () => Sweep(backdrop));
}
[SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs", Justification = "Windows' setting change can arrive off the UI thread; the theme is the dispatcher's to change, posted and never waited on")]
private void OnContrastChanged(object? sender, EventArgs e)
{
Dispatcher? dispatcher = System.Windows.Application.Current?.Dispatcher;
if (dispatcher is null)
{
return;
}
_ = dispatcher.BeginInvoke(() => Apply(_theme, _window?.TryGetTarget(out Window? window) == true ? window : null));
}
}
+3
View File
@@ -1033,6 +1033,7 @@ public static class Strings
nameof(Settings_System_Copy),
nameof(Settings_System_Header),
nameof(Settings_System_Note),
nameof(Settings_Theme_ContrastOn),
nameof(Settings_Theme_Dark),
nameof(Settings_Theme_Label),
nameof(Settings_Theme_Light),
@@ -3269,6 +3270,8 @@ public static class Strings
public static string Settings_System_Note => ResourceManager.GetString(nameof(Settings_System_Note), Culture) ?? nameof(Settings_System_Note);
public static string Settings_Theme_ContrastOn => ResourceManager.GetString(nameof(Settings_Theme_ContrastOn), Culture) ?? nameof(Settings_Theme_ContrastOn);
public static string Settings_Theme_Dark => ResourceManager.GetString(nameof(Settings_Theme_Dark), Culture) ?? nameof(Settings_Theme_Dark);
public static string Settings_Theme_Label => ResourceManager.GetString(nameof(Settings_Theme_Label), Culture) ?? nameof(Settings_Theme_Label);
+4
View File
@@ -425,6 +425,10 @@
<value>テーマ</value>
<comment>review</comment>
</data>
<data name="Settings_Theme_ContrastOn" xml:space="preserve">
<value>Windows のコントラスト テーマがオンのため、FrameLedger はその色を使います。ここでの選択は、テーマをオフにすると再び適用されます。</value>
<comment>review</comment>
</data>
<data name="Settings_Theme_Light" xml:space="preserve">
<value>ライト</value>
<comment>review</comment>
+3
View File
@@ -324,6 +324,9 @@
<data name="Settings_Theme_Label" xml:space="preserve">
<value>Theme</value>
</data>
<data name="Settings_Theme_ContrastOn" xml:space="preserve">
<value>A Windows contrast theme is on, so FrameLedger uses its colours. The choice here applies again when it is off.</value>
</data>
<data name="Settings_Theme_Light" xml:space="preserve">
<value>Light</value>
</data>
+3
View File
@@ -319,6 +319,9 @@
<data name="Settings_Theme_Label" xml:space="preserve">
<value>Chủ đề</value>
</data>
<data name="Settings_Theme_ContrastOn" xml:space="preserve">
<value>Một contrast theme của Windows đang bật nên FrameLedger dùng màu của nó. Lựa chọn ở đây sẽ áp dụng lại khi tắt contrast theme.</value>
</data>
<data name="Settings_Theme_Light" xml:space="preserve">
<value>Sáng</value>
</data>
@@ -6,6 +6,7 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:controls="clr-namespace:FrameLedger.App.Controls"
xmlns:converters="clr-namespace:FrameLedger.App.Converters"
xmlns:services="clr-namespace:FrameLedger.App.Services"
xmlns:res="clr-namespace:FrameLedger.App">
<!--
Our styles, merged LAST (16_WPFUI_SYNTAX §App bootstrap). Colours only through theme brushes with
@@ -22,6 +23,47 @@
<converters:NotNullConverter x:Key="NotNull" />
<converters:ZeroToVisibleConverter x:Key="ZeroToVisible" />
<!--
Every ui:Button: WPF UI's style and two changes (beta.35). WPF UI 4.3.0's Danger appearance paints a fixed #F44336 — a
value in its button style, not a resource — under the button's own text, white in the dark theme: 3.68:1. A Danger
button's text is the theme's dark text on that red instead, 5.3:1 and 5.7:1 in the two themes. Under a Windows contrast
theme (D91), where no resource reaches that red, it is the theme's own button, as every button there is; its words and
its icon still say what it does. Implicit, so the buttons of WPF UI's message boxes get it too (Remove game, Delete
sessions, Database maintenance).
-->
<Style TargetType="ui:Button" BasedOn="{StaticResource {x:Type ui:Button}}">
<Style.Triggers>
<Trigger Property="Appearance" Value="Danger">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorDarkPrimaryBrush}" />
<Setter Property="PressedForeground" Value="{DynamicResource TextFillColorDarkPrimaryBrush}" />
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Appearance, RelativeSource={RelativeSource Self}}" Value="Danger" />
<Condition Binding="{Binding Path=(services:ContrastTheme.IsOn)}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource ButtonBackground}" />
<Setter Property="MouseOverBackground" Value="{DynamicResource ButtonBackgroundPointerOver}" />
<Setter Property="PressedBackground" Value="{DynamicResource ButtonBackgroundPressed}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
<Setter Property="PressedForeground" Value="{DynamicResource ButtonForegroundPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
<Setter Property="MouseOverBorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
<Setter Property="PressedBorderBrush" Value="{DynamicResource ButtonBorderBrushPressed}" />
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Appearance, RelativeSource={RelativeSource Self}}" Value="Danger" />
<Condition Binding="{Binding Path=(services:ContrastTheme.IsOn)}" Value="True" />
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="False" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundDisabled}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonForegroundDisabled}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushDisabled}" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="PageRoot" TargetType="StackPanel">
<Setter Property="Margin" Value="28,20,28,20" />
</Style>
@@ -114,6 +156,27 @@
</Style.Triggers>
</Style>
<!--
The agent's state in the title bar (beta.35). It was a ui:Badge with the Success, Info, Caution and Danger appearances,
WPF UI's fixed Material palette under the badge's own text: in the light theme 2.78, 2.63, 2.16 and 3.68:1. Now the
theme's own fills — success, caution, critical, and the neutral one while it is on its way — under the theme's text,
as the InfoBars are; under a contrast theme those are the theme's colours too. Its words say the state.
-->
<Style x:Key="AgentPill" TargetType="Border" BasedOn="{StaticResource Pill}">
<Setter Property="Margin" Value="0,0,12,0" />
<Style.Triggers>
<DataTrigger Binding="{Binding AgentStatusAppearance}" Value="Success">
<Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBackgroundBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding AgentStatusAppearance}" Value="Caution">
<Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBackgroundBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding AgentStatusAppearance}" Value="Danger">
<Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBackgroundBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
<!--
ui:InfoBar, re-templated (16_WPFUI_SYNTAX §Gotchas). WPF UI 4.3.0's own template has no ContentPresenter,
so an InfoBar's Content (the action button 08_UI §Notifications policy puts on every persistent banner)
+7 -4
View File
@@ -37,7 +37,10 @@ public sealed class UpdatePrompts(IUrlOpener urls, BugReportFlow bugReports) : I
body.Children.Add(notes);
}
body.Children.Add(new System.Windows.Controls.TextBlock { Text = Strings.Update_Unsigned_Footer, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 12, 0, 0), Opacity = 0.7 });
// beta.35 (D91): the muted text style, not an opacity — under a contrast theme a translucent text is no theme colour.
var footer = new System.Windows.Controls.TextBlock { Text = Strings.Update_Unsigned_Footer, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 12, 0, 0) };
footer.SetResourceReference(FrameworkElement.StyleProperty, "SecondaryText");
body.Children.Add(footer);
var box = new MessageBox
{
Title = string.Format(CultureInfo.CurrentCulture, Strings.Update_Available_Title_Format, candidate.Version),
@@ -46,7 +49,7 @@ public sealed class UpdatePrompts(IUrlOpener urls, BugReportFlow bugReports) : I
CloseButtonText = Strings.Update_Later,
MaxWidth = 640,
};
MessageBoxResult result = await box.ShowDialogAsync(cancellationToken: ct).ConfigureAwait(true);
MessageBoxResult result = await MessageBoxes.ShowAsync(box, ct).ConfigureAwait(true);
return result == MessageBoxResult.Primary;
}
@@ -98,7 +101,7 @@ public sealed class UpdatePrompts(IUrlOpener urls, BugReportFlow bugReports) : I
break;
}
MessageBoxResult result = await box.ShowDialogAsync(cancellationToken: ct).ConfigureAwait(true);
MessageBoxResult result = await MessageBoxes.ShowAsync(box, ct).ConfigureAwait(true);
if (result != MessageBoxResult.Primary)
{
return;
@@ -134,6 +137,6 @@ public sealed class UpdatePrompts(IUrlOpener urls, BugReportFlow bugReports) : I
CloseButtonText = Strings.Common_Ok,
MaxWidth = 560,
};
await box.ShowDialogAsync(cancellationToken: ct).ConfigureAwait(true);
await MessageBoxes.ShowAsync(box, ct).ConfigureAwait(true);
}
}
@@ -34,6 +34,12 @@ public sealed partial class ImportCandidateViewModel : ObservableObject
/// </summary>
public bool IsExisting => Candidate.AlreadyInLibrary || Candidate.MovedFrom is not null;
/// <summary>
/// The row is drawn dimmed: one already in the library, except under a Windows contrast theme (beta.35, D91), where a
/// translucent row is no theme colour and the note column says it already is.
/// </summary>
public bool IsDimmed => IsExisting && Services.ContrastTheme.Active is null;
public string PlatformText => Formats.Platform(Candidate.Game.Platform);
public string Name => Candidate.Game.Name;
@@ -27,6 +27,7 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable,
private readonly ShellAnnouncements _said;
private readonly IShellPresence _shell;
private readonly IPageNavigator _navigator;
private readonly PageFocus? _pageFocus;
private readonly UiThread _ui = new();
[ObservableProperty]
@@ -67,8 +68,9 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable,
public MainWindowViewModel(IAgentLink agent, IMessageStrip strip, IShellPresence shell, IPageNavigator navigator, AddGameFlow addGame, SafetyNotices notices,
BugReportFlow bugReports, IUrlOpener urls, SessionSelection selection, SessionExportService exports, ISessionSummaryOpener summaries, ImportLibraryFlow import,
UpdateService updates, IDatabaseMaintenancePrompts maintenance, IDocumentWindows documents, UiMode? mode = null, BuildLine? line = null,
IAnnouncer? announcer = null)
IAnnouncer? announcer = null, PageFocus? pageFocus = null)
{
_pageFocus = pageFocus;
_mode = mode ?? UiMode.Profile;
_line = line ?? BuildLine.Current;
_isAlphaBannerOpen = _line.IsAlpha;
@@ -205,9 +207,18 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable,
[RelayCommand]
private void Exit() => _shell.Quit();
/// <summary>08_UI §Accessibility: Ctrl+1…5 (and the keypad) — the NavigationView's pages in its order.</summary>
/// <summary>
/// 08_UI §Accessibility: Ctrl+1…5 (and the keypad) — the NavigationView's pages in its order; since beta.35 the page then
/// takes the keyboard and its title is said (<see cref="PageFocus"/>).
/// </summary>
[RelayCommand]
private void NavigateTo(string? key) => _ = ShellShortcuts.Navigate(_navigator, key);
private void NavigateTo(string? key)
{
if (ShellShortcuts.Navigate(_navigator, key))
{
_pageFocus?.Request();
}
}
/// <summary>Tools ▸ Agent status… is the Dashboard's Agent card.</summary>
[RelayCommand]
+12 -6
View File
@@ -340,9 +340,13 @@ TEST_CASE("a tiny ring, so the writer laps the reader constantly", "[ring]") {
constexpr std::uint32_t kTotal = 200000;
std::uint64_t mostOverlapped = 0;
std::uint64_t dropped = 0; // the last attempt's: the one that overlapped, when one did
std::uint64_t overlappedLast = 0; // the last attempt's two counts: the one that overlapped AND was lapped,
std::uint64_t dropped = 0; // when one was
int attempts = 0;
while (mostOverlapped < kMinOverlappedDrains && attempts < kMaxAttempts) {
// Repeated until one attempt both overlapped the writer and was lapped by it (2026-11-09: CI's attempt overlapped
// 167058 drains and the reader still kept up with all 200000 records, dropping none). A reader that never counts a
// drop fails all eight attempts, so the retry keeps the check's power.
while ((overlappedLast < kMinOverlappedDrains || dropped == 0) && attempts < kMaxAttempts) {
++attempts;
Mapping m{kTiny};
RingWriter w;
@@ -392,6 +396,7 @@ TEST_CASE("a tiny ring, so the writer laps the reader constantly", "[ring]") {
}
producer.join();
dropped = lost;
overlappedLast = overlapped;
INFO("attempt " << attempts << ": accepted " << accepted << ", overlapped drains " << overlapped << " of "
<< kTotal);
@@ -400,11 +405,12 @@ TEST_CASE("a tiny ring, so the writer laps the reader constantly", "[ring]") {
mostOverlapped = std::max(mostOverlapped, overlapped);
}
INFO("attempts " << attempts << ", most overlapped drains " << mostOverlapped << ", dropped " << dropped);
INFO("attempts " << attempts << ", most overlapped drains " << mostOverlapped << ", the last attempt's "
<< overlappedLast << ", dropped " << dropped);
// Not vacuous: the reader read the ring while the writer was writing it. `dropped > 0` alone could not say so — a
// reader that started after the writer had finished drops nearly everything — and with eight slots the attempt
// that overlapped (the last one) is lapped, which the second check holds it to.
CHECK(mostOverlapped >= kMinOverlappedDrains);
// reader that started after the writer had finished drops nearly everything — so both hold in the same attempt, the
// last one: it overlapped and, with eight slots, was lapped.
CHECK(overlappedLast >= kMinOverlappedDrains);
CHECK(dropped > 0);
}
@@ -37,6 +37,26 @@ public sealed class AnnouncementsTests
public void Show(string title, string message, ControlAppearance appearance, IconElement? icon, TimeSpan timeout) => Shown.Add((title, message, appearance));
}
/// <summary>
/// beta.35: every message is drawn in the theme's colours, its icon saying which kind it is — WPF UI's Success and Caution
/// snackbars are white on fixed green and orange, 2.78:1 and 2.16:1 in both themes, and no contrast theme reaches them.
/// </summary>
[Fact]
public async Task EveryMessageOfTheStripIsDrawnInTheThemesOwnColours()
{
var snackbar = new FakeSnackbar();
await PagesLoadTests.OnStaAsync(() =>
{
var strip = new SnackbarStrip(snackbar);
strip.Info("a", "b");
strip.Success("c", "d");
strip.Warn("e", "f");
return 0;
});
snackbar.Shown.Select(static s => s.Appearance).Should().Equal(ControlAppearance.Secondary, ControlAppearance.Secondary, ControlAppearance.Secondary);
}
[Fact]
public async Task EveryMessageOfTheStripIsSaidAsItIsShownAndAWarningIsAnAlert()
{
@@ -0,0 +1,296 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Xml.Linq;
using FluentAssertions;
using FrameLedger.App.Charts;
using FrameLedger.App.Controls;
using FrameLedger.App.Services;
using FrameLedger.Domain.Metrics;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
namespace FrameLedger.App.Tests;
/// <summary>What the App draws itself under a contrast theme (beta.35, D91): the badges, the mix bar, the Remove button.</summary>
public sealed partial class ContrastThemeTests
{
// Danger is not here: the App's implicit button style makes it read, and the theme's own button under a contrast theme.
private static readonly string[] _fixedColourAppearances = ["Info", "Success", "Caution", "Dark", "Light"];
/// <summary>
/// The change badge and the frame-generation bar repaint when a contrast theme comes on even if its window colour is the
/// Fluent theme's — Aquatic's <c>#202020</c> is the dark theme's own. They hear a theme through a resource reference to
/// <c>ApplicationBackgroundColor</c>, and measured 2026-11-09 the overlay going on re-reads it and calls them though the
/// colour is the same; this holds that, so no second signal is needed.
/// </summary>
[Fact]
public async Task TheBadgeAndTheMixBarRepaintWhenAContrastThemeKeepsTheWindowColour()
{
var facts = await PagesLoadTests.OnStaAsync(() => Visuals.UnderTheme(ApplicationTheme.Dark, () =>
{
ResourceDictionary resources = System.Windows.Application.Current.Resources;
ContrastPalette same = EditedDark with { Window = (Color)System.Windows.Application.Current.FindResource("ApplicationBackgroundColor") };
var badge = new ChangeBadge { Text = "1" };
var bar = new FgMixBar { Segments = [new FgMixSegment(FgMixKind.None, null, 1)], Width = 60, Height = 14 };
var panel = new System.Windows.Controls.StackPanel();
panel.Children.Add(badge);
panel.Children.Add(bar);
var host = new FluentWindow { Content = panel, Width = 200, Height = 120, ShowActivated = false, WindowStartupLocation = WindowStartupLocation.Manual, Left = -10000, Top = -10000 };
host.Show();
try
{
Visuals.Pump();
Color before = ((SolidColorBrush)badge.Background).Color;
Color barBefore = Pixel(panel, bar);
ContrastOverlay.Install(resources, same);
try
{
Visuals.Pump();
return (Before: before, During: ((SolidColorBrush)badge.Background).Color, Text: ((SolidColorBrush)badge.Foreground).Color,
BarBefore: barBefore, BarDuring: Pixel(panel, bar), Palette: same);
}
finally
{
ContrastOverlay.Remove(resources);
}
}
finally
{
host.Close();
}
}));
facts.During.Should().NotBe(facts.Before, "the badge heard the contrast theme though the window colour stayed");
facts.Palette.Colors.Should().Contain(facts.During).And.Contain(facts.Text);
facts.BarDuring.Should().NotBe(facts.BarBefore, "and the bar redrew");
facts.Palette.Colors.Should().Contain(facts.BarDuring);
}
/// <summary>
/// WPF UI 4.3.0 paints its Info, Success, Caution, Dark and Light buttons a fixed colour under white text that no theme
/// reaches, and a badge with a bound appearance escapes <c>ContrastTests</c>' look at the literal ones — the agent's pill was
/// one, 2.16:1 in the light theme. Danger is allowed: the App's own button style makes it read (below).
/// </summary>
[Fact]
public void NoButtonOrBadgeTakesAnAppearanceThatPaintsAFixedColour()
{
var offenders = new List<string>();
foreach ((string file, XDocument xaml) in AccessibilityTests.AppXaml())
{
foreach (XElement element in xaml.Descendants())
{
string name = element.Name.LocalName;
string? appearance = element.Attribute("Appearance")?.Value;
if (appearance is null)
{
continue;
}
if (name.EndsWith("Button", StringComparison.Ordinal) && _fixedColourAppearances.Contains(appearance, StringComparer.Ordinal))
{
offenders.Add($"{file}: {name} Appearance=\"{appearance}\"");
}
if (string.Equals(name, "Badge", StringComparison.Ordinal) && appearance.StartsWith('{'))
{
offenders.Add($"{file}: a Badge whose appearance is bound, {appearance}");
}
}
foreach (XElement setter in xaml.Descendants().Where(static e => string.Equals(e.Name.LocalName, "Setter", StringComparison.Ordinal)
&& string.Equals(e.Attribute("Property")?.Value, "Appearance", StringComparison.Ordinal)))
{
if (setter.Attribute("Value")?.Value is { } value && _fixedColourAppearances.Contains(value, StringComparer.Ordinal))
{
offenders.Add($"{file}: a style sets Appearance=\"{value}\"");
}
}
}
offenders.Should().BeEmpty("a fixed colour under white text reads below 3:1 in a theme and is no contrast theme's colour");
}
/// <summary>
/// A Danger button — the game page's Remove, the message boxes' Delete — reads in both themes (the App's implicit button
/// style puts the theme's dark text on WPF UI's fixed red, where its own white read 3.68:1 in the dark theme) and is the
/// theme's own button while a contrast theme is on, changing at once.
/// </summary>
[Fact]
public async Task ADangerButtonReadsInBothThemesAndIsTheThemesOwnButtonUnderAContrastTheme()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
static (Color Face, Color Text) Drawn(Wpf.Ui.Controls.Button b) => (((SolidColorBrush)b.Background).Color, ((SolidColorBrush)b.Foreground).Color);
(Color Face, Color Text) Under(ApplicationTheme theme, Func<Wpf.Ui.Controls.Button, (Color, Color)> read) => Visuals.UnderTheme(theme, () =>
{
var button = new Wpf.Ui.Controls.Button { Content = "Remove…", Appearance = ControlAppearance.Danger };
var host = new FluentWindow { Content = button, Width = 200, Height = 120, ShowActivated = false, WindowStartupLocation = WindowStartupLocation.Manual, Left = -10000, Top = -10000 };
host.Show();
try
{
Visuals.Pump();
return read(button);
}
finally
{
ContrastOverlay.Remove(System.Windows.Application.Current.Resources);
host.Close();
}
});
(Color Face, Color Text) dark = Under(ApplicationTheme.Dark, Drawn);
(Color Face, Color Text) light = Under(ApplicationTheme.Light, Drawn);
(Color, Color) on = default;
(Color, Color) off = Under(ApplicationTheme.Dark, b =>
{
ContrastOverlay.Install(System.Windows.Application.Current.Resources, EditedDark);
Visuals.Pump();
on = Drawn(b);
ContrastOverlay.Remove(System.Windows.Application.Current.Resources);
Visuals.Pump();
return Drawn(b);
});
return (dark, light, on, off);
});
ColorMath.Contrast(facts.dark.Text, facts.dark.Face).Should().BeGreaterThanOrEqualTo(4.5, "the dark theme's white read 3.68:1 on #F44336");
ColorMath.Contrast(facts.light.Text, facts.light.Face).Should().BeGreaterThanOrEqualTo(4.5);
facts.on.Should().Be((EditedDark.ButtonFace, EditedDark.ButtonText), "turned on while the button is shown, it is the theme's button at once");
facts.off.Should().Be(facts.dark, "and turned off, the red one again");
}
/// <summary>
/// The title bar's two marks read in every state, in both themes and under a contrast theme: the agent's state on the
/// theme's own fills (<c>AgentPill</c>, which replaced a palette badge: 2.78, 2.63, 2.16 and 3.68:1 in the light theme)
/// and the alpha build's badge, the accent under its own text.
/// </summary>
[Theory]
[InlineData("Dark")]
[InlineData("Light")]
[InlineData("HC1")]
[InlineData("HCWhite")]
[InlineData("EditedLight")]
public async Task TheTitleBarsMarksReadInEveryState(string name)
{
ControlAppearance[] states = [ControlAppearance.Success, ControlAppearance.Info, ControlAppearance.Caution, ControlAppearance.Danger];
var facts = await PagesLoadTests.OnStaAsync(() =>
{
ContrastPalette? palette = name is "Dark" or "Light" ? null : Named(name);
List<(string Mark, Color Text, Color Under)> Measure()
{
var panel = new System.Windows.Controls.StackPanel();
var marks = new List<(string Mark, System.Windows.Controls.TextBlock Text)>();
foreach (ControlAppearance state in states)
{
var text = new System.Windows.Controls.TextBlock { Text = state.ToString() };
text.SetResourceReference(System.Windows.Controls.TextBlock.ForegroundProperty, "TextFillColorPrimaryBrush");
panel.Children.Add(new System.Windows.Controls.Border
{
Style = (Style)System.Windows.Application.Current.FindResource("AgentPill"),
DataContext = new { AgentStatusAppearance = state },
Child = text,
});
marks.Add(("agent " + state, text));
}
var alpha = new Badge { Appearance = ControlAppearance.Primary, Content = "Alpha" };
panel.Children.Add(alpha);
var host = new FluentWindow { Content = panel, Width = 300, Height = 300, ShowActivated = false, WindowStartupLocation = WindowStartupLocation.Manual, Left = -10000, Top = -10000 };
host.Show();
try
{
Visuals.Pump();
marks.Add(("alpha badge", Visuals.FindAll<System.Windows.Controls.TextBlock>(alpha).Single()));
Color window = (Color)System.Windows.Application.Current.FindResource("ApplicationBackgroundColor");
return [.. marks.Select(m =>
{
Color under = Visuals.PaintedUnder(m.Text, panel, window);
return (m.Mark, Visuals.TextOver(m.Text, under), under);
})];
}
finally
{
host.Close();
}
}
if (palette is null)
{
return Visuals.UnderTheme(Enum.Parse<ApplicationTheme>(name), Measure);
}
List<(string Mark, Color Text, Color Under)> drawn = Visuals.UnderContrast(palette, Measure);
return [.. drawn.Select(m => (palette.Colors.Contains(m.Text) && palette.Colors.Contains(m.Under) ? m.Mark : m.Mark + " (not the theme's colours)", m.Text, m.Under))];
});
facts.Should().HaveCount(5);
facts.Where(static m => ColorMath.Contrast(m.Text, m.Under) < 4.5 || m.Mark.EndsWith(')')).Select(static m => $"{m.Mark}: {m.Text} on {m.Under}, {ColorMath.Contrast(m.Text, m.Under):0.00}:1")
.Should().BeEmpty($"every mark in the title bar reads at 4.5:1 under {name}");
}
[Fact]
public async Task TheContrastThemeSaysWhenItComesAndGoes()
{
// Heard on the STA thread inside the one work item: the other tests' contrast themes come and go on it too.
(List<string> heard, bool on) = await PagesLoadTests.OnStaAsync(() =>
{
var said = new List<string>();
void Heard(object? sender, PropertyChangedEventArgs e) => said.Add(e.PropertyName!);
ContrastTheme.StaticPropertyChanged += Heard;
try
{
var resources = new ResourceDictionary();
ContrastOverlay.Install(resources, EditedDark);
ContrastOverlay.Install(resources, EditedDark);
ContrastOverlay.Install(resources, EditedLight);
ContrastOverlay.Remove(resources);
return (said, ContrastTheme.IsOn);
}
finally
{
ContrastTheme.StaticPropertyChanged -= Heard;
}
});
heard.Should().Equal(["Active", "IsOn", "Active", "Active", "IsOn"], "on, another palette while on, off — the same palette twice says nothing, and a palette replaced is never off between");
on.Should().BeFalse();
}
[Fact]
public async Task UnderAContrastThemeAChartBadgesTextIsTheThemesColourThatReadsBest()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
var resources = new ResourceDictionary();
ContrastOverlay.Install(resources, EditedLight);
try
{
return (OnHotTrack: ChartTheme.ToWpf(ChartTheme.TextOn(ChartTheme.ToScottPlot(EditedLight.HotTrack))),
OnWindow: ChartTheme.ToWpf(ChartTheme.TextOn(ChartTheme.ToScottPlot(EditedLight.Window))));
}
finally
{
ContrastOverlay.Remove(resources);
}
});
facts.OnHotTrack.Should().Be(EditedLight.Window, "white reads best on the edited theme's dark blue link colour, and white is its window");
facts.OnWindow.Should().Be(EditedLight.WindowText);
}
/// <summary>The colour drawn at the middle of <paramref name="element"/>, rendered as part of <paramref name="root"/>.</summary>
private static Color Pixel(FrameworkElement root, FrameworkElement element)
{
var bitmap = new RenderTargetBitmap((int)Math.Ceiling(root.ActualWidth), (int)Math.Ceiling(root.ActualHeight), 96, 96, PixelFormats.Pbgra32);
bitmap.Render(root);
Point middle = element.TranslatePoint(new Point(element.ActualWidth / 2, element.ActualHeight / 2), root);
byte[] pixel = new byte[4];
bitmap.CopyPixels(new Int32Rect((int)middle.X, (int)middle.Y, 1, 1), pixel, 4, 0);
return Color.FromArgb(pixel[3], pixel[2], pixel[1], pixel[0]);
}
}
@@ -0,0 +1,349 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Media;
using FluentAssertions;
using FrameLedger.App.Charts;
using FrameLedger.App.Services;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
using Wpf.Ui.Markup;
namespace FrameLedger.App.Tests;
/// <summary>
/// Windows contrast themes, followed (beta.35, owner decision D91): every WPF UI theme resource gets the user's colour for
/// its role, read from WPF UI's own four high-contrast dictionaries; the App's own colours — the charts', the bar's, the
/// badges' — come from the same eight; a theme choice gives way to a contrast theme while it is on. A test cannot turn a
/// contrast theme on in Windows, so the palettes are WPF UI's four defaults and two the user might have edited.
/// </summary>
public sealed partial class ContrastThemeTests
{
/// <summary>A dark contrast theme with every colour edited — the button face no longer the window's.</summary>
internal static readonly ContrastPalette EditedDark = new(Color.FromRgb(0x10, 0x10, 0x18), Color.FromRgb(0xFF, 0xFF, 0x00), Color.FromRgb(0x1A, 0xEB, 0xFF),
Color.FromRgb(0x00, 0x00, 0x00), Color.FromRgb(0x75, 0xE1, 0xFF), Color.FromRgb(0x3F, 0xF2, 0x3F), Color.FromRgb(0x20, 0x20, 0x40), Color.FromRgb(0xFF, 0xFF, 0xFF));
/// <summary>A light one, edited the same way.</summary>
internal static readonly ContrastPalette EditedLight = new(Color.FromRgb(0xFF, 0xFF, 0xFF), Color.FromRgb(0x10, 0x10, 0x10), Color.FromRgb(0x37, 0x00, 0x6E),
Color.FromRgb(0xFF, 0xFF, 0xFF), Color.FromRgb(0x00, 0x00, 0x9F), Color.FromRgb(0x60, 0x00, 0x00), Color.FromRgb(0xF0, 0xF0, 0xE0), Color.FromRgb(0x20, 0x20, 0x20));
private static readonly Color _red = Color.FromArgb(0xFF, 0xFF, 0, 0);
private static readonly string[] _fluentThemes = ["Dark", "Light"];
[GeneratedRegex(@"(?:DynamicResource|StaticResource)\s+(?<key>[A-Za-z]\w+)\}|(?:SetResourceReference\([^,]+,\s*|FindResource\(|TryFindResource\()""(?<key>[A-Za-z]\w+)""", RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant, 1000)]
private static partial Regex ResourceKey();
/// <summary>A named palette for a theory: WPF UI's four defaults by file name, and the two edited ones.</summary>
internal static ContrastPalette Named(string name) => name switch
{
"EditedDark" => EditedDark,
"EditedLight" => EditedLight,
_ => ContrastRoles.PaletteOf(ContrastRoles.Load(name)),
};
/// <summary>
/// The reason the App does not apply WPF UI's high-contrast dictionaries, pinned: the theme name has no file, and each
/// file's colours are mostly placeholders. When WPF UI fixes them this goes red, and the overlay may not be needed.
/// </summary>
[Fact]
public async Task WpfUisHighContrastThemeIsStillPlaceholdersAndAMissingFile()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
string missing;
try
{
_ = new ThemesDictionary { Theme = ApplicationTheme.HighContrast };
missing = "loaded";
}
catch (Exception ex) when (ex is IOException or System.Windows.Markup.XamlParseException or InvalidOperationException)
{
missing = ex.GetType().Name;
}
int red = 0;
foreach (string theme in ContrastRoles.ThemeNames)
{
ResourceDictionary d = ContrastRoles.Load(theme);
red += d.Keys.OfType<string>().Count(k => TryRead(d, k) is Color c && c == _red);
}
return (missing, red);
});
facts.missing.Should().NotBe("loaded", "WPF UI 4.3.0 names a HighContrast theme it has no dictionary for");
facts.red.Should().BeGreaterThan(200, "84 of 97 colours of each high-contrast dictionary are a red placeholder (2026-11-09)");
}
[Fact]
public async Task EveryKeyOfWpfUisContrastThemesHasARoleAndThePlaceholdersTooAndNoneIsRed()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
IReadOnlyDictionary<string, (ContrastRole Role, bool Brush)> roles = ContrastRoles.Map;
var missing = new List<string>();
foreach (string theme in ContrastRoles.ThemeNames)
{
ResourceDictionary d = ContrastRoles.Load(theme);
missing.AddRange(d.Keys.OfType<string>().Where(k => !roles.ContainsKey(k) && !ContrastRoles.Clear.ContainsKey(k)).Select(k => theme + ": " + k));
}
ResourceDictionary overlay = ContrastOverlay.Build(EditedDark);
string[] red = [.. overlay.Keys.OfType<string>().Where(k => ColourOf(overlay[k]) == _red)];
return (roles.Count, Missing: missing.Distinct(StringComparer.Ordinal).ToList(), Red: red, Clear: ContrastRoles.Clear.Keys.ToList(),
Pressed: roles["MenuBarItemBackgroundPressed"].Role, PressedText: roles["MenuBarItemTextForegroundPressed"].Role,
Critical: roles["SystemFillColorCriticalBrush"].Role, Text: roles["TextFillColorSecondary"].Role);
});
facts.Count.Should().BeGreaterThan(400);
facts.Missing.Should().BeEmpty("every key stands for one of the theme's colours or is transparent");
facts.Red.Should().BeEmpty("no placeholder survives the overlay");
facts.Clear.Should().Contain(["MenuBarBackground", "ControlFillColorTransparentBrush", "SubtleFillColorTransparentBrush"]);
facts.Pressed.Should().Be(ContrastRole.Highlight, "a brush WPF UI's file cannot load alone, read in the App as a translucent Fluent fill, takes its role from its name");
facts.PressedText.Should().Be(ContrastRole.HighlightText, "so a pressed menu item is the highlight's text on the highlight, not white on white");
facts.Critical.Should().Be(ContrastRole.WindowText, "a system fill with no Background in its name is an icon's colour");
facts.Text.Should().Be(ContrastRole.WindowText, "a placeholder colour takes its brush twin's role");
}
/// <summary>
/// The roles do not depend on the Fluent theme lying under the App when they are first read: the brushes that throw when
/// WPF UI's file is read alone fall back to the application's resources — the Fluent theme's fills — inside the App.
/// </summary>
[Fact]
public async Task TheRolesAreTheSameWhicheverFluentThemeLiesUnderThem()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
static (IReadOnlyDictionary<string, (ContrastRole Role, bool Brush)> Roles, IReadOnlyDictionary<string, bool> Clear) Read() =>
ContrastRoles.Infer([.. ContrastRoles.ThemeNames.Select(ContrastRoles.Load)]);
var dark = Visuals.UnderTheme(ApplicationTheme.Dark, Read);
var light = Visuals.UnderTheme(ApplicationTheme.Light, Read);
return (Dark: dark.Roles.OrderBy(static p => p.Key, StringComparer.Ordinal).Select(static p => $"{p.Key}={p.Value}").ToList(),
Light: light.Roles.OrderBy(static p => p.Key, StringComparer.Ordinal).Select(static p => $"{p.Key}={p.Value}").ToList(),
DarkClear: dark.Clear.Keys.Order(StringComparer.Ordinal).ToList(), LightClear: light.Clear.Keys.Order(StringComparer.Ordinal).ToList());
});
facts.Light.Should().Equal(facts.Dark);
facts.LightClear.Should().Equal(facts.DarkClear);
}
/// <summary>No colour of a Fluent theme shows through: every colour key the light and the dark themes have, the overlay has.</summary>
[Fact]
public async Task EveryColourOfTheFluentThemesIsOneTheOverlayGives()
{
List<string> uncovered = await PagesLoadTests.OnStaAsync(() =>
{
ResourceDictionary overlay = ContrastOverlay.Build(EditedDark);
var found = new List<string>();
foreach (string theme in _fluentThemes)
{
var d = new ResourceDictionary { Source = new Uri($"pack://application:,,,/Wpf.Ui;component/Resources/Theme/{theme}.xaml", UriKind.Absolute) };
found.AddRange(d.Keys.OfType<string>().Where(k => TryRead(d, k) is Color or Brush && !overlay.Contains(k) && !ContrastOverlay.AccentKeys.ContainsKey(k)).Select(k => theme + ": " + k));
}
return found;
});
uncovered.Should().BeEmpty("a key the Fluent themes colour and no contrast dictionary has goes in ContrastOverlay.FluentOnlyKeys with its role");
}
/// <summary>
/// With each default theme's own colours, the overlay gives every key the colour WPF UI's file gives it — but the text on
/// the accent, which the App departs from on purpose (<see cref="TheTextOnTheAccentIsTheHighlightsText"/>).
/// </summary>
[Fact]
public async Task OnEachDefaultThemeTheOverlayGivesEveryKeyTheColourWpfUiGivesIt()
{
List<string> different = await PagesLoadTests.OnStaAsync(() =>
{
var found = new List<string>();
foreach (string theme in ContrastRoles.ThemeNames)
{
ResourceDictionary d = ContrastRoles.Load(theme);
ContrastPalette palette = ContrastRoles.PaletteOf(d);
ResourceDictionary overlay = ContrastOverlay.Build(palette);
foreach (string key in overlay.Keys.OfType<string>().Where(static k => !ContrastOverlay.OnAccentKeys.ContainsKey(k)))
{
if (ColourOf(TryRead(d, key)) is { A: 0xFF } wpfUi && palette.Colors.Contains(wpfUi) && ColourOf(overlay[key]) is { } ours
&& Color.FromRgb(ours.R, ours.G, ours.B) != Color.FromRgb(wpfUi.R, wpfUi.G, wpfUi.B))
{
found.Add($"{theme}: {key} is {ours} in the overlay, {wpfUi} in WPF UI's file");
}
}
}
return found;
});
string.Join(Environment.NewLine, different).Should().BeEmpty("on Windows' own default contrast themes the overlay is WPF UI's colours, key for key");
}
/// <summary>
/// The chips the App draws on the accent — the frame-generation factor, RT/PT/RR, the upscaler — read under a contrast
/// theme: the accent is the highlight there, so its text is the highlight's text, where WPF UI's files say the window's.
/// </summary>
[Fact]
public async Task TheTextOnTheAccentIsTheHighlightsText()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
ResourceDictionary hc1 = ContrastRoles.Load("HC1");
ContrastPalette palette = ContrastRoles.PaletteOf(hc1);
ResourceDictionary overlay = ContrastOverlay.Build(palette);
return (Ours: ColourOf(overlay["TextOnAccentFillColorPrimaryBrush"]), WpfUi: ColourOf(TryRead(hc1, "TextOnAccentFillColorPrimaryBrush")), palette.HighlightText, palette.WindowText,
Ratio: ColorMath.Contrast(palette.HighlightText, palette.Highlight), WpfUiRatio: ColorMath.Contrast(palette.WindowText, palette.Highlight));
});
facts.Ours.Should().Be(facts.HighlightText);
facts.WpfUi.Should().Be(facts.WindowText, "WPF UI 4.3.0's contrast files put the window text on the accent");
facts.Ratio.Should().BeGreaterThanOrEqualTo(4.5);
facts.WpfUiRatio.Should().BeLessThan(3, "white on Dusk's highlight, 1.62:1 — what the chips read before");
}
[Theory]
[InlineData("EditedDark")]
[InlineData("EditedLight")]
public async Task AnEditedThemesColoursReachEveryKey(string name)
{
List<string> foreign = await PagesLoadTests.OnStaAsync(() =>
{
ContrastPalette palette = Named(name);
ResourceDictionary overlay = ContrastOverlay.Build(palette);
return overlay.Keys.OfType<string>().Where(k => ColourOf(overlay[k]) is not { } c || !(palette.Colors.Contains(c) || (c.A == 0 && ContrastRoles.Clear.ContainsKey(k)))).ToList();
});
foreign.Should().BeEmpty("every colour of the overlay is one of the user's eight, or transparent where WPF UI's contrast themes are");
}
[Fact]
public async Task InstallPutsTheColoursAndTheAccentOnAndRemoveTakesThemOff()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
var resources = new ResourceDictionary();
ContrastOverlay.Install(resources, EditedDark);
var on = (Installed: ContrastOverlay.IsInstalled(resources), Active: ContrastTheme.Active, Accent: ColourOf(resources["AccentFillColorDefaultBrush"]),
OnAccent: ColourOf(resources["TextOnAccentFillColorPrimary"]), Merged: resources.MergedDictionaries.Count);
ContrastOverlay.Install(resources, EditedLight);
int again = resources.MergedDictionaries.Count;
ContrastOverlay.Remove(resources);
return (on, again, Off: ContrastOverlay.IsInstalled(resources), ActiveOff: ContrastTheme.Active);
});
facts.on.Installed.Should().BeTrue();
facts.on.Active.Should().Be(EditedDark);
facts.on.Accent.Should().Be(EditedDark.Highlight, "the accent the theme manager writes into the application's resources becomes the highlight");
facts.on.OnAccent.Should().Be(EditedDark.HighlightText);
facts.again.Should().Be(1, "installing again replaces the overlay");
facts.Off.Should().BeFalse();
facts.ActiveOff.Should().BeNull();
}
/// <summary>Every resource the App's XAML and code read resolves under a contrast theme, and to no placeholder.</summary>
[Theory]
[InlineData("HC1")]
[InlineData("HCWhite")]
[InlineData("EditedDark")]
public async Task EveryResourceTheAppReadsResolvesUnderAContrastTheme(string name)
{
string app = Path.Combine(AccessibilityTests.RepoRoot(), "src", "FrameLedger.App");
HashSet<string> keys = new(Directory.EnumerateFiles(app, "*.*", SearchOption.AllDirectories)
.Where(static f => (f.EndsWith(".xaml", StringComparison.Ordinal) || f.EndsWith(".cs", StringComparison.Ordinal))
&& !f.Contains(Path.DirectorySeparatorChar + "obj" + Path.DirectorySeparatorChar, StringComparison.Ordinal))
.SelectMany(static f => ResourceKey().Matches(File.ReadAllText(f)).Select(static m => m.Groups["key"].Value)), StringComparer.Ordinal);
List<string> broken = await PagesLoadTests.OnStaAsync(() => Visuals.UnderContrast(Named(name), () =>
keys.Where(k => System.Windows.Application.Current.TryFindResource(k) is var v && (v is null || ColourOf(v) == _red)).Order(StringComparer.Ordinal).ToList()));
keys.Should().HaveCountGreaterThan(40);
string.Join(", ", broken).Should().BeEmpty("a resource the App reads either resolves under a contrast theme or is not one the App reads");
}
[Fact]
public void AContrastThemeWinsOverTheChoiceAndTheChoiceComesBack()
{
ThemePlan.For(AppTheme.Light, contrastOn: true, contrastDark: true, systemDark: false)
.Should().Be(new ThemePlan(ApplicationTheme.Dark, WindowBackdropType.None, WatchSystem: false, Contrast: true), "a dark contrast theme lies over the dark Fluent theme, whatever the choice");
ThemePlan.For(AppTheme.Dark, contrastOn: true, contrastDark: false, systemDark: true).Theme.Should().Be(ApplicationTheme.Light);
ThemePlan.For(AppTheme.System, contrastOn: true, contrastDark: false, systemDark: true).WatchSystem.Should().BeFalse("WPF UI's watcher would apply its own high-contrast files");
ThemePlan.For(AppTheme.System, contrastOn: false, contrastDark: false, systemDark: true)
.Should().Be(new ThemePlan(ApplicationTheme.Dark, WindowBackdropType.Mica, WatchSystem: true, Contrast: false));
ThemePlan.For(AppTheme.Light, contrastOn: false, contrastDark: true, systemDark: true)
.Should().Be(new ThemePlan(ApplicationTheme.Light, WindowBackdropType.Mica, WatchSystem: false, Contrast: false), "off again, the choice applies");
FluentActions.Invoking(static () => ThemePlan.For((AppTheme)99, false, false, false)).Should().Throw<ArgumentOutOfRangeException>();
}
private sealed class FakeContrast : IContrastSource
{
public event EventHandler? Changed;
public bool IsOn { get; set; }
public ContrastPalette Palette { get; set; } = EditedDark;
public void Raise() => Changed?.Invoke(this, EventArgs.Empty);
}
/// <summary>The applier follows a contrast theme on and off as Windows reports it, whatever Settings ▸ Theme says.</summary>
[Fact]
public async Task TheApplierFollowsAContrastThemeOnAndOffAtOnce()
{
var facts = await PagesLoadTests.OnStaAsync(() => Visuals.UnderTheme(ApplicationTheme.Dark, () =>
{
var source = new FakeContrast { IsOn = true, Palette = EditedLight };
using var applier = new WpfThemeApplier(source);
ResourceDictionary resources = System.Windows.Application.Current.Resources;
applier.Apply(AppTheme.Dark, null);
bool on = ContrastOverlay.IsInstalled(resources);
ApplicationTheme under = ApplicationThemeManager.GetAppTheme();
ChartPalette chart = ChartTheme.Current;
source.IsOn = false;
source.Raise();
Visuals.Pump();
return (on, under, chart.Figure, Off: ContrastOverlay.IsInstalled(resources), Active: ContrastTheme.Active, After: ApplicationThemeManager.GetAppTheme());
}));
facts.on.Should().BeTrue();
facts.under.Should().Be(ApplicationTheme.Light, "a light contrast theme lies over the light Fluent theme, though the choice is Dark");
facts.Figure.Should().Be(ChartTheme.ToScottPlot(EditedLight.Window), "the charts take the contrast theme's window colour");
facts.Off.Should().BeFalse("turned off in Windows, the overlay comes off at once");
facts.Active.Should().BeNull();
facts.After.Should().Be(ApplicationTheme.Dark, "and the choice applies again");
}
[Theory]
[InlineData("HC1")]
[InlineData("EditedLight")]
public async Task UnderAContrastThemeEveryChartColourIsOneOfTheThemes(string name)
{
ContrastPalette palette = await PagesLoadTests.OnStaAsync(() => Named(name));
ChartPalette chart = ChartPalette.ForContrast(palette);
HashSet<Color> allowed = [.. palette.Colors];
ChartPalette.Keys.Select(k => (Key: k, Colour: ChartTheme.ToWpf(chart.ByKey(k)))).Where(p => !allowed.Contains(p.Colour)).Select(static p => p.Key)
.Should().BeEmpty("under a contrast theme a chart is drawn in the theme's colours only");
}
private static object? TryRead(ResourceDictionary dictionary, string key)
{
try
{
return dictionary[key];
}
catch (Exception ex) when (ex is ResourceReferenceKeyNotFoundException or InvalidOperationException or System.Windows.Markup.XamlParseException)
{
return null;
}
}
private static Color? ColourOf(object? value) => value switch
{
Color c => c,
SolidColorBrush b => b.Color,
_ => null,
};
}
@@ -0,0 +1,230 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Input;
using FluentAssertions;
using FrameLedger.App.Services;
using Wpf.Ui;
using Wpf.Ui.Animations;
using Wpf.Ui.Controls;
namespace FrameLedger.App.Tests;
/// <summary>
/// Focus and motion (beta.35): a page slides in only while Windows' animation effects are on, and Ctrl+1 … Ctrl+5 put the
/// keyboard in the page they open, its title said.
/// </summary>
public sealed partial class FocusAndMotionTests
{
[GeneratedRegex(@"\bShowDialogAsync\(", RegexOptions.CultureInvariant, 1000)]
private static partial Regex BoxShown();
[Fact]
public void APageSlidesInOnlyWhileWindowsAnimatesAndFollowsTheSettingAsItChanges()
{
PageMotion.For(animations: true).Should().Be(Transition.FadeInWithSlide, "WPF UI's own, as before");
PageMotion.For(animations: false).Should().Be(Transition.None);
}
[Fact]
public async Task TheNavigationTakesTheTransitionOfTheSettingNowAndAgainWhenItChanges()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
bool animations = false;
var navigation = new NavigationView();
Transition before = navigation.Transition;
using PageMotion motion = PageMotion.Follow(navigation, () => animations);
Transition off = navigation.Transition;
animations = true;
motion.Apply();
return (before, off, On: navigation.Transition);
});
facts.before.Should().Be(Transition.FadeInWithSlide, "WPF UI 4.3.0's default, played whatever Windows says");
facts.off.Should().Be(Transition.None);
facts.On.Should().Be(Transition.FadeInWithSlide);
}
[Fact]
public async Task AShortcutPutsTheFocusOnThePagesFirstControlAndSaysItsTitle()
{
var said = new RecordingAnnouncer();
var facts = await PagesLoadTests.OnStaAsync(() =>
{
var focus = new PageFocus(said);
var elsewhere = new System.Windows.Controls.Button { Content = "Elsewhere" };
var heading = new System.Windows.Controls.TextBlock { Text = "Games" };
AutomationProperties.SetHeadingLevel(heading, AutomationHeadingLevel.Level1);
var first = new System.Windows.Controls.Button { Content = "Add game" };
var page = new StackPanel { Children = { heading, first, new System.Windows.Controls.Button { Content = "Import" } } };
var root = new StackPanel { Children = { elsewhere, page } };
var host = new FluentWindow { Content = root, Width = 300, Height = 300, ShowActivated = true, WindowStartupLocation = WindowStartupLocation.Manual, Left = -10000, Top = -10000 };
host.Show();
try
{
Visuals.Pump();
_ = elsewhere.Focus();
focus.Shown(page);
focus.Request();
Visuals.Pump();
return (Focused: Keyboard.FocusedElement, first, Title: PageFocus.Title(page));
}
finally
{
host.Close();
}
});
facts.Focused.Should().BeSameAs(facts.first, "the page's first control has the keyboard");
facts.Title.Should().Be("Games");
said.Said.Should().ContainSingle().Which.Should().Be(("Games", AnnouncementKind.Status, "Page"));
}
[Fact]
public async Task APageNotYetShownTakesTheFocusOnceItIs()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
var focus = new PageFocus();
var first = new System.Windows.Controls.Button { Content = "Add game" };
var page = new StackPanel { Children = { first } };
focus.Shown(page);
focus.Request();
var host = new FluentWindow { Content = page, Width = 300, Height = 300, ShowActivated = true, WindowStartupLocation = WindowStartupLocation.Manual, Left = -10000, Top = -10000 };
host.Show();
try
{
Visuals.Pump();
return (Focused: Keyboard.FocusedElement, first);
}
finally
{
host.Close();
}
});
facts.Focused.Should().BeSameAs(facts.first);
}
/// <summary>
/// A content dialog gives the keyboard back to the control that opened it — WPF UI 4.3.0's host stores the focused element
/// when the dialog opens and focuses it again when it closes, so the App adds nothing; held here so an update that drops it
/// goes red. (The dialog's own <c>finally</c>, which takes it out of its host, resumes on the dispatcher's context: without
/// one, as on a bare test thread, the dialog stays in its host and the focus on its Close button.)
/// </summary>
[Fact]
public async Task AContentDialogGivesTheFocusBackToTheControlThatOpenedIt()
{
var facts = await PagesLoadTests.OnStaAsync(() => OnDispatcherContext(() =>
{
(FluentWindow window, Wpf.Ui.Controls.Button opener, ContentDialogService service) = Shell();
try
{
_ = opener.Focus();
Close(service.ShowAsync(new ContentDialog { Title = "T", Content = "Body", CloseButtonText = "Close" }, CancellationToken.None), service);
return (Focused: Keyboard.FocusedElement, opener);
}
finally
{
window.Close();
}
}));
facts.Focused.Should().BeSameAs(facts.opener);
}
[Fact]
public async Task AMessageBoxIsOwnedByTheAppsWindowItOpensOver()
{
var facts = await PagesLoadTests.OnStaAsync(() =>
{
var window = new FluentWindow { Width = 300, Height = 200, ShowActivated = true, WindowStartupLocation = WindowStartupLocation.Manual, Left = -10000, Top = -10000 };
Window? main = System.Windows.Application.Current.MainWindow;
window.Show();
System.Windows.Application.Current.MainWindow = window;
try
{
var box = new Wpf.Ui.Controls.MessageBox { Title = "T", Content = "C", CloseButtonText = "Close" };
Window? before = box.Owner;
MessageBoxes.Own(box);
return (before, After: box.Owner, window);
}
finally
{
System.Windows.Application.Current.MainWindow = main;
window.Close();
}
});
facts.before.Should().BeNull("WPF UI 4.3.0's message box sets no owner");
facts.After.Should().BeSameAs(facts.window);
}
/// <summary>Every message box the App shows goes through <see cref="MessageBoxes"/>: no other code shows one.</summary>
[Fact]
public void EveryMessageBoxGoesThroughMessageBoxes()
{
string app = Path.Combine(AccessibilityTests.RepoRoot(), "src", "FrameLedger.App");
List<string> elsewhere = [.. Directory.EnumerateFiles(app, "*.cs", SearchOption.AllDirectories)
.Where(static f => !f.Contains(Path.DirectorySeparatorChar + "obj" + Path.DirectorySeparatorChar, StringComparison.Ordinal)
&& !f.EndsWith("MessageBoxes.cs", StringComparison.Ordinal))
.Where(static f => BoxShown().IsMatch(File.ReadAllText(f)))
.Select(f => Path.GetRelativePath(app, f))];
elsewhere.Should().BeEmpty("a box shown elsewhere has no owner, and can fall behind the window it came from");
}
/// <summary>
/// The work under the STA thread's own dispatcher context: WPF UI's <c>ContentDialog.ShowAsync</c> clears its host in a
/// <c>finally</c> after an await, which must resume on the dispatcher, as it does in the App.
/// </summary>
private static T OnDispatcherContext<T>(Func<T> work)
{
SynchronizationContext? previous = SynchronizationContext.Current;
SynchronizationContext.SetSynchronizationContext(new System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Threading.Dispatcher.CurrentDispatcher));
try
{
return work();
}
finally
{
SynchronizationContext.SetSynchronizationContext(previous);
}
}
private static (FluentWindow Window, Wpf.Ui.Controls.Button Opener, ContentDialogService Service) Shell()
{
var opener = new Wpf.Ui.Controls.Button { Content = "Open" };
var host = new ContentDialogHost();
var grid = new Grid();
grid.Children.Add(new StackPanel { Children = { new Wpf.Ui.Controls.Button { Content = "Other" }, opener } });
grid.Children.Add(host);
var window = new FluentWindow { Content = grid, Width = 500, Height = 400, ShowActivated = true, WindowStartupLocation = WindowStartupLocation.Manual, Left = -10000, Top = -10000 };
window.Show();
Visuals.Pump();
var service = new ContentDialogService();
service.SetDialogHost(host);
return (window, opener, service);
}
// The dialog open, then closed with no answer, and the dispatcher run until its task has finished.
private static void Close(Task<ContentDialogResult> shown, ContentDialogService service)
{
Visuals.Pump();
(service.GetDialogHostEx()?.Content as ContentDialog)?.Hide(ContentDialogResult.None);
for (int i = 0; i < 200 && !shown.IsCompleted; i++)
{
Visuals.Pump();
Thread.Sleep(5);
}
shown.IsCompleted.Should().BeTrue("the dialog closed");
Visuals.Pump();
}
}
@@ -6,6 +6,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using FluentAssertions;
using FrameLedger.App.Services;
using Wpf.Ui.Appearance;
using Wpf.Ui.Markup;
@@ -68,6 +69,109 @@ public sealed partial class PagesLoadTests
string.Join(Environment.NewLine, result.Faint).Should().BeEmpty($"every text the App shows reads at {_readableAtLeast}:1 or better in the {theme} theme");
}
/// <summary>
/// Under a Windows contrast theme (beta.35, owner decision D91) every text is drawn in one of the theme's own colours over
/// one of them — nothing of the Fluent theme under it, nothing made translucent — and reads at 4.5:1 or better: WPF UI's
/// four default themes, and two the user edited (<see cref="ContrastThemeTests.EditedDark"/>, <see cref="ContrastThemeTests.EditedLight"/>).
/// </summary>
[Theory]
[InlineData("HC1")]
[InlineData("HC2")]
[InlineData("HCBlack")]
[InlineData("HCWhite")]
[InlineData("EditedDark")]
[InlineData("EditedLight")]
public async Task EveryTextIsInTheContrastThemesColoursAndReadable(string name)
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
using Surfaces surfaces = await Surfaces.LoadAsync(s);
(int Texts, List<string> Wrong) result = await OnStaAsync(() =>
{
ContrastPalette palette = ContrastThemeTests.Named(name);
return Visuals.UnderContrast(palette, () =>
{
HashSet<Color> colours = [.. palette.Colors];
int texts = 0;
var wrong = new List<string>();
foreach ((string surface, Func<FrameworkElement> build) in surfaces.All())
{
(Window host, FrameworkElement root) = Hosted(build);
try
{
Lay(root);
foreach (TextBlock text in ShownTexts(root))
{
texts++;
Color under = Visuals.PaintedUnder(text, root, palette.Window);
Color drawn = Visuals.TextOver(text, under);
double ratio = Wcag.Ratio(drawn, under);
if (!colours.Contains(drawn) || !colours.Contains(under) || ratio < Wcag.AA)
{
wrong.Add(string.Create(CultureInfo.InvariantCulture, $"{surface}: \"{text.Text}\" {drawn} on {under}, {ratio:0.00}:1"));
}
}
}
finally
{
host.Close();
}
}
return (texts, wrong);
});
});
result.Texts.Should().BeGreaterThan(300, "every surface was rendered and holds text");
string.Join(Environment.NewLine, result.Wrong).Should().BeEmpty($"under the {name} contrast theme every text is the theme's colour on the theme's colour, at {Wcag.AA}:1 or better");
}
/// <summary>
/// The line under Settings ▸ Theme says a contrast theme's colours are used while one is on, and goes when it is off — on
/// the page as it is shown, without visiting it again (beta.35, D91).
/// </summary>
[Fact]
public async Task TheSettingsPageSaysAContrastThemeIsOnWhileItIs()
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
using Surfaces surfaces = await Surfaces.LoadAsync(s);
var facts = await OnStaAsync(() => Visuals.UnderTheme(ApplicationTheme.Dark, () =>
{
Func<FrameworkElement> build = surfaces.All().Single(static p => string.Equals(p.Item1, "Settings", StringComparison.Ordinal)).Item2;
(Window host, FrameworkElement root) = Hosted(build);
try
{
Lay(root);
TextBlock note = Visuals.FindAll<TextBlock>(root).Single(static t => string.Equals(t.Text, Strings.Settings_Theme_ContrastOn, StringComparison.Ordinal));
Visibility off = note.Visibility;
ResourceDictionary resources = System.Windows.Application.Current.Resources;
ContrastOverlay.Install(resources, ContrastThemeTests.EditedDark);
Visibility on;
try
{
Visuals.Pump();
on = note.Visibility;
}
finally
{
ContrastOverlay.Remove(resources);
}
Visuals.Pump();
return (off, on, Again: note.Visibility);
}
finally
{
host.Close();
}
}));
facts.off.Should().Be(Visibility.Collapsed);
facts.on.Should().Be(Visibility.Visible);
facts.Again.Should().Be(Visibility.Collapsed);
}
/// <summary>
/// The non-empty texts under <paramref name="root"/> that a user can see and is meant to read: no collapsed or hidden
/// element above them, and none disabled (WCAG asks nothing of an inactive control's text).
+23
View File
@@ -121,6 +121,29 @@ internal static class Visuals
}
}
/// <summary>
/// Runs <paramref name="work"/> under a Windows contrast theme the way the App follows one (beta.35, D91): the light or
/// the dark Fluent theme as the contrast theme is, under <c>ContrastOverlay</c> with its colours, and <c>ContrastTheme.Active</c>
/// set — then everything put back as <see cref="UnderTheme{T}"/> puts it back.
/// </summary>
public static T UnderContrast<T>(FrameLedger.App.Services.ContrastPalette palette, Func<T> work)
{
ArgumentNullException.ThrowIfNull(palette);
return UnderTheme(palette.IsDark ? ApplicationTheme.Dark : ApplicationTheme.Light, () =>
{
ResourceDictionary resources = System.Windows.Application.Current.Resources;
FrameLedger.App.Services.ContrastOverlay.Install(resources, palette);
try
{
return work();
}
finally
{
FrameLedger.App.Services.ContrastOverlay.Remove(resources);
}
});
}
/// <summary>
/// The colour painted under <paramref name="element"/>: every Border's and Panel's background from <paramref name="root"/>
/// down to the element, composited over <paramref name="window"/> — what a template's parts draw, which is what the eye sees.