Repository navigation
Description
Overview
DESIGN.md L336 says "Derive hover states from --hover-background / --hover-foreground variables — never hardcode hover colors." That rule works for neutral/ghost buttons but has no answer for filled semantic buttons (destructive, primary): --hover-background resolves to --muted, so applying it literally to a filled destructive button turns it grey and destroys the semantic color the button exists to communicate.
With no token to reach for, call sites have each invented their own approach. There are currently three competing idioms across four sibling files:
| File | Line | Idiom |
|---|---|---|
delete-confirmation-modal.svelte |
106 | hsl(var(--destructive) / 0.85) — alpha |
pro-relogin-modal.svelte |
140 | hsl(var(--primary) / 0.85) — alpha |
update-banner.svelte |
82 | filter: brightness(1.08) |
first-pro-consent-modal.svelte |
187 | filter: brightness(0.92) |
Note the last two move in opposite directions from each other.
The alpha form inverts hover direction between themes
This is the concrete reason to prefer an explicit token over alpha. hsl(var(--x) / 0.85) is translucent, so it composites against hsl(var(--popover)) — which is near-white in light mode and near-black in dark. Computed relative luminance of the destructive button:
| Theme | Base | Hover | Direction |
|---|---|---|---|
| light | 78.2 | 104.7 | lightens |
| dark | 134.5 | 118.0 | darkens |
The hardcoded pair this replaced (#c0392b → #a93226) always darkened. Hover moving toward the surface is a defensible convention, but right now it is an emergent side effect of the alpha technique rather than a decision anyone made.
A second consequence: a translucent button lets whatever sits behind it show through. On the opaque modal panels in question that is invisible today, but it is a latent surprise if one of these buttons is ever placed over non-uniform content.
Proposed Solution
Add explicit hover tokens to packages/desktop-app/src/app.css, defined for both :root and .dark:
--destructive-hover--primary-hover
Then migrate all four call sites above to hsl(var(--destructive-hover)) / hsl(var(--primary-hover)), removing both the alpha form and the two filter: brightness() calls.
Decide and document one intended hover direction. Recommendation: darken in light mode, lighten in dark mode (hover moves away from the surface, increasing contrast), which is the more common convention and matches what the original hardcoded values did in the theme they were written for — but the point is to make it an explicit choice.
Consider whether a general rule (e.g. a documented lightness delta applied to every filled semantic color) is better than per-color tokens, so --success-hover / --warning-hover follow the same law rather than being hand-tuned later.
Acceptance Criteria
-
--destructive-hoverand--primary-hoverdefined in both:rootand.darkinapp.css - All four call sites listed above use the new tokens; zero
filter: brightness()and zero alpha-based hover remain among them - Hover direction is consistent across both themes and documented in
DESIGN.md -
DESIGN.mdL336's hover rule is amended to cover filled semantic buttons, not just neutral ones — the current wording is what left this gap - Buttons are fully opaque at rest and on hover
- Hover states meet WCAG AA contrast against their foreground in both themes (see Success token is below WCAG AA as text on light surfaces; *-foreground tokens are white in both themes #2668, which covers
*-foregroundcontrast and overlaps here) -
bun run quality:fixclean; design-token baseline does not grow
Context
Found during review of #2670 (closes #2591). Not a regression from that PR — it converted pre-existing hardcoded hex hovers into token-relative ones, which was strictly an improvement. The reviewer correctly identified that it also surfaced a real gap in the token system, deliberately deferred rather than widened mid-PR.
Related
- Replace hardcoded shadows and phantom color vars with design tokens (closes #2591) #2670 / Replace hardcoded shadows and colors in modal/toast/banner components with design tokens #2591 — where this was found
- Success token is below WCAG AA as text on light surfaces; *-foreground tokens are white in both themes #2668 —
*-foregroundtokens are white in both themes; same button-color surface area DESIGN.mdL280 (buttons), L336 (hover rule)
Activity
malibio commentedon Sep 17, 2026
Frontend baseline: 247 test files passed, 5085 tests passed
Add --primary-hover / --destructive-hover and unify filled-button hov…