Repository navigation
Themes: write the contract down and check it in CI - #321
Merged
Merged
Conversation
rdrake
force-pushed
the
theme-contract
branch
from
November 21, 2026 01:48
0b10495 to
ebb5dfb
Compare
rdrake
marked this pull request as ready for review
November 21, 2026 01:48
themes.md § The theme contract: the tokens a theme sets, the attributes the app puts on <html> for every theme (data-motion-rest was in none of the docs), and what a restated selector costs. test/tests/themeContract.ts reads the files, so it runs in CI where the browser scenarios cannot: every custom property a theme declares is read by client/ (panasync's --ansi-cyan-dim was not, and is gone), and each theme's :root tokens, resolved through its imports in light and dark and lowered to sRGB by Lightning CSS, hold 4.5:1 for text, muted text and links on the window and chat, on a highlighted row and on the rail, and 3:1 for the join line. Day's link blue is the one recorded exception. Also drops twenty rules in style.css that no component uses (the old settings sync panel, the push state dots, the session rows).
A :root under a width query is a surface of its own; a block that re-maps either side of a pair is measured with what it inherits, including the blocks that qualify it from above (zelenzy's dialogs under Increase Contrast); ps's light words and the chat's surfaces outside #chat are the named exceptions. Known exceptions carry today's ratio as their floor, a token that resolves to no colour fails instead of yielding NaN, and the rail is checked at both ends of its gradient. The docs say what the browser scenarios cover.
…blocks a broader one also matches A block on <html> (a width query's :root, ps by night) cascades with :root and resolves there; the blocks below start from those computed values. A block whose selector narrows another's (ps's light words under the outline, rim and glow settings) now inherits it. The picture and chat-only exceptions apply only where the block leaves the surface alone or every branch is outside the chat. Day's link floor is its measured 3.03.
rdrake
force-pushed
the
theme-contract
branch
from
November 21, 2026 03:15
09a240d to
f64ddf3
Compare
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 2 of the theme-structure review: what a theme can rely on, written down and checked in CI.
What changes
docs/resources/themes.md§ The theme contract, covers:<html>it may key on, in a table with each attribute's values and source;test/tests/themeContract.tschecks it (40 tests, run in CI with no browser):client/. The only exception is ps's switched-off animal slots.style.cssand the theme's@importchain, then checks the pairs the app paints::root, every block that re-maps either side of a pair is checked as its own surface, with the blocks it sits inside, that qualify it, or that match wherever it does. Blocks on<html>cascade with:root; the blocks below start from their computed values.style.css(old sync, push-state and session-row styles) and panasync's unused--ansi-cyan-dim.Verification
pnpm testpasses (lint, typecheck, mocha).--rail-fgfrom coffee.css, darkening ps's night muted ink, a low-contrast link, and a light window under ps's light words each fail the test.Not done
client/, so it does not yet tell a token read only by another theme.