Commit fe2db95
refactor(client): put the modal dialog buttons on tokens, readably (UI/UX v3 G11 follow-up) (#71)
Third and last code half of the #62 follow-up: the close-window dialog's
Kill/Cancel buttons, and the consent dialog's selected-button fill.
The literals were `[0.75, 0.25, 0.25]` / `[0.95, 0.40, 0.40]` for Kill at
rest and selected, `[0.95, 0.85, 0.40]` for a selected Cancel, and
`[0.10, 0.10, 0.10]` for the label on any selected button (in two
dialogs). All now derive from `semantic_error` / `semantic_warning` via
two new helpers, `util::danger_fill` and `util::caution_fill`.
Kill deliberately does *not* reuse #70's `danger_button_colors`. That
helper answers "is this button focused", stepping from a barely-tinted
rest state to a mid blend. Kill has to read as the destructive choice
*before* it is selected — it sits next to Cancel — so it steps from the
mid blend to a strong one instead. Sharing the blend and not the
focused/unfocused rule is what keeps both readings intact.
The labels are the substance of this change. Selected-button labels were
a fixed near-black, which is wrong on any dark fill; they now come from
`on_surface_text`, chosen against the fill. Measuring that across the
nine built-in schemes turned up something a fixed blend strength cannot
fix: at 0.85 the error hue lands at a middling luminance on Nord
(4.42:1) and the warning hue does the same on Solarized (4.37:1) —
luminances where *neither* extreme has anything to contrast with. Used
raw, `semantic_warning` fails the same way, which is why `caution_fill`
blends rather than passing the token through.
`semantic_fill` therefore walks the blend back toward `surface_1` until
the label clears `MIN_TEXT_CONTRAST`, the same shape as
`row::ensure_readable`. It terminates because `surface_1` derives from
the scheme background — the end of the range a label can always be read
against. Some schemes get a slightly quieter fill than asked for; an
unreadable label on a destructive button is the worse trade.
The consent dialog's 3 px top stripe and its title keep the raw warning
hue: a line and text, not a fill.
Two new tests. One pins every fill/label pair the dialogs paint across
all nine schemes at 4.5:1 — it is the test that forced `caution_fill` to
exist, and it fails on `Nord` if the adaptive step is removed. The other
pins that a stronger blend always reads as redder, since that ordering
is what carries "dangerous" and "selected".
On-device verification: not run. Joins the accepted-unverified backlog.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Happy <yesreply@happy.engineering>1 parent 7e71284 commit fe2db95
3 files changed
Lines changed: 181 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
453 | 454 | | |
454 | 455 | | |
455 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
456 | 463 | | |
457 | | - | |
| 464 | + | |
458 | 465 | | |
459 | 466 | | |
460 | 467 | | |
461 | 468 | | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
462 | 473 | | |
463 | | - | |
| 474 | + | |
464 | 475 | | |
465 | 476 | | |
466 | 477 | | |
| |||
590 | 601 | | |
591 | 602 | | |
592 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
593 | 612 | | |
594 | | - | |
| 613 | + | |
595 | 614 | | |
596 | 615 | | |
597 | 616 | | |
| |||
606 | 625 | | |
607 | 626 | | |
608 | 627 | | |
609 | | - | |
| 628 | + | |
610 | 629 | | |
611 | | - | |
| 630 | + | |
612 | 631 | | |
613 | 632 | | |
614 | 633 | | |
615 | 634 | | |
616 | 635 | | |
617 | 636 | | |
618 | | - | |
619 | | - | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
620 | 642 | | |
621 | 643 | | |
622 | 644 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 81 | | |
94 | | - | |
| 82 | + | |
95 | 83 | | |
96 | 84 | | |
97 | | - | |
| 85 | + | |
98 | 86 | | |
99 | 87 | | |
100 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
175 | 249 | | |
176 | 250 | | |
177 | 251 | | |
| |||
225 | 299 | | |
226 | 300 | | |
227 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
228 | 373 | | |
229 | 374 | | |
230 | 375 | | |
| |||
0 commit comments