Skip to content

Merge 21 theme tokens into the roles they alias or nearly copy - #7156

Merged
max-sixty merged 4 commits into
mainfrom
agent-a6c7edf8f0adcc281
Nov 25, 2026
Merged

max-sixty merged 4 commits into
mainfrom
agent-a6c7edf8f0adcc281

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Merges 21 theme tokens into the tokens they alias or nearly copy, so each name a theme sets stands for something a theme author would set apart. leaf-dev interface lists 205 styling names, from 226. A new test in tests/model/test_theme_tokens.py fails any token whose value is only another token's, which would have caught each of the eleven mark aliases.

  • Leaf's marks wear the theme's roles instead of a token each. The user's marks (--lf-here, --lf-turn, --lf-turn-ink, --lf-turn-wash) read --lf-ok, --lf-ok-ink and --lf-ok-wash. The agent's (--lf-thread, --lf-work, --lf-news) read --lf-accent. A change (--lf-change) reads --lf-muted, and a settled choice (--lf-settled, --lf-settled-ink, --lf-settled-tint) reads --lf-ink-2, --lf-ink and --lf-chip. Each was already an alias of the token it now reads, so none of these changes a pixel.
  • Near-duplicates merge, each a small visible change: inline code's ground into --lf-chip (a shade deeper), the added and removed line tints into --lf-ok-tint and --lf-danger-tint, --lf-chip-r into --lf-r-s, --lf-font-label into --lf-font-heading (small-capital labels get 1.45 leading for 1.3, about 1.7px taller), --lf-font-choice-stacked into --lf-font-choice with line-height: 1 (was 1.1), and --lf-motion-return into --lf-motion-fold (a draft's frame returns in 220ms, was 180ms).
  • The On Me count drops its own fill/ink pair for --lf-paper digits on --lf-ok-ink: unchanged in light; in dark it becomes a light green pill with dark digits, and its contrast rises from 4.9:1 to 9.7:1.
  • --lf-font-count becomes Leaf's own, since only the margin marks read it.

A theme can no longer colour the unread dot, a thread's marker or the agent's work apart from links, give focus and the user's turn a colour apart from success green (focus alone can still be set through --lf-focus-ring and --lf-focus-shadow), or set inline code's ground apart from chips. --lf-quiet stays: it is a full step dimmer than --lf-muted, chosen for empty boxes and the panel's status.

Asked for by max-sixty on a Leaf page, and reviewed by a fresh-context Claude Code session, whose finding on --lf-quiet is folded in. pnpm run check, pnpm run test:runtime, the token and font model tests, and focused browser tests on rings, margin entries, the folded leaf's badge, options and theme composition pass.

This was written by Claude Code on behalf of max-sixty

A theme's colour, type and motion settings each stand for one thing a theme
author would set apart. Names that only aliased another token, or duplicated
one within a step, are merged into it, and every reader is cut over:

- Leaf's marks wear the theme's roles: the user's (--lf-here, --lf-turn,
  --lf-turn-ink, --lf-turn-wash) read --lf-ok, --lf-ok-ink and --lf-ok-wash;
  the agent's (--lf-thread, --lf-work, --lf-news) read --lf-accent; what
  changed (--lf-change) reads --lf-muted; and what is settled
  (--lf-settled, --lf-settled-ink, --lf-settled-tint) reads --lf-ink-2,
  --lf-ink and --lf-chip.
- The On Me count (--lf-badge-fill, --lf-badge-ink) wears --lf-paper digits
  on --lf-ok-ink: the same in light, and a light green pill with dark digits
  in dark, where its contrast rises from 4.9:1 to 9.7:1.
- Inline code (--lf-code-bg) stands on --lf-chip, an empty box's words
  (--lf-quiet) wear --lf-muted, and an added or removed line (--lf-add-tint,
  --lf-del-tint) stands on --lf-ok-tint or --lf-danger-tint.
- A chip's corner (--lf-chip-r) is --lf-r-s, a region's small-capital name
  (--lf-font-label) is set in --lf-font-heading, the dial's stacked choice
  (--lf-font-choice-stacked) is --lf-font-choice set solid, and a frame
  returning from its editor (--lf-motion-return) takes --lf-motion-fold.
- --lf-font-count stays Leaf's own: only the margin marks read it.
- The tooltip's private aliases (--lf-tip-bg and the rest) give way to the
  tokens they named.

leaf-dev interface lists 204 styling names, from 226.

Asked for by the maintainer on a Leaf page: reduce the cardinality of the
theme's settings, leaning towards too much consolidation.
… renames another

--lf-quiet is not a near-duplicate of --lf-muted: it is a full step dimmer
(4.8:1 against the paper in light, where muted reads 5.8:1), and the user chose
it for every empty box's words and the floating panel's status, which a notice
outshines until it passes. Merging it made every placeholder a step louder and
left the notice no brighter than the status, so it stays a token of its own.

A theme token whose value is another token's, which no other scope restates,
now fails tests/model/test_theme_tokens.py: every reader could read the token it
names. The eleven mark tokens this branch merges were such names, and the test
would have caught each of them.

Also corrects two comments the merge touched: a tooltip's corners are --lf-r,
not --lf-r-s, and muted on the danger tint reads 4.8:1 in light, as measured in
Chromium, where the comment said 4.31:1.
@max-sixty
max-sixty merged commit 4bdda14 into main Nov 25, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-a6c7edf8f0adcc281 branch November 25, 2026 10:09
max-sixty pushed a commit that referenced this pull request Nov 25, 2026
…st lf-age's first-paint change (#7189)

`test_bundled_widgets_meet_the_widget_quality_checks` has failed in the
nightly journeys since #7156. The `[default]` case failed on `lf-toc`
and the `[browser]` case on `lf-age`. Both cases pass with this change.

- **`lf-toc` (the cause #7179 tracks).** Before its outline arrives,
`lf-toc:empty` reserves the closed toggle's height. That reservation
hard-coded the label face's leading as `var(--lf-t-6) * 1.3 + 14px`.
#7156 merged `--lf-font-label` into `--lf-font-heading`, whose leading
is 1.45, so the upgraded toggle (`.lf-label`) grew taller than its first
paint: 29px → 31px in a column page and 28px → 29px in a workspace page.
The empty element now takes `--lf-font-heading` and reserves `1lh +
14px`, which is the toggle's line plus its padding. The first box and
the toggle now read one token, so a later change to the face can't pull
them apart again. On screen, the closed contents toggle's first-paint
box is about 2px taller, the height the toggle already has once
upgraded. Nothing else moves.
- **`lf-age`.** This failure was also in scheduled run
[45598918111](https://github.com/max-sixty/leaf/actions/runs/45598918111),
and no cause issue owned it. An age first paints the words its author
wrote, such as "24 Nov, 02:10 UTC", until the runtime defines the
element and draws the computed age, such as "1d ago". Its registry entry
already tells authors that an age changes width and how to reserve its
room. So this is the kind of content-derived startup change
`known_widget_findings.py` exists to list, and it joins that list under
`browser`.

Verification: at `32dc564a8`, `uv run pytest
tests/journeys/test_widget_quality.py --run-nightly` fails on both
findings. On this branch the file's 19 tests pass.
`tests/browser/widgets/test_contents_and_glosses.py` and the theme and
font model tests also pass.

Closes #7179 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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.

2 participants