mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 11:56:18 -05:00
test: act on review — and correct an overstated claim about the toast bug
I said all four toast kinds were "the same pixel" in night. They were not.
Planting a reversion to hue names left the new distinctness test GREEN, because
in night `--blue`, `--green`, `--yellow` and `--red` are four different values
(2.29, 3.14, 4.52, 5.64 against a panel). What they are is cramped and badly
ranked, with info at 2.29:1 -- below the 3:1 floor, present and invisible.
The byte-identical pairs are real but elsewhere: `--orange` is `--text` and
`--yellow` is `--amber`, which bites a call site that reaches for those names,
not the toast mapping. The PR body has been corrected too.
So the distinctness assertion is not the one with teeth; the legibility floor
is. The monochrome toast test now measures every kind against the toast's own
surface, and the hue reversion fails it naming the number: 2.29:1.
Also from review:
`.wrolpi-message-error` still forced `border: 1.5px dashed var(--red)` while its
accent and icon had moved to roles -- nearly the same pixel in night, so no
colour test could see it. It follows `--message-color` now. Six more library
rules were naming a hue for a thing that means danger: the night danger button,
invalid form fields, invalid paths, path error text, danger panels and failed
table rows. All roles now, with a source guard that fails any rule whose
SELECTOR means severity and whose body names a hue. Focus rings and active-tab
accents deliberately keep `--blue`: those are the primary accent, not severity.
The tokens.css note claimed the brightness ramp held "in every theme" when the
tests deliberately limit it to monochrome. Narrowed, with the reason spelled
out, because the next person to read it would otherwise have "fixed" light to
match the prose -- which would mean reordering light's hues to satisfy a test.
Added the end-of-chain cases the review asked for: four toasts and four Messages
in night and amber, measured rather than inferred from variable names.
Colour reads now go through a strict `toRgb` that refuses anything not already
resolved. The reviewer's concern that `getPropertyValue('--info')` returns an
unresolved `var(--blue)` does not hold -- custom properties are substituted at
computed-value time and it returns `#20629c` -- but feeding an unresolved value
to a luminance calculation yields NaN, and `expect(NaN).to.not.equal(x)` passes.
Worth refusing loudly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
08c5c233c8
commit
c7fddc55af
4 changed files with 155 additions and 27 deletions
|
|
@ -72,16 +72,24 @@ html[data-theme="light"] {
|
|||
* between hue names there is choosing between synonyms. That is why all four toast
|
||||
* kinds looked the same in night, and why a warning and an error were the same pixel.
|
||||
*
|
||||
* The ramps below are built so that in every theme:
|
||||
* - the order neutral < info < success < warning < danger is strictly increasing in
|
||||
* contrast against the panel, so severity reads as brightness even without hue;
|
||||
* - every role except neutral clears 3:1 against the panel;
|
||||
* - danger reaches that theme's own `--text` brightness, so the loudest role is
|
||||
* never quieter than ordinary prose;
|
||||
* - neutral sits deliberately below the rest -- for `pending` and disabled, being
|
||||
* dim IS the signal.
|
||||
* In EVERY theme:
|
||||
* - the five roles resolve to five distinct colours;
|
||||
* - every role except neutral clears 3:1 against the panel. Neutral sits below the
|
||||
* rest deliberately -- for `pending` and disabled, being dim IS the signal.
|
||||
*
|
||||
* `ui-layout.cy.js` asserts all of that, per theme, in a real browser.
|
||||
* In the MONOCHROME themes only (night and amber):
|
||||
* - the order neutral < info < success < warning < danger is strictly increasing in
|
||||
* contrast against the panel, so severity reads as brightness with no hue to help;
|
||||
* - danger reaches that theme's own `--text` brightness, so the loudest role is never
|
||||
* quieter than ordinary prose.
|
||||
*
|
||||
* Those last two are NOT true of light and dark and must not be made true. There a role
|
||||
* is a hue, and the contrast order is an accident of which hues were chosen -- blue is
|
||||
* darker than green on white, so light "fails" a brightness ramp while looking perfectly
|
||||
* correct. Reordering light's hues to satisfy a ramp would be changing the design to
|
||||
* satisfy a test.
|
||||
*
|
||||
* `ui-layout.cy.js` asserts exactly this split, per theme, in a real browser.
|
||||
*
|
||||
* `--primary` is deliberately NOT one of these. "The colour of a primary button" and
|
||||
* "the colour that means informational" are different jobs, and a user who recolours
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue