Skip to content

Add --destructive-hover / --primary-hover tokens and unify filled-button hover states #2673

Closed

Description

@malibio

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-hover and --primary-hover defined in both :root and .dark in app.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.md L336'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 *-foreground contrast and overlaps here)
  • bun run quality:fix clean; 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

Activity

  1. malibio commented on Sep 17, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 247 test files passed, 5085 tests passed

  2. self-assigned this
    on Sep 17, 2026
  3. added a commit that references this issue on Sep 17, 2026
    3c9d26e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions