Skip to content

Fix light-mode --accent-foreground contrast on --accent fill - #2760

Merged
mstomar125 merged 1 commit into
mainfrom
issue-2724-accent-foreground-contrast
Sep 21, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-2724-accent-foreground-contrast

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

Light-mode --accent-foreground was 240 4% 10% (near-black) — copied from --secondary-foreground, where it's correct because --secondary's fill is near-white. On --accent's dark 176 100% 24% fill it's the opposite situation: dark text on a dark fill, 3.40:1, below the 4.5:1 AA floor.

Every other light-mode --*-foreground in app.css follows the documented rule (near-white text on a dark light-mode fill; near-black under .dark on a bright fill) — --accent-foreground was the one exception.

Fix

Set light --accent-foreground to 0 0% 100%, matching --destructive-foreground/--success-foreground/--warning-foreground. Yields 5.19:1, clearing AA. Dark mode was already correct (0 0% 98% on 173 87% 27%, 4.58:1) and is untouched.

Site audit

Checked every text-accent-foreground / var(--accent-foreground) usage in packages/desktop-app/src (16 files, ~25 call sites — Svelte components, .ts variant definitions, and noderef.css). Every single one pairs text-accent-foreground with a bg-accent (or background: hsl(var(--accent))) in the same conditional/state selector — hover:, focus-visible:, focus:, data-[highlighted]:, data-[state=open]:, an isSelected && conditional class, or an unconditional variant fill (active: 'bg-accent text-accent-foreground'). No site rests text-accent-foreground on a non-accent surface, so none flips to unreadable light-on-light.

Independently re-verified (fresh subagent, redid the search and the contrast math from scratch): confirms 3.4012:1 old / 5.1883:1 new, and the same 16-file/zero-regression result.

Test changes

focus-treatment.test.ts had a test pinning the old 3.40:1 ratio as a documented "known gap" (added by #2718, which explicitly didn't own this defect). Removed that test and its now-unused AA import, since the gap it recorded is closed.

Docs

nodespace-docs/DESIGN.md updated separately (docs repo, direct commit per its own workflow): the accent-foreground token value in the frontmatter now matches, and the "known gap" paragraph is removed.

Acceptance criteria

  • Light --accent-foreground clears 4.5:1 against --accent (5.19:1)
  • Value follows the documented --*-foreground rule (near-white in light, near-black in dark)
  • Every text-accent-foreground site checked — none regressed
  • focus-treatment.test.ts's pinned assertion and "known gap" comment removed
  • DESIGN.md note removed

Closes #2724

Co-Authored-By: Claude Sonnet 5 [email protected]

…2724)

--accent-foreground was 240 4% 10% (near-black), copied from
--secondary-foreground, sitting on --accent's dark 176 100% 24% fill:
3.40:1, below the 4.5:1 AA floor. Set it to 0 0% 100% (5.19:1),
matching the near-white pattern every other light-mode --*-foreground
already follows for a dark fill.

Every text-accent-foreground call site pairs it with bg-accent (or
--accent directly) in the same state selector (hover, focus-visible,
focus, data-highlighted, data-state=open, or an unconditional variant
fill) -- none rests on a non-accent surface, so none flips to
unreadable light-on-light.

Removes focus-treatment.test.ts's pinned 3.40:1 "known gap" assertion
and its now-unused AA import, since the gap it recorded is closed.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mstomar125
mstomar125 merged commit 785af0e into main Sep 21, 2026
@mstomar125
mstomar125 deleted the issue-2724-accent-foreground-contrast branch September 21, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Light-mode --accent-foreground is near-black on a dark accent fill (3.40:1)

1 participant