Repository navigation
Add --primary-hover / --destructive-hover and unify filled-button hovers (closes #2673) - #2685
Conversation
…ers (closes #2673) Filled semantic buttons had no hover token to reach for, so four sibling files had each invented their own idiom — two of them moving in opposite directions: delete-confirmation-modal hsl(var(--destructive) / 0.85) alpha pro-relogin-modal hsl(var(--primary) / 0.85) alpha update-banner filter: brightness(1.08) lightens first-pro-consent-modal filter: brightness(0.92) darkens All four now use --primary-hover / --destructive-hover, defined per-theme. The rule, now documented rather than emergent: hover moves 6 points of HSL lightness AWAY from the surface — darker in light mode, lighter in dark. That makes contrast against the button's own foreground RISE on hover in both themes (4.86-8.45:1, up from 3.51-6.95:1 at rest), so hovering can never make a label harder to read. Every pairing clears WCAG AA. The alpha form is what made this worth a token rather than a convention. It is translucent, so it composites against the surface behind it and inverted the hover direction between themes: the destructive button lightened in light mode (luminance 78.2 -> 104.7) and darkened in dark (134.5 -> 118.0). Nobody chose that; it fell out of the technique. The new values are opaque, which also fixes the latent bug that a translucent button lets background content show through. Scope: no --success-hover / --warning-hover. Neither token is used as a filled button anywhere — the only solid --success is the code-block "copied" state, which has no hover — so they would be unused code. DESIGN.md records the rule so adding one later is an application of it, not a fresh invention. Considered and rejected: a constant perceptual step (equal CIE L*) instead of a constant HSL delta. It is the more principled law, but because HSL lightness is not perceptually uniform it needs per-token deltas of 4-13pp to hold — the values stop being derivable by eye and every future token needs a script. A flat 6pp HSL move lands between 2.6 and 9.8 L*, which is uneven but visible everywhere, and matches both the ~3-6% tonal steps DESIGN.md already uses for surface hierarchy and the 5.5pp of the hardcoded pair this ultimately replaces. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Pragmatic Code Review — PR #2685Review Type: Initial Review SummaryThis is a genuinely good change. It replaces three competing ad-hoc hover idioms across four sibling files with two tokens and — more valuably — a stated law ("move 6 points of HSL lightness away from the surface") that makes future hover values derivable rather than invented. The commit message and PR body do something worth calling out: they document the rejected alternative (a constant perceptual CIE L* step) with the concrete reason it loses — per-token deltas of 4–13pp, values no longer derivable by eye, a script needed for every future token. That is the kind of reasoning that stops a future contributor from re-litigating a settled decision. I independently recomputed every number in the diff and PR body from the HSL token values via WCAG relative luminance. All eight figures are exactly right. Verification of the stated claimsContrast figures — all four verified exact:
The "contrast RISES on hover in all four cases" claim holds, and the stated range "4.86–8.45:1, up from 3.51–6.95:1" is accurate to the digit. All four clear AA (≥4.5:1) at rest and hover — note light-mode 6pp HSL delta — verified for all four (light primary 35→29, light destructive 46→40, dark primary 41→47, dark destructive 70→76), direction "away from the surface" in both themes as claimed. The L* honesty check: the PR claims the flat 6pp move "lands between 2.6 and 9.8 L*". For these four tokens I measure ΔL* of 9.10 / 5.93 / 7.90 / 6.08 — inside the stated envelope. The PR does not oversell the uniformity it is buying, which is the right way to document a deliberately imperfect heuristic. Alpha-inversion claim — verified. Light-mode destructive under Requirements Check (7 acceptance criteria)
On criterion 5 specifically — I checked the remaining alpha/opacity usages in the touched files and agree both categories are legitimately out of scope:
Code Review Findings🔴 CriticalNone. 🟡 Important📁 This is the finding I most want on the record. The PR migrates four hand-rolled Those are alpha fills — exactly what I computed what those alpha hovers actually do. All four cases move the wrong way — contrast falls on hover, the precise failure mode this PR's law exists to prevent:
The dark-mode destructive case is the notable one: Why I am not blocking: it is pre-existing, outside the issue's stated four call sites, and the issue was explicitly scoped to those four. Widening a clean +28/−4 token PR into a shadcn-variant refactor is exactly the scope creep the Pragmatic Quality framework says not to force. The change in front of me is unambiguously net-positive without it. But the PR body claims "Zero Recommendation: file a follow-up to migrate Principle: DRY / single source of truth. A design law stated in 📁 Eight sites — The issue enumerated three idioms; there is a fourth the issue did not catalogue. These are genuine filled primary buttons whose hover is a whole-element opacity fade:
These are less harmful than the alpha-background form: Same reasoning as above: out of the issue's stated scope, correctly not absorbed into this PR, worth filing. Complexity: small-to-medium — eight one-line changes, but each needs a glance to confirm the base fill is Principle: consistency. The PR's value is that there is now one answer; leaving a fourth idiom in eight files means the "one answer" is still competing with something. 🟢 Suggestions📁 The shared rule for all Nit: add a breadcrumb at line 23 — e.g. Principle: locality of reference — documentation should be discoverable from the thing it documents. 📁 The constraint is correct today, and I verified it independently: the only solid So the scope decision to omit The residual risk is only that the day someone adds a filled 🟢 Nit: On whether a regression test is warrantedI looked hard at this, since the PR now states a law future tokens must follow. My read: a narrow test is justified, but as a follow-up, not a merge blocker. The precedent cuts both ways:
The pragmatic call: the values are static, change roughly never, and are documented at the declaration site with figures I verified as correct. That is adequate for now. That said, the 🟡 finding above is the argument for the test — the shadcn variants drifted from the law precisely because nothing enforced it. If one is written later, the high-value assertion is not the 6pp delta but:
That single property is what the whole design is for, and it would have caught the dark-mode destructive regression above. Worth folding into the follow-up issue rather than gating this PR. Consistency / staleness checkI grepped every
What this PR does wellWorth stating explicitly, because it is why this is an approve:
RecommendationAPPROVE. Correct, verified, well-documented, and a clear net improvement to code health. The 🟡 findings are pre-existing scope this PR is not obligated to absorb — but they should be filed before they are forgotten, since this PR is precisely what makes them legible as defects. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE
All 7 acceptance criteria met. I independently recomputed all eight WCAG contrast figures from the HSL token values via relative luminance — every number in the diff, comments and PR body is exact (light primary 4.86:1, light destructive 6.66:1, dark primary 5.79:1, dark destructive 8.45:1), the 6pp HSL delta holds for all four tokens, and the "contrast rises on hover" claim is true in both themes. The scope decision to omit --success-hover/--warning-hover is factually correct and verified: the only solid --success fill in the frontend is the code-block "copied" state, which has no hover, and there are zero solid --warning fills.
Submitted as a comment rather than an approval because GitHub rejects self-approval on an own-authored PR. The real verdict is APPROVE.
Two follow-ups worth filing (both pre-existing scope, correctly not absorbed here):
- 🟡 The shared shadcn
buttonVariants(ui/button/types.ts:12-14) still uses the alpha idiomDESIGN.mdnow forbids, and loses contrast on hover in all four cases — dark-modedestructivedrops 5.92:1 → 3.39:1, below AA. - 🟡 Eight filled primary buttons use
opacity: 0.9on hover, a fourth un-catalogued variant of the same theme-blind trick.
Full findings in the PR comment above.
Adds src/tests/design/filled-button-hover.test.ts (21 tests) and a breadcrumb from --primary-hover to the rule comment ~40 lines below it. The review's strongest point was that the rule this PR documents is one stylelint structurally cannot enforce. `--destructive-hover: 345 77% 60%` is a well-formed custom property holding a plain HSL triple in the one file allowed to contain raw values — every design-token rule passes while the button fades toward its background on hover. The invariant is arithmetic on the values, so it needs an executable guard, the same argument node-accent-colors.test.ts makes for the single-accent rule. The load-bearing assertion is not the 6pp delta but: contrast(hover, foreground) > contrast(base, foreground) An AA floor alone is too weak. A dark --destructive-hover of 64% sits at 7.3:1 against near-black — comfortably above 4.5:1 — while being DARKER than the 70% base, i.e. hover making a destructive button's label harder to read. Verified by temporarily injecting exactly that value: the direction and no-contrast-loss tests both fail, the AA test passes. That is the regression class this catches. Two things the test found while being written: - An early draft had readHsl() take a token with the colon already appended, so the built pattern was `--primary:\s*:`, matching nothing. It returned null on a miss and callers did `if (!base) return`, so 16 tests passed vacuously. readHsl now throws on a miss — a token that cannot be read is a broken test, not a passing one. - Asserting every --*-hover has a .dark twin failed on --console-surface-hover, correctly: app.css documents the console surface as deliberately theme-invariant, defined once under :root. Requiring a twin would push app.css toward the duplication that comment argues against, so the assertion is scoped to theme-tracking tokens. Review findings NOT addressed here, filed instead: - #2689 — the shared shadcn Button still uses `hover:bg-primary/90` and `hover:bg-destructive/90 dark:bg-destructive/60`. Every variant loses contrast on hover; dark destructive hits 3.39:1, below AA. Not a token swap: the dark rest state is itself translucent and `text-white` bypasses --destructive-foreground, so it needs a design decision plus ~18 consumers re-checked. Stock shadcn boilerplate untouched since the repo flattening, never reconciled with the token system. - #2690 — eight filled primary buttons use `opacity: 0.9` as hover, a fourth idiom the issue did not catalogue. Milder (opacity fades the label too, so the ratio holds) but theme-blind the same way. Mechanical, but eight files each needing its base property checked and orphaned opacity transitions removed. Both are pre-existing, in files this PR does not touch, and absorbing either would turn a token change into a component refactor. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review addressed —
|
| Assertion | Result |
|---|---|
| AA floor (≥4.5:1) | ✅ passes — too weak on its own |
| moves lighter than base | ❌ fails |
| does not lose contrast | ❌ fails |
That's the regression class this exists for, and precisely your #2689 scenario.
Two things surfaced while writing it, both in the commit message:
- An early draft's
readHsl()built the pattern--primary:\s*:and matched nothing — it returnednull, callers didif (!base) return, and 16 tests passed vacuously. It now throws on a miss. - Asserting every
--*-hoverhas a.darktwin failed on--console-surface-hover— correctly.app.cssdocuments that surface as deliberately theme-invariant. Requiring a twin would push toward the duplication that comment argues against, so the assertion is scoped to theme-tracking tokens.
✅ Addressed: breadcrumb (🟢)
--primary-hover at line 23 now reads /* 4.86:1 on its fg; see --*-hover rule below */, keeping the ratio and adding the pointer to the block ~40 lines down.
⏭️ Filed, not fixed: both 🟡 findings
I sized both before deciding, per issue-workflow.md's "establish the size before you decide, not after."
#2689 — shared shadcn Button. I reproduced your numbers; dark destructive hover is 3.39:1. This is not a token swap, which is what makes it separate scope: dark:bg-destructive/60 makes the dark rest state translucent too, so swapping only the hover leaves a translucent rest under an opaque hover, and text-white bypasses the --destructive-foreground that #2668 gave real per-theme values. That's a design decision (is the muted /60 deliberate?) plus tailwind.config.js registration plus ~18 consumers re-checked. git log shows the file untouched since the repository flattening — stock shadcn boilerplate that predates the token work.
#2690 — eight opacity: 0.9 hovers. Confirmed all eight. Mechanical per site, but each needs its base property checked (background vs background-color) and some carry now-orphaned transition: opacity declarations; :disabled { opacity } must be left alone. Eight files this PR doesn't touch.
Both are pre-existing; absorbing either turns a +28/−4 token change into a component refactor.
On scope, since you raised it
Agreed the --success-hover / --warning-hover omission delivers the law without the unused instantiations — and the new test encodes that: FILLED_BUTTON_TOKENS is the list to extend when a token earns a filled-button use, and the suite then holds it to the same rule automatically.
Verification
bun run test— 248 files / 5106 tests passed (baseline 247/5085, + the 21 new)bun run quality:fix— clean; design-token baseline unchanged at 137- Pre-push gate — full pyramid passed
Derives the remaining two state colors by the same rule — 6 points of HSL
lightness away from the surface — so all four semantic tokens carry a hover and
the rule has no gaps:
--success-hover light 32% -> 26% 7.26:1 on its fg (up from 5.35)
dark 37% -> 43% 10.54:1 on its fg (up from 7.81)
--warning-hover light 30% -> 24% 7.32:1 on its fg (up from 5.26)
dark 51% -> 57% 10.77:1 on its fg (up from 9.96)
All four clear AA and rise on hover, with a clean 6pp delta and no clamping at
either end of the lightness range.
Neither token has a filled-button use today, so this is deliberately ahead of
demand. The argument for deriving them now rather than at first use is the
history this PR is cleaning up: the three competing idioms it replaced all came
about because someone needed a hover, had no token to reach for, and invented
one. A derived value waiting in the file means the first --success button
applies the law instead of starting that cycle again.
Extends FILLED_BUTTON_TOKENS so the suite holds the full set to the rule — 41
tests, up from 21. Re-verified the guard bites on the new tokens by injecting a
dark --warning-hover of 45% (darker than its 51% base, still far above AA): the
direction and no-contrast-loss assertions fail, the AA assertion passes.
Updates the app.css comment and DESIGN.md, both of which stated the now-reversed
"--success and --warning have no such use today and so have no hover token".
DESIGN.md gains the contrast table for all four.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
| Token | Theme | Base → hover | Contrast on its fg |
|---|---|---|---|
--success-hover |
light | 32% → 26% |
5.35 → 7.26:1 |
--success-hover |
dark | 37% → 43% |
7.81 → 10.54:1 |
--warning-hover |
light | 30% → 24% |
5.26 → 7.32:1 |
--warning-hover |
dark | 51% → 57% |
9.96 → 10.77:1 |
Clean 6pp delta on all four, no clamping at either end of the lightness range, every value clears AA and rises on hover.
This is deliberately ahead of demand — neither token has a filled-button use today. The argument for deriving now rather than at first use is the history this PR is cleaning up: all three competing idioms it replaced came about because someone needed a hover, had no token to reach for, and invented one. A derived value sitting in the file means the first --success button applies the law instead of restarting that cycle.
FILLED_BUTTON_TOKENS extended, so the suite holds the full set to the rule — 41 tests, up from 21. Re-verified the guard bites on the new tokens: injected a dark --warning-hover of 45% (darker than its 51% base, but still far above AA) and the direction + no-contrast-loss assertions failed while the AA assertion passed, same as the earlier destructive check.
Also corrected the two places that stated the now-reversed decision — the app.css comment and the DESIGN.md note — since a stale rationale is exactly the drift this PR exists to remove. DESIGN.md (6d91adc) gains the contrast table for all four and a pointer to the enforcing test.
Verification
bun run test— 248 files / 5126 tests passed (5106 + the 20 new assertions)bun run quality:fix— clean; design-token baseline unchanged at 137- Pre-push gate — full pyramid passed
Pragmatic Code Review — PR #2685 (Re-Review)Review Type: Re-Review Re-review of Previous Review SummaryThe prior review returned APPROVE with 7/7 acceptance criteria met, zero 🔴, two 🟡, and three 🟢.
New issues introduced in this range: none. Two 🟢 observations below, neither blocking. The central risk: test and values share an authorThe values were computed by a script; the test that checks them was written by the same author. If the WCAG math were wrong it would be wrong identically in both places and still pass green. I treated this as the review's main job. 1. I recomputed all 16 figures independently, in Python via
All 16 match to the stated precision, including the four rest-state figures the new values rise from. Every hover clears AA and exceeds its own rest contrast. 2. I verified the test file's helpers are themselves correct, which is the part a shared author could not self-check. I ran the test's own Floating-point identical. Against WCAG's own anchors the test's helpers return white/black = 21.0000, white/white = 1.0000, and Does the test actually assert anything?The prior draft's
That last one is the important one: it is the exact regression class the AA floor alone would let through, and it is precisely the assertion the prior review asked for. It works. Mechanics verified individually:
The 6pp ruleAll eight pairs are exactly ±6pp, correct direction per theme, no clamping: Nothing approaches 0 or 100 — the nearest is light warning at 24%, with 24 points of headroom. The
|
| # | Criterion | Status | Note |
|---|---|---|---|
| 1 | --destructive-hover / --primary-hover in both :root and .dark |
✅ | app.css:23, 88 / :169, 208. Untouched by this range beyond comment text |
| 2 | Four call sites migrated; zero filter: brightness(), zero alpha hovers among them |
✅ | Unchanged in this range; verified in the prior review |
| 3 | Hover direction consistent across themes and documented in DESIGN.md |
✅ strengthened | Was documentation only; now mechanically enforced for all four tokens in both themes, and the doc carries the contrast table |
| 4 | DESIGN.md L336 rule amended to cover filled semantic buttons |
✅ | 3d48f90 (prior range) + 6d91adc (this range) |
| 5 | Buttons fully opaque at rest and on hover | ✅ | The four new values are opaque HSL triples; no alpha introduced |
| 6 | Hover states meet WCAG AA in both themes | ✅ | Independently recomputed — all 8 hover figures ≥ 4.86:1, all above their rest state |
| 7 | quality:fix clean; design-token baseline does not grow |
✅ | quality:design-tokens: "No new design-token violations (137 known)" — 137, unchanged |
Verification run locally:
bun run --cwd packages/desktop-app test -- src/tests/design/filled-button-hover.test.ts— 41 passedbun run test— 248 files / 5126 tests passed, matching the author's claim exactlybun run --cwd packages/desktop-app quality:design-tokens— clean at 137
Code Review Findings
🔴 Critical
None.
🟡 Important
None in this range. The two 🟡 items from the prior review (buttonVariants, the eight opacity: 0.9 sites) remain open follow-ups and remain correctly out of scope.
🟢 Suggestions
📁 packages/desktop-app/src/tests/design/filled-button-hover.test.ts:100 — readHsl's regex is unanchored on the left.
new RegExp(\${token}(?![\w-])…`)guards the right edge but not the left, so a token whose name *ends with* the target would mis-bind. I confirmed this is **not** currently exploitable —--sidebar-primarycontains-primary, not --primary, and a real CSS custom property cannot embed --mid-name — so this is theoretical. A(?<![\w-])` lookbehind would close it symmetrically for one character of cost.
Principle: defensive symmetry. A guard applied to one edge of a boundary invites the question of why not the other; the answer here is "it happens not to matter", which is worth one character to stop relying on.
📁 packages/desktop-app/src/app.css:78-85 — the dead-code justification is sound and, more importantly, legible.
The repo's CLAUDE.md forbids unused code, and --success-hover/--warning-hover have no call sites. The user requested them, so whether they exist is settled; the question I assessed is whether a future reader will understand why rather than deleting them as dead.
They will. The justification is recorded in three places that a reader is likely to hit:
app.css:79-85— at the declaration, naming the concrete history ("which is how the three competing idioms this replaced came about")DESIGN.md— in the Button rule, with the contrast table- The test docblock at
:78-83—FILLED_BUTTON_TOKENSexplicitly states the set is closed and tells the next author to extend it
That last one matters most: because the test holds all four to the rule, these are not inert constants. They are covered by an executable invariant, which is a materially different thing from dead code — a wrong edit to --success-hover fails CI today, with no filled success button anywhere. I read the greenfield rule as aimed at unused code paths and speculative abstraction; a derived constant under test, whose derivation is the PR's entire thesis, does not carry the maintenance burden that rule exists to prevent. The YAGNI tension is real but small, and the anti-drift argument is the stronger one given this PR exists because four files each invented a value in the absence of one.
🟢 Nit: 41 tests for 8 values is proportionate, not bloated. It is 5 assertions × 4 tokens × 2 themes + 1 cross-theme check. Each of the five checks a distinct property (declared / direction / hue-saturation invariance / AA floor / no contrast loss), and my mutation testing showed different mutations caught by different subsets — the hue mutation is caught only by the hue assertion, and the 47% mutation only by direction and no-contrast-loss. None is redundant. Per-token, per-theme naming means a failure reports dark theme > does not lose contrast hovering --warning, which names the token, the theme, and the violated law without opening the file. Failure messages are actionable.
🟢 Nit: FILLED_BUTTON_TOKENS is the right extension point. A single as const array with a docblock saying "Add a token here when you add its hover" — adding a fifth state color is one line and inherits all ten assertions. The base()/hover()/foreground() thunk pattern is a deliberate, correct choice: reading lazily inside each it means a missing token fails that test with --X-hover is not declared as a plain HSL triple in this theme block rather than crashing collection for the whole file. My deletion mutation confirmed exactly that behavior — 5 targeted failures with readable messages, not a collection error.
Recommendation
APPROVE.
Both commits do what they claim. The test is the rare case of a guard that genuinely guards: I verified its arithmetic against an independent implementation to floating-point precision, checked it against WCAG's published anchors, and broke the token values four different ways to confirm it fails — including a mutation that clears AA and is caught only by the no-contrast-loss assertion the prior review specifically asked for. The four new values are exactly ±6pp in the right direction and their eight contrast figures are correct to the digit.
The scope reversal is executed cleanly: both documentation sites updated, no third location left stating the old decision, and the "unused token" objection answered by putting the tokens under an executable invariant and recording the reasoning where a future reader will find it.
The two 🟡 items from the prior review remain the right follow-ups — the shadcn buttonVariants alpha hovers (where dark-mode destructive drops to 3.39:1, below AA) are now the most valuable thing left in this area, and this PR's test is the tool that would catch them once those variants move onto tokens.
No re-review needed for the two 🟢 nits above; neither blocks merge.
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): APPROVE
Scope: 195aa074..HEAD — 8f0eea34 (executable guard) and 63512a7d (closed hover-token set). 2 files, +193/−6.
Verified independently rather than taking the diff's word, since the values and the test that checks them share an author:
- All 16 contrast figures recomputed (4 new hovers + 4 new rest states + the 8 pre-existing) in Python via a different HSL algorithm and my own WCAG luminance — every one matches to the stated precision.
- The test's own
hslToRgb/luminance/contrasthelpers cross-checked against a structurally different reference over 200,000 random HSL pairs: max deviation1.4e-14. They also hit WCAG's anchors exactly (21.0000 / 1.0000 / 4.5430). The math is independently right, not identically wrong. - Mutation-tested for vacuous passes (the earlier draft's regex bug produced 16). Four mutations, all caught — including dark
--warning-hover57%→47%, which still clears AA at 8.86:1 and is caught only by thedoes not lose contrastassertion the prior review asked for. Working tree restored, 41/41 green. - 6pp rule: all eight pairs exactly ±6pp, correct direction per theme, no clamping.
--console-*filter: legitimate — that surface is documented atapp.css:144-156as deliberately theme-invariant and defined once under:root. Load-bearing, tightly scoped.- Stale docs: both
app.cssandDESIGN.md(6d91adc) updated; grep found no third location stating the old decision.
Prior review's 🟢 test suggestion and breadcrumb suggestion both addressed; its two 🟡 items (shadcn buttonVariants alpha hovers — dark destructive at 3.39:1, below AA — and eight opacity: 0.9 sites) correctly remain out of scope as follow-ups.
7/7 acceptance criteria still met; criterion 3 strengthened from documented to mechanically enforced. bun run test: 248 files / 5126 passed. Design-token baseline unchanged at 137.
Two 🟢 nits, neither blocking: readHsl's regex is unanchored on the left (not currently exploitable), and the dead-code tension on --success-hover/--warning-hover is resolved well — they are covered by an executable invariant and the rationale is recorded in three places a future reader will hit.
Full findings in the review comment above. Self-authored PR, so --approve is unavailable; the real verdict is APPROVE.
Closes #2673.
The gap
DESIGN.md's hover rule — "derive hover states from--hover-background/--hover-foreground" — works for neutral and ghost surfaces but had no answer for filled semantic buttons.--hover-backgroundresolves to--muted, so applying it literally to a filled destructive button turns it grey and destroys the semantic the button exists to communicate.With no token to reach for, four sibling files each invented their own idiom — and two of them moved in opposite directions:
delete-confirmation-modal.sveltehsl(var(--destructive) / 0.85)hsl(var(--destructive-hover))pro-relogin-modal.sveltehsl(var(--primary) / 0.85)hsl(var(--primary-hover))update-banner.sveltefilter: brightness(1.08)hsl(var(--primary-hover))first-pro-consent-modal.sveltefilter: brightness(0.92)hsl(var(--destructive-hover))Zero
filter: brightness()and zero alpha-based hovers remain among them.The rule
Hover moves 6 points of HSL lightness away from the surface — darker in light mode, lighter in dark. This is now stated in
app.cssandDESIGN.mdrather than being emergent.The consequence that makes it the right direction: contrast against the button's own foreground rises on hover in both themes, so hovering can never make a label harder to read.
--primary35% → 29%--destructive46% → 40%--primary41% → 47%--destructive70% → 76%All four clear WCAG AA. Note light-mode
--primaryat rest is 3.51:1 against--primary-foreground— fine for a button per #2668's reasoning (UI component, not body text), and hover improves it rather than eroding it.Why a token and not a convention
The alpha form is the concrete argument.
hsl(var(--x) / 0.85)is translucent, so it composites against the surface behind it — which inverted the hover direction between themes:Nobody chose that; it fell out of the technique. The new values are opaque, which also fixes the latent bug the issue flagged — a translucent button lets whatever sits behind it show through, invisible on today's opaque modal panels but a surprise waiting for the first such button over non-uniform content.
Scope: no
--success-hover/--warning-hoverThe issue asked whether a general law should cover every filled semantic color. It should — and
DESIGN.mdnow states it — but neither token is used as a filled button anywhere. The only solid--successis the code-block "copied" state, which has no hover. Defining hover tokens for them today would be unused code, which this repo's greenfield rules forbid. Documenting the rule means adding one later is an application of it, not a fresh invention.Considered and rejected: a constant perceptual step
Equal CIE L* movement is the more principled law, but HSL lightness is not perceptually uniform, so holding L* constant needs per-token deltas of 4–13pp — the values stop being derivable by eye and every future token needs a script to compute. A flat 6pp HSL move lands between 2.6 and 9.8 L*: uneven, but visible everywhere, and consistent with both the ~3–6% tonal steps
DESIGN.mdalready uses for surface hierarchy and the 5.5pp delta of the hardcoded#c0392b → #a93226pair this ultimately replaces.Docs
DESIGN.md(innodespace-docs, pushed separately as3d48f90) splits the hover rule by button kind, documents the derivation, and adds a Don't covering both replaced idioms as theme-blind.Verification
bun run test— 247 files / 5085 tests passed, identical to the pre-change baselinebun run quality:fix— clean; design-token baseline unchanged at 137 entries (did not grow)🤖 Generated with Claude Code