Files
pipelines/app/notes/chat-colour-bar.md

6.1 KiB
Raw Permalink Blame History

Chat colour in the thread bar (UI review option B)

Spec as implemented

  • Thread bar glass pieces (Back, title pill, model/mode/thinking island, Files+More island) take the chat colour through SegmentedBar.pillColor: fill = chatColorShade blended over the host raised surface (Material surfaceContainerHigh, Cupertino systemGrey5) at 0.16 in light and dark, then the glass fillOpacity 0.82. It stays opaque under the high-contrast setting, as the neutral glass does. Dark uses 0.16 (not 0.18) so amber keeps reading as dark gold and does not turn olive.
  • Foreground = ColorScheme.fromSeed(seedColor: shade, brightness).onPrimaryContainer on both hosts. Material passes it as SegmentedBar.foregroundColor (title and subtitle) and as the ambient IconTheme (Back, Files and More icon buttons). chatBarTextButtonStyle (model/mode/thinking) reads ChatBarTintScope. Cupertino passes it as the bar's CupertinoTheme.primaryColor, so Back, Files and More take it as their native tint, and through chatBarCupertinoContent for the selectors. The raw Cupertino system colour is not used for text because systemYellow on light grey is about 1.5:1.
  • Split panes: each pane's bar carries its own colour. A pane that is not the active one (ChatPaneActivity, set by the workspace when there is more than one pane) keeps chatBarInactiveFade = 0.5 of the tint strength. The active pane keeps its border (unchanged) and the composer focus ring.
  • Chats with no colour keep the neutral bar: no scope, pillColor is null.
  • ChatColorWash (bar backdrop and below-bar gradient) is removed.
  • Composer: no fill tint. The focus ring is the seeded scheme's primary (tone 40 light / 80 dark), or the host primary for a chat with no colour. It is drawn at full opacity, 2 px, with no glow.
  • Sidebar row tint, edge marker and avatar are unchanged.

Code: lib/features/chat/conversation/chat_bar_tint.dart (tint maths, ChatPaneActivity, ChatBarTintScope), chat_thread_header.dart, chat_bar_control_style.dart, composer_focus_ring.dart, chat_composer_bar.dart, chat_thread_view.dart, chat_screen_workspace.dart.

Contrast (WCAG, test/features/chat/conversation/chat_bar_tint_contrast_test.dart)

The test reads shades through chatColorShade under the app's themes and asserts labels ≥ 4.5:1 (active, inactive and solid fill, with the glass over the page) and the ring ≥ 3:1 against the page and the composer glass. Minimums across all 8 colours × 2 hosts × 2 brightnesses: bar label 6.42, inactive label 7.10, solid label 5.95, ring vs page 6.10, ring vs composer 5.35. Set CHAT_BAR_CONTRAST_OUT=<file> to write the table.

host theme colour bar label inactive label solid label ring vs page ring vs composer
material light red 6.64 7.23 6.21 6.13 5.42
material light orange 6.92 7.37 6.54 6.16 5.44
material light amber 7.15 7.47 6.81 6.15 5.43
material light green 6.81 7.31 6.41 6.10 5.39
material light teal 6.74 7.28 6.32 6.10 5.39
material light blue 6.68 7.23 6.26 6.10 5.39
material light purple 6.42 7.11 5.95 6.13 5.42
material light pink 6.44 7.10 5.98 6.14 5.43
material dark red 9.95 10.96 9.02 10.81 9.06
material dark orange 9.01 10.45 7.96 10.78 9.04
material dark amber 8.64 10.25 7.56 10.82 9.07
material dark green 9.20 10.53 8.18 10.83 9.08
material dark teal 9.60 10.78 8.62 10.80 9.05
material dark blue 9.39 10.65 8.39 10.84 9.09
material dark purple 10.17 11.07 9.28 10.81 9.07
material dark pink 10.06 11.02 9.14 10.82 9.07
cupertino light red 6.61 7.15 6.10 6.47 5.38
cupertino light orange 7.18 7.48 6.75 6.49 5.39
cupertino light amber 7.52 7.65 7.16 6.43 5.35
cupertino light green 7.19 7.49 6.75 6.45 5.36
cupertino light teal 7.29 7.51 6.90 6.49 5.40
cupertino light blue 6.68 7.20 6.17 6.45 5.36
cupertino light purple 6.70 7.20 6.20 6.48 5.38
cupertino light pink 6.59 7.16 6.07 6.45 5.36
cupertino dark red 10.02 10.76 9.09 10.83 8.70
cupertino dark orange 9.01 10.23 7.95 10.81 8.68
cupertino dark amber 8.29 9.80 7.18 10.79 8.67
cupertino dark green 8.97 10.18 7.92 10.83 8.70
cupertino dark teal 8.64 10.02 7.56 10.84 8.71
cupertino dark blue 9.96 10.73 9.02 10.80 8.67
cupertino dark purple 9.85 10.66 8.90 10.82 8.69
cupertino dark pink 10.17 10.86 9.25 10.78 8.66

Verification

  • tool/analyze.sh: analyze: clean; exit 0.
  • tool/memwatch/full.sh 'test/features/chat': PASS: 1176 passed, 0 failed, 0 skipped; peak 2186 MB; 136s; exit 0.
  • Widget tests: chat_bar_tint_test.dart covers the tinted and neutral bar, the Material and Cupertino foreground (icons, Back, selectors, title), and the inactive fade. chat_workspace_insets_color_test.dart checks per-pane colours, the fade following the active pane, and the neutral pane. chat_list_shortcuts_test.dart checks that no wash is drawn and the bar is tinted. chat_composer_focus_ring_test.dart checks the opaque 2 px seeded or host primary ring with no glow.
  • Real Chrome (tool/capture, fixture tool/search_selection_probe_entry.dart, ?chats=7&rich=1&colors=1&header=1): 560x1000 phone purple, amber and plain chats, unfocused and focused. Also 1400x900 split into four panes through "Open to the right" and "Open below", with the focused composer. Captured in Material light, Material dark and Cupertino light under /tmp/cbar/shots/, with contact sheets at /tmp/cbar/sheet-*.png. All were inspected. The inactive panes show the lighter tint, the plain chat's bar is neutral, the ring is solid and in the chat's hue, and dark amber reads as dark gold.