Skip to content

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

Closed

Description

@malibio

Overview

In light mode, --accent-foreground is a near-black 240 4% 10% sitting on --accent, which is a dark teal at 176 100% 24%. That is dark text on a dark fill: 3.40:1, below the 4.5:1 AA floor for normal text.

The dark theme gets this right — its --accent-foreground is 0 0% 98% on a 173 87% 27% fill, 4.58:1.

Why it reads as a copy/paste slip rather than a choice

Every other light-mode --*-foreground in app.css is near-white, because every light-mode semantic fill is dark:

Token Light fill Light foreground Ratio
--destructive 345 77% 46% 0 0% 100% 5.36:1
--success 97 45% 32% 0 0% 100% 5.35:1
--warning 38 97% 30% 0 0% 100% 5.26:1
--accent 176 100% 24% 240 4% 10% 3.40:1

--accent-foreground is identical to --secondary-foreground (240 4% 10%), which is correct for --secondary because that fill is a near-white 240 5% 96%. It was very likely carried across from the neighbouring entry.

app.css already states the governing rule in its own comment:

--*-foreground is the text color for a SOLID fill of the matching token. It is white here and near-black under .dark — the inverse of the usual intuition, because the light-mode fills are dark and the dark-mode fills are bright.

--accent is the one token that does not follow it.

Blast radius

hover:bg-accent hover:text-accent-foreground ships on seven sites today, and the focus work in #2718 extends the same pairing to keyboard focus on the chrome surface. Every one of them is a 3.40:1 label in light mode.

Fix

Set light --accent-foreground to 0 0% 100%, matching the other three light-mode state foregrounds. That yields 5.19:1, above AA and consistent with the stated rule.

Worth checking during implementation whether any site deliberately relies on the current near-black value — a text-accent-foreground used on a surface other than an --accent fill would flip from dark to light text.

Acceptance Criteria

  • Light --accent-foreground clears 4.5:1 against --accent
  • The value follows the --*-foreground rule already documented in app.css (near-white in light, near-black in dark)
  • Every existing text-accent-foreground site is checked for a surface that is not an --accent fill
  • focus-treatment.test.ts has its pinned 3.40:1 assertion and its accompanying "known gap" comment removed, since the gap is closed
  • The DESIGN.md note recording the gap is removed

Related

Activity

  1. mstomar125 commented on Sep 21, 2026

    @mstomar125
    Contributor

    Frontend: 5226 passed (256 test files)

  2. self-assigned this
    on Sep 21, 2026
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