ui: lift warning above ordinary text in the monochrome themes

A load reading under warning rendered marginally QUIETER than a healthy one:
an uncoloured value inherits `--text`, 4.98:1 on a night panel, and `--warning`
was 4.91:1.  Amber had the same inversion, 7.43 against 8.59.

Anything that means "look at this" has to be louder than the prose around it,
and with no hue to carry the signal, louder means brighter.  Both `warning` and
`danger` now clear `--text` in night and amber:

    night   warning #ee3434 -> #f54040   4.91 -> 5.40   (--text 4.98)
            danger  #ff3e3e -> #ff5757   5.71 -> 6.41
    amber   warning #f18806 -> #fa9f31   7.43 -> 9.05   (--text 8.59)
            danger  #ff9e29 -> #ffb760   9.15 -> 10.96

I said last time this would trade night's "red only" character for loudness.
Having measured it, that was overstated.  Red contributes 21% of luminance, so
in night NOTHING above ~4.9:1 can be a pure hue -- `#ff0000` itself is only
4.99:1 there.  `--text` is already `#e04a4a`, carrying 74 of green and blue.
The new warning carries 64, LESS than the text beside it; only danger goes
further, at 87.  A pure-hue ramp above the text was never on the table.

The rule is monochrome-only, like the ordering rule it sits beside.  A light
theme's text is near-black at ~14:1 and no warning colour will ever match it --
there, hue is what marks a reading as flagged.

The guard now asserts warning as well as danger, and the LoadStatistic browser
test makes the claim it previously had to document as unmet: warning is louder
than a plain reading.  Planted the reported bug back in both themes, plus two
ordering breaks.

One plant of mine came back green and was wrong, not the test: I set night's
danger to `#f04a4a` expecting it to drop below warning, but that has MORE green
and blue than `#f54040`, and green is 71% of luminance -- so it was still the
brighter of the two.  Re-planted with a value that is genuinely dimmer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-02 08:23:13 -06:00
parent 52405b71f2
commit e3feffdb35
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 40 additions and 30 deletions

View file

@ -298,19 +298,26 @@ describe('semantic roles read as severity in every theme', () => {
});
});
it(`makes danger at least as loud as ordinary text in ${theme}`, () => {
it(`makes warning and danger louder than ordinary text in ${theme}`, () => {
/*
* Also only here. A light theme's text is near-black at ~14:1 and no danger
* colour will ever match it; on a single hue the roles and the text are drawn
* from the same ramp, so the loudest role must not be quieter than the prose.
* Only here. A light theme's text is near-black at ~14:1 and no warning colour
* will ever match it -- there, hue is what marks a reading as flagged. On a
* single hue the roles and the text come off the same ramp, so anything meaning
* "look at this" has to outrank the prose or it does not read as flagged at all.
*
* This is the assertion the Status page needed: an uncoloured load reading
* inherits `--text`, and warning used to sit just below it.
*/
cy.mountUI(<Panel>roles</Panel>, {theme});
cy.get('.wrolpi-panel').should(() => {
const {panel, text, roles} = roleColours();
const danger = roles.find(r => r.role === 'danger').colour;
expect(contrast(danger, panel), 'danger vs --text against the panel')
.to.be.at.least(contrast(text, panel) * 0.95);
const prose = contrast(text, panel);
['warning', 'danger'].forEach((name) => {
const role = roles.find(r => r.role === name).colour;
expect(contrast(role, panel), `${name} against --text on the panel`)
.to.be.greaterThan(prose);
});
});
});
});
@ -366,23 +373,15 @@ describe('a load reading ranks itself in the monochrome themes', () => {
Cypress.$('.wrolpi-panel')[0]).backgroundColor);
expect(new Set([fine, warning, danger]).size, 'three distinct readings').to.equal(3);
/*
* Both flagged readings outrank a plain one. This is what the ramp change
* bought: warning used to sit just UNDER `--text`, so a machine under load
* rendered marginally quieter than a healthy one.
*/
expect(contrast(warning, panel), 'warning is louder than a plain reading')
.to.be.greaterThan(contrast(fine, panel));
expect(contrast(danger, panel), 'danger is louder than warning')
.to.be.greaterThan(contrast(warning, panel));
expect(contrast(danger, panel), 'danger is louder than a plain reading')
.to.be.greaterThan(contrast(fine, panel));
/*
* NOT asserted: that warning outranks a plain reading. It does not, and that
* is a live question rather than an oversight -- an uncoloured value inherits
* `--text`, which in night is 4.98:1 against 4.91:1 for `--warning`. So a
* machine under load is marginally QUIETER than one that is fine.
*
* Lifting warning above text is a palette change, not a call-site one: on a
* dark panel the only way up is lightness, and night's danger would desaturate
* from #ff3e3e to about #ff5d5d -- trading the theme's "red only" character
* for loudness. Worth a deliberate decision, so it is flagged rather than
* quietly made here.
*/
});
});
});