Skip to content

skins: warn at the text floors tokens.css promises (fg-2 7:1, fg-3 5:1) - #269

Open
connorburgess wants to merge 3 commits into
spacesheep-dev:mainfrom
connorburgess:fix/skin-text-floors
Open

connorburgess wants to merge 3 commits into
spacesheep-dev:mainfrom
connorburgess:fix/skin-text-floors

Conversation

@connorburgess

@connorburgess connorburgess commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Updated against v0.8.18 / main d16a2c01 on 2026-12-05. Current validation and refresh details.

What

The skin list now warns when a skin's secondary text (--fg-2) is under 7:1 or its meta text (--fg-3) is under 5:1 on the page or the card: the floors web/src/styles/tokens.css promises. Before, it warned only under 5:1 and 4.5:1, so a skin could be listed clean while below the promised floors.

Why

Symptom: a light skin with --fg-2: #6b6b6b and --fg-3: #757575 (5.3:1 and 4.6:1 on white) is listed with no warning, though tokens.css (lines 5-6) says "fg-2 is secondary body (≥ 7:1 on the page), fg-3 is meta (≥ 5:1)". On main:

textTierWarnings({"--fg-2":"#6b6b6b","--fg-3":"#757575"}, "light")  // → []

Cause: shared/contrast.ts says in its header that it measures "the floors tokens.css promises", but TEXT_TIERS held --fg-2 to 5 and --fg-3 to 4.5. docs/skin-authoring.md repeated 5 / 4.5 in its prose, contradicting its own token table a few lines up (7 / 5 / 3). The themes repo's packages/color-themes/scripts/check.mjs already checks --fg-2 at 7 and --fg-3 at 5 on --bg and --bg-2.

Fix: TEXT_TIERS holds --fg-2 to 7 and --fg-3 to 5. --fg (7), --fg-4 (3) and the focus ring (3) are unchanged. The header comment, the warning examples in shared/skin-api.ts and the skin-authoring paragraph now give the same numbers.

Wire contract (shared/*): no shape change. InstalledSkin.warning is still an optional string. Only the numbers in it change ("needs 7" / "needs 5" in place of "needs 5" / "needs 4.5"), and some skins that had no warning now get one. A skin with a warning still applies.

The themes repo's shared-types copy of contrast.ts mirrors this file, so a later mirror refresh picks this up there.

Original proof (before the v0.8.18 refresh)

New test in shared/contrast.test.ts: #6b6b6b / #757575 on the light page warn on both grounds, and #595959 (7.0:1) / #6e6e6e (5.1:1) do not. The existing regex in server/skins/skins.test.ts that matched "needs 4.5" now matches "needs 5".

With main's shared/contrast.ts and this branch's tests, both fail:

 ❯ shared/contrast.test.ts (5 tests | 1 failed)
     × secondary text under 7:1 and meta text under 5:1 warn, though they clear 5 and 4.5
 ❯ server/skins/skins.test.ts (19 tests | 1 failed)
     × every built-in clears the text-tier floors; a low tier is a warning, not an error
- [
-   "--fg-2 on --bg 5.3:1, needs 7",
-   "--fg-2 on --bg-2 5.3:1, needs 7",
-   "--fg-3 on --bg 4.6:1, needs 5",
-   "--fg-3 on --bg-2 4.6:1, needs 5",
- ]
+ []
      Tests  2 failed | 22 passed (24)

On this branch:

$ npm run typecheck
> tsc -p tsconfig.json --noEmit && tsc -p web/tsconfig.json --noEmit
(no errors)

$ npm run lint
Checked 983 files. No fixes applied.
Found 135 warnings.   (none in the changed files: `biome check` on the four changed .ts files reports nothing)

$ npm test
 Test Files  248 passed (248)
      Tests  3369 passed | 2 skipped (3371)

$ npm run build
✓ built

No shipped skin starts warning. I checked with textTierWarnings on this branch: the built-in sessionpipe (dark and light) and Paper (light) skins and both stock schemes (STOCK_TEXT_TOKENS) return no warnings. npm test keeps "every built-in clears the text-tier floors" green. No bundled view ships a skin.json.

docs/color-theme.example.json (the sample "Mint" color theme) already warns on main: --fg-3 is 4.0:1 / 4.2:1, under the old 4.5, and --fg-4 is 2.5:1 / 2.6:1, under 3. This change adds one more line to its warning, --fg-2 on --bg 6.8:1, needs 7. Its tokens are left alone here to keep this to one change. Bringing the example up to its own floors would be a small follow-up.

No e2e spec asserts these warning strings, and nothing in the UI changes except the numbers in the warning text, so npm run test:e2e was not run.

Checklist

  • Every commit is signed off (git commit -s): the DCO is the only paperwork.
  • npm run typecheck && npm run lint && npm test pass; npm run test:e2e for a UI change. (No UI change.)
  • New source files start with // SPDX-License-Identifier: Apache-2.0. (No new files.)
  • No secret, real address, hostname or home path in code, fixtures or screenshots (screenshots come from --demo).
  • A change to shared/* names the wire-contract change in the description. (See "Wire contract" above.)
  • A line under Unreleased in CHANGELOG.md.

Symptom: a skin whose --fg-2 is 5.3:1 and --fg-3 4.6:1 on its page
(#6b6b6b and #757575 on white) is listed with no warning, although
tokens.css promises secondary text at 7:1 and meta text at 5:1.

Cause: shared/contrast.ts checked --fg-2 against 5 and --fg-3 against
4.5, while its own header says it measures the floors tokens.css
promises. docs/skin-authoring.md repeated 5 / 4.5 in its prose,
contradicting its own token table (7 / 5 / 3).

Fix: TEXT_TIERS now holds --fg-2 to 7 and --fg-3 to 5; --fg, --fg-4
and the focus ring are unchanged. The header comment, the warning
examples in skin-api.ts and the skin-authoring paragraph say the same.
A new test in shared/contrast.test.ts fails before and passes after;
the built-in skins and the stock schemes still clear every floor.

Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
@connorburgess

Copy link
Copy Markdown
Contributor Author

#276 also adds a test to server/skins/skins.test.ts (a skin.json saved as UTF-16 is read). The two branches merge cleanly into each other and into main; whichever lands second I'll rebase if needed.

Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
@connorburgess

Copy link
Copy Markdown
Contributor Author

The skin text contrast floor correction still applies to SessionPipe GUI v0.8.18. Merged current main (d16a2c01) into this branch; the refreshed head is c52f45ea. The affected files have not changed upstream, and the original change is preserved.

Added the previously deferred Unreleased changelog entry.

Validation on this head, macOS / Node 22.23.2:

  • npm run typecheck, npm run lint, and npm run build passed. Lint has the same 135 warnings and one informational diagnostic as current main, with no errors.
  • npx vitest run --maxWorkers=2 shared/contrast.test.ts server/skins/skins.test.ts: 24 tests passed.

GitHub CI run 47453785785 for head c52f45ea passed: typecheck · lint · unit · build, all three desktop e2e shards, e2e (phone · duo), e2e (control channel), and the aggregate typecheck · lint · unit · build · e2e gate.

Also checked the combined source/test changes from all 19 refreshed PRs on the same main: no source conflicts; typecheck, lint and build passed; all 252 unit-test files passed (3,439 tests, two skipped). This was a local integration check, separate from the individual PR run above. Release-note entries may still need combining as PRs land.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant