High contrast notes: snap token, perf and tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 00:39:57 +00:00
parent 9d8e224995
commit 81e132e547
+29
View File
@@ -21,6 +21,7 @@ Files: `lib/ui/theme/high_contrast_{palette,theme,controls,typography}.dart`,
| `largeTargets` | false | true | `prefersCompactHitTargets` (false: touch rows and 48px targets on a desktop) |
| `minContrast` | null | 4.5 | chat colours moved to 4.5:1 against the page (`colorWithContrast`), no chat tints (list rows, header bar, stack labels outline instead), solid usage-ring track, avatars' marks and frames at full strength |
| `windowRadius` | null (12) | 6 | floating windows' corners |
| `snapSwitch` | false | true | `AppDesignController.themeAnimationDuration`: a live switch into or out of the design snaps (no grey-on-grey half-blend; its larger component sizes have nothing to blend from, and with the blend the browser bench's live-switch scenario hung under skwasm twice) |
Styles added: `TranscriptStyle.boxed`, `SelectedRowStyle.inverted`.
`AppDesignTokens.inverseTheme(theme)` gives the same design in the opposite
@@ -92,3 +93,31 @@ brightness (cached), which an inverted surface draws its content under.
| chat colours | >= 4.5:1 (tested for all 13) | >= 4.5:1 |
`test/ui/theme/high_contrast_design_test.dart` computes and asserts these.
## Perf (tool/perf/design_bench.mjs, skwasm CPU, medians of 3)
| scenario | Default build/raster ms per frame | High contrast |
| --- | --- | --- |
| scroll | 8.99 / 56.96 | 3.65 / 14.16 |
| switch chats | 10.4 / 52.72 | 4.45 / 15.41 |
| runs | 2.69 / 12.18 | 2.48 / 7.06 |
| graph | 2.04 / 17.41 | 2.84 / 19.44 |
| live design switches | 14.36 / 22.19 | 5.44 / 13.15 (heap +0.57 MB) |
PASS; no off-origin fetch beyond Default's. Flat pieces, no blur, one
painter per boxed turn. The chat list's default click points still hit
rows 1-3 at 1280x800 (rows at y 124-232, 232-313, 313-393).
## Tests
- `test/ui/theme/high_contrast_design_test.dart`: tokens, pages, every
contrast pair above computed and asserted (7:1 / 4.5:1), all chat colours,
flat bordered surfaces, type, inverse theme, the snap, desktop targets, and
every other design's new tokens at their defaults.
- `test/ui/theme/high_contrast_widgets_test.dart`: focus ring (3px, offset,
halo, text-field box, hidden after a pointer press, absent elsewhere),
48px targets on Linux, boxed transcript (You box, Done/Failed, aligned
names), inverted row vs Terminal's unchanged row, 200% text scale on a
360px phone with no overflow (light and dark).
- `test/ui/theme/high_contrast_switch_test.dart` and High contrast added to
`compact_switch_test.dart`: per-frame switches to and from every design.