Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.2 KiB
High contrast design
An accessibility design (Settings > Design > High contrast, id
high-contrast) for low vision and phones in sunlight: a pure black page with
white ink and one bright yellow accent (dark), or a pure white page with black
ink and a deep blue accent (light); larger, heavier type; 2px borders on every
control and panel; flat surfaces with no shadows; 6px corners; 48px targets on
every platform; and a 3px keyboard focus ring with an offset.
Files: lib/ui/theme/high_contrast_{palette,theme,controls,typography}.dart,
lib/ui/theme/design_focus_ring.dart,
lib/features/chat/ui/transcript/boxed/.
Tokens added to AppDesignTokens (defaults keep every other design)
| token | default | High contrast | read by |
|---|---|---|---|
stroke |
1 | 2 | frameSide, GlassPill (flat), settings groups, avatars, stack labels, graph edges, floating windows, boxed transcript |
ringStroke |
2 | 3 | the send button's usage ring |
focusRing (FocusRingStyle: color, halo, width, offset) |
null | accent, page halo, 3px, 2px offset | DesignFocusRing |
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 |
Styles added: TranscriptStyle.boxed, SelectedRowStyle.inverted.
AppDesignTokens.inverseTheme(theme) gives the same design in the opposite
brightness (cached), which an inverted surface draws its content under.
Surfaces
- Palette: every surface container is the page; panels part by borders.
secondaryContaineris the ink, so selected things (navigation indicator, chips, segmented buttons, list tiles) are inverted. - Type: body 17/16/14px at weight 500, labels 16/14/13px and titles at 600.
Sizes stay theme roles, so text scaling and the system's bold-text setting
apply. Button text keeps the theme's
labelLarge(a button style's own text style would fail to blend during a live design switch). - Controls: filled/outlined/elevated/segmented buttons, chips, fields, search
bars, checkboxes and switches have 2px borders; fields take 3px of the
accent when focused; text and icon buttons stay unframed. Disabled ink is
#8F8F8Fon black (6.5:1) and#6E6E6Eon white (5.1:1). - Floating pieces: menus, dialogs, sheets framed 2px, no elevation; tooltips inverted, 16px weight 600, padded 12x8, framed in the page colour; snack bars inverted with a 2px edge and the inverse accent for actions.
- Focus:
DesignFocusRing(inserted in the threeMaterialApp.builders) draws the ring aroundFocusManager.primaryFocusover the whole app, a page-coloured halo inside a 3px accent ring 2px outside the control; a text field's ring goes round its whole decorated box. Like:focus-visibleit shows after a key press and hides on any pointer press. It tracks a scrolling control with post-frame checks only (no frames scheduled). - Chat (
boxed): the operator's turn under a bold "You" label in a box with a 2px ink frame and a 6px bar in the chat's colour (ink when none), painted in one pass (BoxedFramePainter, canvas clip, no layer); the agent's answer plain on the page; activity as one bordered block, a row per tool with an icon and a status word ("Done", "Failed", "Running") in a status colour at 7:1 in one aligned column; agent follow-ups as cards framed 2px in the secondary ink; the header bar is not tinted. - Lists: the open row is inverted (ink fill, page text, opposite-brightness theme so its status colours keep contrast) with a 6px bar; unselected chat rows show their colour only as their bar and avatar frame.
- Graph: edges as heavy as the frames (2px), the selected node inverted; edge hover and tooltip unchanged (accent glow at 2.5x the edge, inverse tooltip).
- Phone chat stack: discs and labels flat in 6px corners; a label's chat colour is a 3px outline, the Add disc framed in the full accent.
- Floating windows: 6px corners and a 2px ink outline.
Still default
- Icon buttons in toolbars have no frame (strong hover/press overlays and the focus ring instead); text buttons are unframed.
- Floating window title bars keep their 40px compact icon buttons.
- Graph node status captions keep their fixed 12px size (preview scale).
- Markdown, code blocks and links keep the shared rendering (links were already underlined).
- The system's high-contrast setting does not switch designs by itself; the design is chosen per device like the others.
Contrast (WCAG 2, against the page)
| pair | dark | light |
|---|---|---|
| ink | 21:1 | 21:1 |
| secondary ink | 13.6:1 | 12.6:1 |
| accent | 14.9:1 | 9.4:1 |
| text on accent | 14.9:1 | 9.4:1 |
| error | 7.6:1 | 7.4:1 |
| status green / cyan / magenta | 15.7 / 13.7 / 9.8 | 7.4 / 7.4 / 8.5 |
| warning (usage ring) | 10.2:1 | 7.8:1 |
| rules | 7.8:1 | 7.0:1 |
| disabled | 6.5:1 | 5.1:1 |
| chat colours | >= 4.5:1 (tested for all 13) | >= 4.5:1 |
test/ui/theme/high_contrast_design_test.dart computes and asserts these.