Skip to content

fix(tokens): invert the 15 dark status tokens that were never inverted - #43

Merged
thinkclay merged 1 commit into
mainfrom
fix/dark-status-tokens
Oct 2, 2026
Merged

thinkclay merged 1 commit into
mainfrom
fix/dark-status-tokens

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Scaffald/SaaS#951. Also resolves Scaffald/SaaS#952.

What was wrong

15 dark status tokens were byte-identical to their light counterparts — the dark palette was wearing light-mode status colours:

token value ramp
icon.dark.active / .selected #1d7282 primary[500]
border.dark.active / .selected / .focus #1d7282 primary[500]
fg / icon / border .dark.info #2e72a0 info[500]
fg / icon / border .dark.success #3a7d4c success[500]
fg / icon / border .dark.error #b84f3b error[500]
icon.dark.warning #9a6614 —

All 15 fail the 3:1 that WCAG 1.4.11 requires of UI components, at 2.62–2.96 against bg.dark.muted. border.dark.focus at 2.62 is the one with teeth — a focus indicator below 3:1 against its adjacent ground is a 2.4.11 failure, and it is the only way a keyboard user can tell where they are.

The fix was already written down here

Above fg.dark.active:

Was primary[500] #1d7282 on both — only 3.38:1 against bg.dark.default, so active/selected state failed AA in dark mode. The teal ramp has to invert for dark: light steps carry, dark steps disappear into the ground.

Whoever wrote that applied it to the fg group's active/selected/warning and stopped. icon and border never got it, and info/success/error never got it anywhere. This finishes the job.

Each token moves to the step its already-corrected sibling uses, or the 300 step where it has none:

→ worst ratio across bg.dark.default, .subtle, .muted
active / selected / focus primary[300] #3fb5c7 5.98
info info[300] #7cb0d5 6.25
success success[300] #74b480 5.94
error error[300] #e58e80 5.89
icon.warning warning[500] #c28d41 — matches fg.dark.warning 4.97

Measured

All 320 foreground/background pairs scored with the WCAG 2.1 formula, in both themes so a pair that already fails in light is not reported as a dark finding:

before:  17 fail in dark and pass in light
after:    0

The two outside the 15 are inverse text on the success and error fills (3.77:1, needed 4.5). Lightening those fills clears them, which is why SaaS#952 is resolved here too.

No background token is touched. The first theory was that bg.dark.muted was too light; the arithmetic rules it out. The tightest foreground needs a ground luminance of ≤ 0.01303, and bg.dark.subtle is already 0.0102 — "muted" would have to be darker than subtle to help, which inverts the ladder and destroys what muted is for. Even a value visually indistinguishable from subtle only reaches 2.97.

Regression check

Verified rather than assumed: only three places in the app use fg[theme].success/.error as a background — a progress-bar fill, an 8×8 status dot, and one icon that already uses colors.text[theme].quaternary. Nothing puts white text on either fill, so lightening them breaks nothing.

Downstream suites, all against these values (SaaS#944 made the test tokens real rather than a stub): 2147 tests, 0 failures — ui 714, scf-core 1282, app 98, schemas 53.

Visibility

Dark mode is gated off in the app until SaaS#840, so nothing changes for users today. This is what makes it safe to land now and what #840 needs in place before it can verify screens in dark.

Every one of these was byte-identical to its light counterpart, so the dark
palette was wearing light-mode status colours:

  icon.dark.active / .selected            #1d7282  primary[500]
  border.dark.active / .selected / .focus #1d7282  primary[500]
  fg / icon / border .dark.info           #2e72a0  info[500]
  fg / icon / border .dark.success        #3a7d4c  success[500]
  fg / icon / border .dark.error          #b84f3b  error[500]
  icon.dark.warning                       #9a6614

All 15 failed the 3:1 that WCAG 1.4.11 requires of UI components, at 2.62-2.96
against bg.dark.muted. `border.dark.focus` at 2.62 is the one with teeth: a
focus indicator below 3:1 against its adjacent ground is a 2.4.11 failure, and
it is the only way a keyboard user can tell where they are.

The fix was already written down here by whoever did half of it, above
fg.dark.active:

    Was primary[500] #1d7282 on both — only 3.38:1 against bg.dark.default, so
    active/selected state failed AA in dark mode. The teal ramp has to invert
    for dark: light steps carry, dark steps disappear into the ground.

That was applied to the fg group's active/selected/warning and not to icon or
border, nor to info/success/error anywhere. This finishes it. Each token moves
to the step its corrected sibling uses, or the 300 step where it has none:

  active / selected / focus  primary[300] #3fb5c7   worst 5.98
  info                       info[300]    #7cb0d5   worst 6.25
  success                    success[300] #74b480   worst 5.94
  error                      error[300]   #e58e80   worst 5.89
  icon.warning               warning[500] #c28d41   worst 4.97   (= fg.dark.warning)

"Worst" is across bg.dark.default, .subtle and .muted.

Scoring all 320 foreground/background pairs with the WCAG 2.1 formula, in both
themes so light failures are not miscounted as dark ones: 17 dark-only failures
before, 0 after. The two that were not in the 15 are inverse text on the success
and error fills, which clear 4.5:1 once those fills are lightened.

No background token is touched. The first theory was that bg.dark.muted was too
light, which the arithmetic rules out: the tightest foreground needs a ground
luminance of 0.01303, and bg.dark.subtle is already 0.0102, so "muted" would
have to be darker than subtle to help.

Checked for regression rather than assumed: only three places in the app use
fg[theme].success/error as a background — a progress fill, an 8x8 status dot,
and one icon that already uses text[theme].quaternary. Nothing puts white text
on either fill.

Scaffald/SaaS#951, and resolves Scaffald/SaaS#952.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay
thinkclay merged commit b52c120 into main Oct 2, 2026
@thinkclay
thinkclay deleted the fix/dark-status-tokens branch October 2, 2026 19:41
thinkclay added a commit to Scaffald/SaaS that referenced this pull request Oct 2, 2026
)

Closes #951. Closes #952.

Scaffald/ui#43 — 2f094f7ac..b52c1205a.

15 dark status tokens were byte-identical to their light counterparts, so the
dark palette was wearing light-mode status colours: icon.dark.active/.selected
and border.dark.active/.selected/.focus were all still primary[500] #1d7282,
and info/success/error were the light values across fg, icon and border. Every
one failed the 3:1 WCAG 1.4.11 requires of UI components, at 2.62-2.96 against
bg.dark.muted.

Scoring all 320 foreground/background pairs in both themes: 17 dark-only
failures before, 0 after. #952's two are among them — lightening the success
and error fills clears dark inverse text on those fills as a side effect.

Note for #840: the first theory, filed on #951, was that bg.dark.muted was too
light. That is wrong and the issue carries the correction. The tightest
foreground needs a ground luminance of 0.01303 and bg.dark.subtle is already
0.0102, so no "muted" value can fix it without being darker than subtle. No
background token changed.

Verified on the bumped pointer: 2147 tests, 0 failures (scf-core 1282, ui 714,
app 98, schemas 53), both submodule builds clean.

Co-authored-by: Claude Opus 5 <[email protected]>
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.

Inverse text on the dark success and error fills reaches only 3.77:1

1 participant