See every visual change a pull request makes, and confirm it is the change you meant.
StyleProof opens the UI states you care about in a real browser, records the computed CSS of every element on the
base branch and on the pull request, and posts what changed as a PR comment. The reviewer, a person or a coding agent,
reads the report and confirms that it shows the visual change the pull request set out to make. Approve the changes
you meant. In review-gate mode, the StyleProof check stays red until a reviewer approves them.
What a report looks like
This is the comment StyleProof posts on a pull request. In this example the PR changed one button's padding and background colour, and one link's hover, focus, and active colours. What the report tells you walks through it.
How this example was made: a real run, not a mockup
scripts/live-readme-report.mjs captures example/demo/index.html in Chromium twice, injecting a
fixed CSS change between the captures, then renders the report and the PR comment it would post. The
block is that comment, with three edits for this page: crop links repointed at
docs/readme/live-report/crops/, element-level sections reordered so Save at rest comes before the
Docs hover, focus, and active states, and report.json left out of the committed bundle. Every
finding, value, and crop is what the run produced. Both sides of each interaction-state crop are in
that state.
🗺️ StyleProof report
1 change needs review
1 distinct change (2 computed-style difference(s) · 3 state-delta difference(s)) in 1 changed surface base with an existing baseline.
Changes
Btn button.btn · 1 element restyled
demo-button @ 900
padding 14px 28px → 18px 32px
background-color #14b8a6 → #dc2626

◀ before · after ▶ — demo-button @ 900
Show highlight overlay

🔍 magenta boxes mark each change — changed: button.btn
Btn button.btn
Style:
| Property | Before | After |
|---|---|---|
padding |
14px 28px |
18px 32px |
background-color |
#14b8a6 |
#dc2626 |
Link a.link · 1 element restyled :hover
demo-button @ 900
Both sides are :hover. Left is the old :hover. Right is the new :hover.
:hover color #a5f3fc → #fca5a5

◀ base :hover · head :hover ▶ — both sides are :hover
Show highlight overlay

🔍 magenta boxes mark each change — changed: a.link
Link a.link
Interactive-state changes:
| State | Property | Before → After |
|---|---|---|
:hover |
color |
#a5f3fc → #fca5a5 |
:hover |
↳ caret-color (currentColor) |
#a5f3fc → #fca5a5 |
:hover |
↳ outline-color (currentColor) |
#a5f3fc → #fca5a5 |
:hover |
↳ column-rule-color (currentColor) |
#a5f3fc → #fca5a5 |
:hover |
↳ row-rule-color (currentColor) |
#a5f3fc → #fca5a5 |
:hover |
↳ text-decoration-color (currentColor) |
#a5f3fc → #fca5a5 |
:hover |
↳ text-emphasis-color (currentColor) |
#a5f3fc → #fca5a5 |
:hover |
↳ -webkit-text-fill-color (currentColor) |
#a5f3fc → #fca5a5 |
:hover |
↳ -webkit-text-stroke-color (currentColor) |
#a5f3fc → #fca5a5 |
Link a.link · 1 element restyled :focus
demo-button @ 900
Both sides are :focus. Left is the old :focus. Right is the new :focus.
:focus outline-color #5eead4 → #fca5a5

◀ base :focus · head :focus ▶ — both sides are :focus
Show highlight overlay

🔍 magenta boxes mark each change — changed: a.link
Link a.link
Interactive-state changes:
| State | Property | Before → After |
|---|---|---|
:focus |
outline-color |
#5eead4 → #fca5a5 |
Link a.link · 1 element restyled :active
demo-button @ 900
Both sides are :active. Left is the old :active. Right is the new :active.
:active color #2dd4bf → #f87171

◀ base :active · head :active ▶ — both sides are :active
Show highlight overlay

🔍 magenta boxes mark each change — changed: a.link
Link a.link
Interactive-state changes:
| State | Property | Before → After |
|---|---|---|
:active |
color |
#2dd4bf → #f87171 |
:active |
↳ caret-color (currentColor) |
#2dd4bf → #f87171 |
:active |
↳ outline-color (currentColor) |
#2dd4bf → #f87171 |
:active |
↳ column-rule-color (currentColor) |
#2dd4bf → #f87171 |
:active |
↳ row-rule-color (currentColor) |
#2dd4bf → #f87171 |
:active |
↳ text-decoration-color (currentColor) |
#2dd4bf → #f87171 |
:active |
↳ text-emphasis-color (currentColor) |
#2dd4bf → #f87171 |
:active |
↳ -webkit-text-fill-color (currentColor) |
#2dd4bf → #f87171 |
:active |
↳ -webkit-text-stroke-color (currentColor) |
#2dd4bf → #f87171 |
Nothing else — no other element or inventory changes in this compare.
- Approve all changes
Tick Approve all changes to turn the StyleProof check green — write access required, and not the pull request author. One tick signs it off. A new push that changes styles or surfaces re-opens it. Quickstart · Read the catch contract
What the report tells you
- The headline says how many distinct changes need review. Here that is one change, made of 2 computed-style differences and 3 interaction-state differences on one page.
- Each card is one changed element. It names the element (
button.btn), the page and viewport width it was captured at (demo-button @ 900), and the property changes in one line. - The before/after crop shows the element on the base branch and on the pull request. Cards for
:hover,:focus, and:activeshow both sides in that state. A highlight overlay marking the change is one click away. - The table lists every changed computed property with its old and new value. Properties that follow
currentColorare nested under the colour that drove them. - Warnings appear only when something is wrong, such as a page that was not captured or captures that may not show the same product state. A fully certified run keeps that evidence collapsed.
- Approve all changes turns the
StyleProofcheck green once a reviewer with write access, other than the PR author, ticks it. A later push that changes styles or surfaces reopens it.
The check compares the browser's computed CSS, not pixels. The crops are there so a person can see the change. The
pass or fail decision runs on the exact values in the table. Surface-key vocabulary (@width, live-state and popup
variants) is in docs/REFERENCE.md.
Where the report lives. On a pull request, the PR comment is the same linked summary for public and private repositories. Reports publish as workflow artifacts by default. The comment links the artifact on the run, and nothing is written to repository git history. Images travel inside the self-contained HTML.
Report artifacts contain only report.html, report.md and report.json. Open HTML offline for embedded images. Set report-max-bytes (default 2000000) to cap their combined size; HTML gets what Markdown (400 KB cap) and JSON (450 KB findings cap) leave. For pre-existing receipts that exhaust the combined budget, the library, CLI and Action retain them and apply the cap to HTML when the remaining bytes cannot hold report text; HTML explicitly announces this combined-budget overrun. Crops may be downscaled to fit the 300 KB per-image limit. Full findings remain in the original diff input, which is not included in the report artifact; preserve that input separately. Omissions are named; capped JSON adds findingsBudget and positive per-surface findingsOmitted counts. Local reports support --report-max-bytes and --html-max-bytes. Branch storage keeps crop files.
Reports cap crops at 60 files and 900,000 bytes across all surfaces. Crops over 300 KB are downscaled, then omitted if they still exceed the per-file cap. Local reports support --max-crop-files and --max-crop-bytes (0 disables crops); omissions are named, and every change remains listed and counted.
Every report viewer needs an authenticated GitHub session, because artifact downloads are never anonymous.
report-storage: branch opts into the styleproof-reports orphan branch for an in-browser rendered report, with
anonymous access on public repositories only. PR reports use pr-<n>/; runs without a resolved PR use
run-<run_id>/. Branch sweeps prune closed PR reports and dated run reports oldest first, protecting open PRs
and folders whose age is unknown. If publication or receipt verification fails, StyleProof posts no delivery claim for that run.
Why
Use StyleProof when a PR can change CSS, design tokens, component classes, layout, or hidden/open UI states and you want CI to say whether the browser's rendered styles actually changed. Unit and e2e tests prove behavior; StyleProof proves the visual contract for the states you declared.
It catches:
- a button recoloured by a token, utility class, CSS module, inline style, or design-system change;
- a layout shift at one breakpoint but not another;
- a dropped
:hover,:focus, or:activestyle; - a modal, menu, listbox, popover, sheet, or toast whose open state changed;
- a supposedly no-op refactor, such as CSS-to-Tailwind, that changed rendered output;
- a restyle on an element the PR also re-nested (a wrapper added or removed), paired back by geometry so the structural churn cannot hide it;
- a required route, component, or UI state that exists but has no capture.
The end-to-end catch contract lives in docs/what-it-catches.md.
How it works
- A surface is one UI state to certify: a route, tab, modal-open state, dropdown-open state, toast-visible state, loading state, etc.
- You list or auto-discover surfaces in a Playwright-style spec.
- StyleProof opens each surface at real breakpoint widths and records computed styles for every captured element.
- On a PR, it compares base vs head and reports exactly which rendered styles changed.
- The PR gets a
StyleProofstatus: green when nothing changed, red until someone approves intentional changes, or failing when certification mode is configured.
Selective remap
is opt-in. A changed file reached only through a computed import re-captures
every surface; recovered imports can widen a resolved dependency, but cannot
make an unplaced change selective. Changes reaching a conventional framework
wrapper (Next layout/_app, SPA App/main, Remix root, SvelteKit
+layout, Nuxt app.vue/layouts/, Gatsby gatsby-browser) before a declared
surface also re-capture everything. SPA page changes stay selective, and test, story,
script, or undeclared-route importers alone do not force a full re-capture.
StyleProof is not a screenshot diff. Screenshots appear in the report so humans
can see the change, but the gate compares browser-computed CSS: resolved
longhands, pseudo-elements, layout boxes, motion longhands, and forced
:hover/:focus/:active deltas.
Forced-state reads share a browser round trip with their liveness check and style flush. Each reset still flushes before the next state or target; captures remain serial, with the same coverage and resource limits.
Nested overflow scrollers are expanded for full-page report screenshots. <body>
is a candidate only when it scrolls itself: the root's computed overflow-y must
not be visible, which would propagate body overflow to the viewport. Capture
keeps rect in the driven page's document coordinates for correspondence and layout
comparisons; optional screenshotRect locates the element in the expanded image.
Crops and pixel attribution prefer screenshotRect, falling back to rect.
Recapture nested-scroller baselines for aligned evidence.
When a surface scrolls the document, capture also records the viewport's scroll
origin, the driven document's scroll height, and viewport.screenshotHeight measured
with screenshot scrollers expanded. A non-hidden element addition or removal requires
review if either its non-zero driven rect intersects the original driven bounds,
or its non-zero screenshotRect ?? rect intersects the screenshot bounds. Both use
horizontal bounds scrollX to scrollX + width and vertical top min(0, scrollY).
The driven bottom remains max(scrollY + height, documentHeight ?? Infinity);
the screenshot bottom is screenshotHeight. The gate is never laxer than before:
more additions/removals can become reviewable after expansion.
When any scroller is expanded, elements inside unexpanded scrollers can also get
screenshotRect; the gate does not infer per-ancestor clipping. Missing or invalid
(non-finite or non-positive) screenshotHeight fails closed with an unbounded
bottom, even with documentHeight. Hidden and zero-opacity additions stay advisory;
zero-size additions stay advisory when neither box has non-zero size.
Horizontal-scrolled changes retain report crops.
Older maps lack the origin and assume zero; recapture affected scrolled baselines
after upgrading.
Quickstart
StyleProof requires Node 22.13 or later, locally and in CI.
Upgrading to 8.0.0
StyleProof 8 runs in CI. Upgrade the npm package and the report Action to major 8 together, then refresh and verify the generated workflows with the same server/spec options you used at install:
npm install --save-dev styleproof@^8
npx styleproof-init --upgrade
npx styleproof-init --check
--upgrade moves the generated workflows to @v8 and removes the pre-push hook
an earlier release generated. Under --storage branch it also adds the
publish-base job, which publishes each default-branch commit's map from CI.
styleproof-map keeps a local capture local; pass --upload when a script of
yours publishes to the map store. See the
8.0.0 changelog.
Upgrading to 9.0.0
Upgrade the npm package and the report Action to major 9 together, then refresh and verify the generated workflows:
npm install --save-dev styleproof@^9
npx styleproof-init --upgrade
npx styleproof-init --check
--upgrade moves the generated workflows to @v9. Update any hand-written
uses: BenSheridanEdwards/StyleProof@v8 or styleproof-approve-reusable.yml@v8
pin to @v9 too: the Action runs its own copy of StyleProof, so an @v8 pin
keeps the 8.x gate. Then re-capture the baseline once. See the migration list
in the 9.0.0 changelog.
Empty hash home routes (#/, #!/, including a query) count as the page without a fragment, so home links do not capture the root twice.
For a defineCrawlCapture root that lands on a hash route such as /#/home,
replace the old index key with home in crawl expected / exclude lists
and acknowledgement files. Hash-route fragments stay verbatim: if your app
treats #/settings and #/settings/ as aliases, render one canonical link or
use defineCrawlCapture's match option to select one form.
Set up everything
npx styleproof setup
That one command detects npm, pnpm, Yarn, or Bun; installs StyleProof and
Playwright; installs Chromium; scaffolds the capture spec, a dedicated
production-build Playwright config, and one GitHub workflow; then verifies
every machine-owned file against the installed release. The default scaffold is
the smallest honest gate: one pull_request job captures base and head in the
same run and diffs them — maps live as workflow artifacts and the gate runs
entirely in CI — and it runs advisory: it reports evidence on every
PR without blocking. Preview the exact operations without writing with
npx styleproof setup --dry-run. In a monorepo, target the consumer
application explicitly:
styleproof setup --project-dir apps/web
--project-dir changes where dependencies are installed and all setup commands
run. --dir remains the capture-spec path inside that project, for example
--project-dir apps/web --dir e2e/styleproof.custom.spec.ts.
Opt-in flags reproduce the heavier architectures:
--workflow split— a read-onlypull_requestcapture job plus a trustedworkflow_runreport job. Required when the repository accepts fork or Dependabot PRs, whose tokens are read-only. Fork verdicts are advisory: the fork's code produces both map sets, so a fork PR'sStyleProofstatus stayspendinguntil a maintainer ticks Approve all changes — never green automatically.--storage branch— the SHA-keyedstyleproof-mapsstore branch, a CI job that publishes each default-branch commit's map, so CI restores maps instead of recapturing them.--mode certify/--mode review-gate— fail on any diff, or hold theStyleProofstatus red until a reviewer approves (scaffolds the approval workflow). Under--workflow split, the failing report job runs on the default branch, so certify also sets the PR'sStyleProofstatus red on any diff; certify approves nothing, so a fork PR's status stayspending.split + branch + review-gatereproduces the pre-v7 scaffold exactly.
Existing scaffolds keep their architecture: a marker in the generated workflow r