Repository navigation
Centred on whole pixels: whole line boxes, even icons, and a renderer check - #192
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The measurement logic still skips inline replaced elements and mishandles ancestor transparency and table borders, causing missed checks and false centring failures.
4 open issues
What changed in this PR
Builds on #190’s capital-centred labels to reduce half-pixel spacing in renderer controls and add a shared check for whole-pixel centring.
Changes:
- Rounds label line boxes to whole pixels and SDK icons to even sizes.
- Adjusts group titles, database status icons, and workflow lock pills.
- Adds the
centred-pixelsprobe, check, regression coverage, and documentation.
| File | Description |
|---|---|
packages/renderers/testing/test/helpers.test.mjs |
Tests pixel-check reporting and updates the check count. |
packages/renderers/testing/src/types.ts |
Defines pixel measurements and check identifiers. |
packages/renderers/testing/src/probe.ts |
Registers the pixels probe call. |
packages/renderers/testing/src/measure/pixels.ts |
Measures centred boxes for unequal or fractional gaps. |
packages/renderers/testing/src/measure/labels.ts |
Shares inner-edge measurements and handles next-row rules across table sections. |
packages/renderers/testing/src/measure.ts |
Exports the pixel measurement function. |
packages/renderers/testing/src/checks/labels.ts |
Adds the whole-pixel centring check. |
packages/renderers/testing/src/checks/catalog.ts |
Adds the check’s title and description. |
packages/renderers/testing/README.md |
Documents the new check. |
packages/renderers/sdk/icons.css |
Rounds icons to even pixel dimensions. |
packages/renderers/kit/styles/status.css |
Rounds label line boxes up to whole pixels. |
packages/renderers/kit/styles/layout.css |
Centres group icons alongside labels. |
packages/renderers/harness/browser/labels.spec.ts |
Adds a deliberate negative test for fractional gaps. |
packages/renderers/database/src/styles.css |
Uses odd-sized status icons within the existing row rhythm. |
packages/renderers/agentic-workflows/src/styles.css |
Centres lock-pill contents without trimming their wrapper. |
packages/renderers/agentic-workflows/src/card.tsx |
Wraps lock text in pk-label. |
docs/guides/renderer-kit.md |
Extends label and icon sizing guidance. |
docs/guides/develop-a-renderer.md |
Adds whole-pixel centring guidance for renderer authors. |
Review effort: Balanced
agorischek
force-pushed
the
agorischek/cap-labels
branch
from
November 23, 2026 00:07
b3e00b6 to
4da3a73
Compare
agorischek
force-pushed
the
agorischek/whole-pixels
branch
3 times, most recently
from
November 23, 2026 02:21
831feaa to
dfd48d9
Compare
… check Polish step (d). The user's rule: UI spacing never settles on half pixels (a 28px control in a 32px row, not a 31px one). Unitless line heights (13px x 1.5 = 19.5px) and 1em icons (13px) made bands and pills fractional and left odd room around centred icons, so they sat a half pixel off. - Kit `pk-label` rounds its line box up to a whole pixel, so a band or pill sized by labels is whole (19.5 -> 20). - SDK icons are even squares, `round(1em, 2px)`: a 13px font's icon is 14px. - A group title centres its icon with its label instead of lowering it by baseline arithmetic, so the icon centres on the capitals and on whole pixels. - Database rows keep their 32px rhythm. Under a row's 1px rule there is 31px of room, so the row's status icon is odd, the name's size (13px), and centres at 9px either side. - The agentic-workflows stale-lock pill holds the lock as its label: words as a `pk-label`, the icon centred beside them. - `centred-pixels` (probe call `pixels`): a painted box centred in a bar, chip or button (nearest painted ancestor up to 48px across, gaps up to 16px) sits at equal, whole-pixel gaps. A collapsed table rule counts half to each cell, and the row below's rule is read across table sections. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
agorischek
force-pushed
the
agorischek/whole-pixels
branch
from
November 23, 2026 02:42
dfd48d9 to
add4edb
Compare
…ls measured as drawn - A box inside an opacity: 0 container isn't held (effectiveOpacity); a replaced element (img, canvas, …) is a box though inline. - A collapsed table cell's room is inside half of each rule it shares beside it (innerSides), and the rule under it is the cells' directly below it, not the next row's widest (innerEdges). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

Polish step (d), stacked on #190 (its base; this retargets to
mainonce #190 merges).Why
Unitless line heights and 1em icons put bands, pills and centred icons on half pixels. A 13px label in a 1.5 line is 19.5px, and a 13px icon leaves odd room in an even band, so a centred icon sat a half pixel off. The rule: UI spacing never settles on half pixels.
Kit and SDK
pk-labelrounds its line box up to a whole pixel (round(up, 1lh, 1px)), so a band or pill sized by labels is whole (19.5 → 20).round(1em, 2px), so a 13px font's icon is 14px.Renderers
pk-labeland the icon centred beside them.Check:
centred-pixels(probe callpixels)labels.specrestores 1em icons and unrounded lines; the probe then finds the band icons off by half a pixel.checks.specandlabels.specon chromium-desktop, webkit-desktop and chromium-mobile;oxfmt --check;check --fast.Where text moves more than 1px
I measured every text node in the top 600px of all 77 scenarios against #190. Text within a band, pill or row moves at most about 1px. Larger moves:
Before and after, per renderer (2×: before left, after right; light above, dark below)
agentic-workflows
api
code-statistics
database
dependency-injection
file-packing
gallery
graph
runtime-policy
text-diff