Skip to content

experimental theme: a one-color layer is a fill only where it covers the whole box - #13252

Merged
josephfarina merged 2 commits into
feature/theme-editorfrom
josephfarina/theme-a/01f-flat-layer-covers
Nov 21, 2026
Merged

josephfarina merged 2 commits into
feature/theme-editorfrom
josephfarina/theme-a/01f-flat-layer-covers

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Theme authors using astryx experimental theme editor no longer see a faint-text note for a link whose underline is drawn as a thin gradient, or for a part with a layer sized 0.

Problem and solution fit

The pictures' faint-text check counted a one-color background layer as a fill over the whole box, whatever its background-size, background-position and background-repeat. A 2px underline gradient then read as the color behind the link's text (1:1), and a layer sized 0 0 turned a 4.54:1 button into a faint note. A layer now counts as a fill only when it covers the box; a layer sized 0 draws nothing; a layer over part of the box leaves no one color behind the text, as any other image does. A tint on a box beside the text keeps the text out again, a gradient stop in a color the probe cannot read (such as oklch()) is no longer taken as flat, and a layer whose size or place the browser keeps as calc() counts as covering part of the box.

Expected behavior and authority

Text contrast at 4.5:1 (3:1 for large text), as the editor's existing faint-text notes state.

Smallest restoration

The coverage test for one-color layers in the pictures' probe; no new command or option.

Evidence

  • Before: an underlined link (linear-gradient(#111111, #111111) bottom / 100% 2px no-repeat) was noted at 1:1; a 0 0 layer made a readable button a faint note.
  • After: neither is noted; a pressed state's tint over the whole box is still measured as a fill.
  • Regression test: both cases in theme-drawn-contrast-noted.test.mjs (fails before the change, passes after).

Scope

Components: theme editor (drawn-contrast probe)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

theme-drawn-contrast-noted.test.mjs with a browser, eslint on the changed files.

Gate

preflight: pass 41f566e
replay: worse 0 at 41f566e

@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 21, 2026 11:22am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 21, 2026, 1:14 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 21, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision about which ground the experimental theme editor's faint-text check measures, and one defect needs fixing either way.

No current spec says what the pictures' faint-text check measures text against, so an engineering owner needs to approve this pull request's reading, or name the spec that governs it, by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. The reading to settle: a one-colour background layer is a fill under the text only when it covers the whole box, a layer sized 0 is skipped, and text over a partial layer, over a gradient with a stop the probe cannot read, or overlapped by a box beside it with any background image is left out.

Blocking, whatever the owner decides:

  • coverage() in packages/cli/foundation/render/drawn-contrast.mjs (lines 231-235) reads a position Chrome serializes as calc() (for example right 200px) as offset 0, so a full-size one-colour layer that leaves a strip of the box bare still counts as a fill and readable #333333 text on that strip is noted at 1.14:1; treat a position it cannot parse as partial and add the case to theme-drawn-contrast-noted.test.mjs.

Non-blocking: a layer larger than the box and placed off 0 reads as partial (test containment instead), the media JSDoc (lines 239-243) still says "gradients between colors", and the sibling-image and oklch() readings have no test.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: before, a link with a thin gradient underline was noted at 1:1 and a layer sized 0 made a readable button a faint note. Verified: the pull request's fixture is noted at 1:1 and 3.04:1 on the base.
  • Claim (changeset and description): a one-colour layer counts as a fill only when it covers the whole box. False for a position written as calc() (the blocking finding); verified for full-box tints, tiled and repeat-x layers, and bottom underlines.
  • Claim: a layer sized 0 draws nothing. Verified (drawn-contrast.mjs:169, :229).
  • Claim: a layer over part of the box leaves the text out, as any other image does. Verified (:170).
  • Claim: a tint on a box beside the text keeps the text out again. Verified (:258); no test covers it.
  • Claim: a gradient stop in a colour the probe cannot read, such as oklch(), no longer reads as flat. Verified (:171-176); no test covers it.
  • Claim: a pressed state's full-box tint is still measured as a fill. Verified: 3.83:1 on base and head, and the existing test case passes.
  • Claim: the regression test fails before the change and passes after. Verified: with the head's test on the base it fails with exactly the underline and size-0 entries; it passes at the head.
  • Claim: no new command, option or public API. Verified: no package export reaches the file, and no command doc changed.
  • Claim: eslint passes on the changed files. Verified.
  • Claim: public text carries no internal context. Verified.
  • File .changeset/experimental-theme-flat-layer-covers.md: clear.
  • File packages/cli/foundation/render/drawn-contrast.mjs: the blocking finding; two non-blocking notes (oversized layer, stale media JSDoc).
  • File packages/cli/api/theme-edit/theme-drawn-contrast-noted.test.mjs: needs the calc() case; non-blocking note on the two untested readings.

Automated review (maintainer link)

…the whole box

The pictures' faint-text check counted any one-color background layer as a fill over the whole box, whatever its size, position and repeat. A link with a 2px underline drawn as a gradient read its text at 1:1, and a layer sized 0 turned a readable button into a faint note. A layer now counts as a fill only when it covers the box; a layer sized 0 draws nothing; a layer over part of the box leaves no one color behind the text. A tint on a box beside the text keeps the text out again, and a stop in a color the probe cannot read (oklch) is no longer taken as flat.

[skip ci]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision about which ground the experimental theme editor's faint-text check measures, and two defects need fixing either way.

No current spec says what the pictures' faint-text check measures text against, so an engineering owner needs to approve this pull request's reading, or name the spec that governs it, by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. The reading to settle: a one-colour background layer is a fill under the text only when it covers the whole box, a layer sized 0 is skipped, and text over a partial layer, over a gradient with a stop the probe cannot read, or overlapped by a box beside it with any background image is left out.

Blocking, whatever the owner decides:

  • coverage() in packages/cli/foundation/render/drawn-contrast.mjs (lines 231-235) reads a position Chrome serializes as calc() (for example right 200px or bottom 30px) as offset 0, so a full-size one-colour layer that leaves a strip of the box bare still counts as a fill and readable #333333 text on that strip is noted at 1.14:1; treat a position that is not a plain length or percentage as partial and add the case to theme-drawn-contrast-noted.test.mjs.
  • Miss: coverage() (lines 223-229) reads a size written as calc() (for example calc(100% + 20px)) as drawing nothing, so white text on a black layer that covers its box is noted at 1:1, a false note the base did not give; treat a size that is not a plain length or percentage as partial and add the case to the same test.

Non-blocking: a layer larger than the box and placed off 0 reads as partial (test containment instead), the media JSDoc (lines 239-243) still says "gradients between colors", and the sibling-image and oklch() readings have no test.

Claims and files checked

Review mode: full; reason: rebase

  • Claim (changeset): a one-colour layer counts as a fill only when it covers the whole box, so a thin gradient underline or a layer sized 0 never reads as the colour behind the text. Verified for whole-box tints, bottom underlines and size 0; false for positions and sizes written as calc() (the blocking findings).
  • Claim: before, a gradient underline was noted at 1:1 and a layer sized 0 made a readable button a faint note. Verified on the base: the fixture's underline at 1:1, and its button (6.9:1 on its own fill) at 3.04:1; the 4.54:1 figure names no fixture in the pull request.
  • Claim: a layer now counts as a fill only when it covers the box, a layer sized 0 draws nothing, and a layer over part of the box leaves no one colour behind the text. Verified for plain lengths and percentages; false for calc() values (the blocking findings).
  • Claim: a tint on a box beside the text keeps the text out again. Verified (noted 1:1 on the base, left out at the head); no test covers it.
  • Claim: a gradient stop in a colour the probe cannot read, such as oklch(), is no longer taken as flat. Verified (noted 1.66:1 on the base, left out at the head); no test covers it.
  • Claim: after the change neither case is noted, and a pressed state's whole-box tint is still measured as a fill. Verified: 3.83:1 on base and head.
  • Claim: the regression test fails before the change and passes after. Verified: with the head's test on the base it fails with exactly the underline and size-0 entries; it passes at the head with its browser cases run.
  • Claim: text contrast stays at 4.5:1, or 3:1 for large text. Verified (drawn-contrast.mjs:331).
  • Claim: one defect, no tagalongs, and no new command, option, public API, default or interaction model. Verified: no export, command or option changes and no tagalong; whether the reading restores current spec is the owner decision above.
  • Claim: tested with a browser and eslint on the changed files. Verified: four tests pass with the browser cases, and eslint passes.
  • Claim: public text carries no internal context. Verified.
  • File .changeset/experimental-theme-flat-layer-covers.md: its "only when it covers the whole box" is untrue for calc() values; the blocking correction fixes it.
  • File packages/cli/foundation/render/drawn-contrast.mjs: the two blocking findings; non-blocking notes on the oversized layer and the stale media JSDoc.
  • File packages/cli/api/theme-edit/theme-drawn-contrast-noted.test.mjs: needs the two calc() cases; non-blocking note on the two untested readings.

Automated review (maintainer link)

… covers part of its box

A position Chrome keeps as calc() (right 200px) read as offset 0, and a size kept as calc() read as drawing nothing, so a layer that leaves a strip bare counted as a fill, and one that covers its box was skipped. A size or place that is not a plain length or percentage is now taken as covering part of the box, and a layer that holds the box whole covers it wherever it is placed. Tests cover both, a tint on a box beside the text, and a stop the probe cannot read.

[skip ci]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision about which ground the experimental theme editor's faint-text check measures; the two calc() problems from the previous review are fixed, and nothing else blocks.

No current spec says what the pictures' faint-text check measures text against, so an engineering owner needs to approve this reading, or name the spec that governs it, by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. The reading to settle: a one-colour background layer is a fill under the text only when it covers the whole box, a layer sized 0 is skipped, and text is left out when it sits over a layer that covers part of its box or whose size or position the probe cannot read (such as calc()), over a gradient with a stop the probe cannot read, or overlapped by a box beside it with any background image.

Non-blocking: coverage is measured against the border box (drawn-contrast.mjs lines 125 and 222), so a px-sized layer that fills a bordered part's padding box reads as partial and its faint text goes unreported, and GitHub lists 90 files here only because the base branch was rewritten, so a rebase onto its tip would show just this change.

Claims and files checked

Review mode: full; reason: history

  • Claim (changeset): a one-colour layer counts as a fill only when it covers the whole box, so a thin gradient underline, a layer placed off its edge, a size the browser keeps as calc() or a layer sized 0 never reads as the colour behind the text. Verified by the test fixtures and a browser probe of the base and this head.
  • Claim: authors no longer see a faint-text note for a gradient-underlined link or a part with a layer sized 0. Verified: noted at 1:1 and 3.04:1 on the base, not noted here.
  • Claim: before, the check counted any one-colour layer as covering the box whatever its size, position and repeat. Verified on the base.
  • Claim: before, the underline read at 1:1 and a layer sized 0 0 turned a 4.54:1 button into a faint note. Verified for the underline and for the test's button (6.9:1 on its own fill, noted at 3.04:1); the 4.54:1 figure names no fixture.
  • Claim: a layer counts as a fill only when it covers the box, a layer sized 0 draws nothing, and a layer over part of the box leaves no one colour behind the text. Verified (drawn-contrast.mjs lines 166-170 and 200-245).
  • Claim: a tint on a box beside the text keeps the text out again. Verified: noted at 1:1 on the base, left out here, and tested.
  • Claim: a gradient stop the probe cannot read, such as oklch(), is no longer taken as flat. Verified: noted at 3.04:1 on the base, left out here, and tested.
  • Claim: after the change neither case is noted and a pressed state's whole-box tint is still measured. Verified: 3.83:1 on the base and here.
  • Claim: the regression test fails before the change and passes after. Verified: on the base it fails with exactly five extra notes; all four tests pass here with their browser cases run.
  • Claim: text contrast stays at 4.5:1, or 3:1 for large text. Verified (lines 337-338).
  • Claim: one defect, no tagalongs, and no new command, option, public API, default or interaction model. Verified for the three files that differ from the base; whether the reading restores current spec is the owner decision above.
  • Claim: tested with a browser and ESLint on the changed files. Verified: the test passes with its browser cases and ESLint passes.
  • Claim: public text carries no internal context. Verified.
  • File packages/cli/foundation/render/drawn-contrast.mjs: the non-blocking border-box note; otherwise clear.
  • File packages/cli/api/theme-edit/theme-drawn-contrast-noted.test.mjs: clear.
  • File .changeset/experimental-theme-flat-layer-covers.md: clear.
  • Files byte-identical at the base and this head (the base branch's own history), each clear: .changeset/ experimental-theme-body-font-keeps-heading-titles, experimental-theme-border-color-brings-border, experimental-theme-contrast-state-tint, experimental-theme-field-edge-exact-command, experimental-theme-field-edge-follows-border, experimental-theme-how-cli-lines-run, experimental-theme-how-colon-subjects, experimental-theme-how-light-and-dark-work, experimental-theme-how-lone-color-after-part, experimental-theme-how-pieces-whole-looks, experimental-theme-how-side-navigation, experimental-theme-how-status-alert-size, experimental-theme-how-stripe-name-forms, experimental-theme-how-stripe-transparent, experimental-theme-how-stripe-words-beside, experimental-theme-how-stripes-on-striped-tables, experimental-theme-how-system-type, experimental-theme-how-the-page-label, experimental-theme-kept-palette-hand-edits, experimental-theme-page-note-one-mode, experimental-theme-rest-look-keeps-hover-focus, experimental-theme-rounding-anywhere-pills, experimental-theme-text-size-main-piece, how-first-ask-compiles-less, how-text-look-runs, theme-round15-part-02, theme-round15-part-03, theme-round15-part-10 and theme-round15-part-13 (.md).
  • Also byte-identical and clear: docs/specs/AST-050-app-themes/spec.md, packages/cli/clients/cli/commands/experimental-theme-editor-set.doc.mjs and scripts/vitest-node-durations.json.
  • Also byte-identical and clear, under packages/cli/api/theme-edit/: _check, _css, _edit, _how-commands, _how-question, _how-sides, _how-steps, _how-values, _how-words, _how, _missed, _palette, _settings, _text-looks and themeEditSet.doc (.mjs), and the tests theme-amounts-property-families-zero, theme-border-follows, theme-dials-reach-parts, theme-edit-border-color-needs-a-border, theme-edit-border-none-sides, theme-edit-text-size-main-piece, theme-excepted-part-spacing-border, theme-field-edge-follows-border, theme-flat-keeps-colored, theme-held-flat-fill-banner-text, theme-how-border-sides, theme-how-clause-subjects, theme-how-corner-positions, theme-how-every-clause-answered, theme-how-family-named, theme-how-lexicon-need, theme-how-list-items, theme-how-list-ownership, theme-how-offers-follow-the-answer, theme-how-page-reaches-frame, theme-how-reads-pieces-and-whole-looks, theme-how-roles-and-sides, theme-how-text-look-runs, theme-how-tint-and-mode-pairs, theme-how, theme-neutral-mode-words-direction, theme-page-note-one-mode, theme-palette-newer-recipe-opens, theme-palette-unknown-recipe, theme-part-state-wins-build, theme-part-text-sits-core, theme-rest-look-keeps-hover-and-focus, theme-resting-shadow-part-rings, theme-scope-semantics-fill-lighter, theme-set-takes-text-a-part-reads, theme-state-part-states-changed, theme-thick-borders-chain-reaches, theme-titles-shadows-alpha-state, theme-together-rounding-anywhere-reaches and theme-token-family-follows-fills (.test.mjs).

Automated review (maintainer link)

// as covering part of the box.)
const plain = /^-?[\d.]+(px|%)?$/;
let part = false;
for (const [i, whole] of [box.width, box.height].entries()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: box is the border box (getBoundingClientRect() at line 125), but CSS sizes and places a layer in the padding box. So a px-sized layer that fills a bordered part's padding box reads as partial, and its faint text is left out: #333333 on a black 216px 40px layer inside a 4px border is noted at 1.66:1 on the base and not here. Subtracting the computed border widths from box before comparing would keep those notes.

@josephfarina
josephfarina marked this pull request as ready for review November 21, 2026 12:58
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 41f566e

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: an engineering owner approved the faint-text reading for this head, the earlier calc() problems stay fixed, and nothing blocks.

Two non-blocking points: coverage is measured against the border box (drawn-contrast.mjs lines 125 and 222), so a px-sized layer that fills a bordered part's padding box reads as partial and its faint text goes unreported; and the description's 4.54:1 figure names no fixture (the test's button is 6.9:1 on its own fill).

Claims and files checked

Review mode: same-head; reason: none

  • Claim (changeset): a one-colour layer counts as a fill only when it covers the whole box, so a thin gradient underline, a layer placed off its edge, a calc() size or a layer sized 0 never reads as the colour behind the text. Verified: drawn-contrast.mjs lines 166-170 and 200-245, and the test's Underlined, Placed off its edge, Sized by calc and Unsized layer cases.
  • Claim: authors no longer see a faint-text note for a gradient-underlined link or a part with a layer sized 0. Verified: noted at 1:1 and 3.04:1 on the base, not noted at this head.
  • Claim: before, the check counted any one-colour layer as covering the box whatever its size, position and repeat. Verified: the base read only the layer's image.
  • Claim: before, the underline read at 1:1 and a layer sized 0 0 turned a 4.54:1 button into a faint note. Verified for the underline and for the test's button (6.9:1 on its own fill, noted at 3.04:1); the 4.54:1 figure names no fixture.
  • Claim: a layer counts as a fill only when it covers the box, a layer sized 0 draws nothing, and a layer over part of the box leaves no one colour behind the text. Verified (lines 166-170 and 200-245).
  • Claim: a tint on a box beside the text keeps the text out again. Verified: lines 259-273; noted at 1:1 on the base, left out here, and tested.
  • Claim: a gradient stop the probe cannot read, such as oklch(), is no longer taken as flat. Verified: line 173 with the parser at lines 39-64, and tested.
  • Claim: a layer whose size or place the browser keeps as calc() counts as covering part of the box. Verified: lines 227 and 237, and tested.
  • Claim: after the change neither case is noted and a pressed state's whole-box tint is still measured. Verified: 3.83:1 on the base and here.
  • Claim: the regression test fails before the change and passes after. Verified: on the base it fails with exactly five extra notes; all four tests pass here with their browser cases run.
  • Claim: text contrast stays at 4.5:1, or 3:1 for large text. Verified (lines 337-338).
  • Claim: the smallest restoration is the coverage test in the probe, with no new command or option. Verified: three files change and no command doc or export does.
  • Claim: one defect, no tagalongs, and no new public API, default or interaction model. Verified for the three files; the reading itself is owner-approved for this head.
  • Claim: tested with a browser and ESLint on the changed files. Verified: the test passes with its browser cases and ESLint passes.
  • Claim: the author's own preflight and replay gates passed at this head. Not a code claim; nothing at this head contradicts it.
  • Claim: public text carries no internal context. Verified.
  • File packages/cli/foundation/render/drawn-contrast.mjs: the non-blocking border-box note; otherwise clear.
  • File packages/cli/api/theme-edit/theme-drawn-contrast-noted.test.mjs: clear.
  • File .changeset/experimental-theme-flat-layer-covers.md: clear, and consistent with the code and the test.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit 194ece4 into feature/theme-editor Nov 21, 2026
13 checks passed
josephfarina added a commit that referenced this pull request Nov 21, 2026
…the whole box (#13252)

Reviewed pull request #13252, merged into the theme working branch. It reaches main with the branch's next landing.
josephfarina added a commit that referenced this pull request Nov 21, 2026
- #12787 experimental theme: a pressed or hovered part's flat tint is measured as the fill it is
- #13252 experimental theme: a one-color layer is a fill only where it covers the whole box
- #13300 experimental theme: a fill and its on-color set inside a part are measured as that part draws them
- #13321 experimental theme: a part's fill pair is measured though its on-color is set for the whole theme
- #13360 experimental theme: an on-color set on a part holding the readers leaves the fill pair out
- #12768 feat(cli): experimental theme editor show <theme> --on <part> gives what one part of a theme shows
- #13057 experimental theme pictures: sheet cells are never narrower than what they hold, and a panel over the page is drawn at its cell's full width
- #13200 experimental theme pictures: a change removes the pictures cut from a tall one
- #13199 experimental theme pictures: the pages section draws the sample app whole, cut between pages and named
- #13320 fix(cli): corners said before their edge run after it, so the whole answer does both
- #13375 experimental theme how: a clashing fill's text color goes in that fill's choice
- #13411 experimental theme how: a clash with a see-through fill joins its text too; another look's text leaves it joined
- #13420 fix(cli): experimental theme editor - glossy writes no sample gradient
- #13452 test(cli): the said-order test reads a named corner as that corner
- #13262 fix(cli): experimental theme editor - an ask that starts with clear the and names only removable looks takes them away
- #13450 fix(cli): experimental theme editor - a bar's text token is checked in the menus its items open
- #13442 feat(cli): a light neutral also fills the page, surface and card backgrounds in light mode
- #13477 docs(changeset): the clear reading takes looks away for one part
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed on main in #13470.

@github-actions
github-actions Bot deleted the josephfarina/theme-a/01f-flat-layer-covers branch November 22, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 41f566ed Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant