Repository navigation
color-themes: check.mjs --skin measures a text tier the skin leaves unset with the stock value, as the GUI does - #19
Conversation
…nset with the stock value, as the GUI does The GUI's skin listing (textTierWarnings in shared/contrast.ts) fills a text tier or ground a skin leaves unset with the stock scheme's value and warns when that pair falls under the GUI's floor for the tier. check.mjs skipped every pair with an unset side, so a dark skin with only --bg/--bg-2 #454545 and --fg #fff passed here while the GUI flagged --fg-3 and --fg-4 as low contrast. In --skin mode, a pair of --fg..--fg-4 and --bg/--bg-2 with one side set is now measured with the other side's stock value from STOCK_TEXT_TOKENS in shared-types/contrast.ts, against that file's TEXT_TIERS floor, and the filled side is marked "(stock)". Since a token set must set --bg and --fg, the filled side is --fg-2, --fg-3, --fg-4 or --bg-2. Pairs with both sides set keep this script's floors; colour-theme mode does not read the stock values and is unchanged. Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
TL;DR
Before this change, No findings sure enough to post from reading the change. Merge confidence 5 of 5 Where to read first
Tests and reachReach: no graph yet, so this review could not trace what the change reaches. Stages: 169 s
|
|
#20 refreshes |
What
@sessionpipe-gui/color-themes:scripts/check.mjs --skinnow measures a text tier the skin leaves unset with its stock value, the way the GUI's skin listing does, so a skin the GUI marks "low contrast" no longer passes here.In
--skinmode, for the pairs the GUI checks (--fg,--fg-2,--fg-3and--fg-4on--bgand--bg-2), the checker now fills a side the skin leaves unset with the stock value fromSTOCK_TEXT_TOKENSinpackages/shared-types/contrast.ts, when the skin sets the other side. That side is marked(stock)in the output. A token set must set--bgand--fg, so in practice the filled side is--fg-2,--fg-3,--fg-4or--bg-2. If the skin sets neither side of a pair, the pair is the stock scheme's own and is skipped, as in the GUI.Colour-theme mode (no
--skin) is unchanged. It does not read the stock values, and the GUI shows no such warning for colour themes.Why
The GUI's skin listing (
server/skins/registry.tscontrastWarning→shared/contrast.tstextTierWarnings) draws a skin over the stock scheme. It fills each unset text tier or ground with the stock value and warns when the pair falls under the tier's floor.check.mjsskipped every pair with an unset side ("A token the theme does not set is nothing to measure"). So a skin author who ran the checker got "all good" and then saw "low contrast" in the GUI. This follows #13 ("never skips a pair silently").Floors. A stock-filled pair is held to the GUI's floor for that tier, read from
TEXT_TIERSin the samecontrast.ts:--fg7,--fg-25,--fg-34.5,--fg-43. With those floors the checker fails exactly the stock-filled pairs the GUI warns about. If it used its own stricter floors from tokens.css (--fg-27,--fg-35 on--bgand--bg-2), a tier the author never set would fail here while the GUI shows nothing. A pair where the skin sets both sides keeps this script's own floors, as before.Not covered. The GUI at its current main also checks
--focuson--bgand--bg-2against a stock--focus. Theshared-typesmirror here predates that and has no--focusinSTOCK_TEXT_TOKENS, so--focusis not filled yet. Once the mirror is refreshed, the checker picks it up from the same block (--focuson--bgand--bg-2keeps its floor of 3, the same as the GUI's). Updating the mirror is a separate change.Proof
The probe is a dark skin that sets only
--bgand--bg-2(#454545) and--fg(#ffffff):{"id":"probe-skin","name":"Probe","version":"1.0.0","scheme":"dark","tokens":{"--bg":"#454545","--bg-2":"#454545","--fg":"#ffffff"}}On
main(d92e06a):On this branch:
The GUI's
textTierWarningsgives four warnings for the same tokens:--fg-3on--bg3.4:1 (needs 4.5),--fg-4on--bg1.9:1 (needs 3), and the same two on--bg-2. Those are the four LOW lines above.A second probe is a dark skin that sets all four text tiers but leaves
--bg-2unset. Its--fg-2on stock--bg-2is 6.37 and its--fg-3is 4.94, both over the GUI's floors and both under this script's own floors. The GUI gives no warning, and the checker passes it onmainand on this branch alike ("all good").The bundled skins and themes pass with exit 0 on
mainand on this branch:npm testinskin-paper-serif,skin-spacesheepandskin-spacesheep-vivid(each runscheck.mjs --skin skin.json), and incolor-themes(the four colour themes, no--skin).Repo checks on this branch:
npm run typecheck: exit 0.npm run lint: "Checked 91 files … No fixes applied", exit 0. It reports 3 warnings, the same 3 as onmain; none is incheck.mjs.npm run build: exit 0.npm test: every workspace passes exceptpackages/canvas. All 43 of its Playwright tests fail before running, withbrowserType.launch: Executable doesn't exist(no Chromium installed on the machine that ran this). This change does not touch canvas.There is no unit-test harness for
check.mjs; #12 and #13 were proved the same way. The probe is not committed as a fixture, because every JSON file in the package folder is read as a colour theme.Checklist
git commit -s): the DCO is the only paperwork.npm run typecheck && npm run lint && npm run build && npm testpass, except the canvas Playwright tests on a machine without the browser (above).// SPDX-License-Identifier: Apache-2.0. No new files.CHANGELOG.mdif a person would notice: under Fixed.