Skip to content

fix(ui): restore dark mode text contrast - #1358

Merged
jakeaturner merged 2 commits into
Crosstalk-Solutions:devfrom
Tiancheng-Xu:fix/dark-mode-contrast
Sep 23, 2026
Merged

jakeaturner merged 2 commits into
Crosstalk-Solutions:devfrom
Tiancheng-Xu:fix/dark-mode-contrast

Conversation

@Tiancheng-Xu

Copy link
Copy Markdown
Contributor

User impact

Night Ops headings, gauge labels, large statistics, and Builder Tag values now remain readable instead of rendering dark text on dark surfaces.

Fixes #1350.

Root cause

The same --color-desert-green token serves both foreground text and green backgrounds. Lightening that shared token would repair headings but reduce contrast for white text on green buttons. Builder Tag controls also paired text-desert-green with an inverted mid-dark background.

Fix

  • Add a foreground-only dark-theme green and apply it to text-desert-green without changing green backgrounds.
  • Use the existing semantic primary text token for the two Builder Tag selects and number.
  • Add regression coverage that calculates WCAG contrast for the affected token pairs and protects button contrast.

Validation

  • node --import ts-node-maintained/register/esm --test tests/unit/dark_mode_contrast.spec.ts
  • npm run typecheck
  • npx eslint tests/unit/dark_mode_contrast.spec.ts
  • npx prettier --check inertia/components/BuilderTagSelector.tsx tests/unit/dark_mode_contrast.spec.ts
  • npm run build
  • Browser fixture against the production CSS bundle confirmed the computed dark-theme colors for headings, all three Builder Tag values, and the unchanged green button.
  • git diff --check

Not run

The full NOMAD application and an axe scan across live settings routes were not run locally; CI and maintainer review remain pending.

Copilot AI lite review requested due to automatic review settings September 21, 2026 23:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The dark-mode override currently only remaps the base text-desert-green class, leaving hover/group-hover variants in the codebase able to drop back to low-contrast dark green (and the tests don’t yet guard against that regression).

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

This PR restores dark-mode (Night Ops) text contrast across settings pages by decoupling the shared desert-green token used for both foreground text and green backgrounds, and by updating Builder Tag control text to use semantic primary text color.

Changes:

  • Add a dark-mode-only foreground accent token (--color-desert-green-foreground) while keeping --color-desert-green unchanged for button/background contrast.
  • Override dark-mode text-desert-green to use the new foreground token.
  • Add a unit test to enforce WCAG contrast for key token pairs and confirm Builder Tag controls use semantic text.
File Description
admin/​tests/​unit/​dark_mode_contrast.spec.ts Adds WCAG contrast regression tests for dark-mode token pairings and Builder Tag control semantics.
admin/​inertia/​css/​app.css Introduces a foreground-only dark-mode green token and remaps text-desert-green in dark mode.
admin/​inertia/​components/​BuilderTagSelector.tsx Switches Builder Tag select/number text from text-desert-green to text-text-primary for contrast in dark mode.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread admin/inertia/css/app.css Resolved
@Tiancheng-Xu

Copy link
Copy Markdown
Contributor Author

@copilot review

@chriscrosstalk chriscrosstalk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly the right decomposition. Lightening the shared token was the obvious trap since it would have cost the white-on-green buttons their contrast, and splitting out a foreground-only accent avoids that cleanly. I checked utility coverage against dev and the base, hover, hover/80, and group-hover variants are all of them, so nothing falls back to the dark green. The regression test guarding both directions (foreground readable, button background unchanged) is a nice touch.

Also verified live: applied this to a v1.35.0-rc.1 box and re-ran the axe scan from #1350. Dark mode went from 29 violations to 4 on /settings/benchmark, 19 to 3 on /settings/system, and 2 to 1 on /home, with no light theme regressions. Everything remaining is pre-existing and out of scope here (a literal text-gray-500 button, the tan buttons, a gauge overlay, plus missing select labels and html lang). Thanks for the quick turnaround on the review feedback too.

@jakeaturner
jakeaturner merged commit c9a1a76 into Crosstalk-Solutions:dev Sep 23, 2026
1 check passed
@cosmistack-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.35.0-rc.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants