Skip to content

Fix Forge Dark/Light theme colors that don't meet WCAG AA contrast - #107

Merged
github-actions[bot] merged 1 commit into
mainfrom
theme-application-wide-colors
Aug 1, 2026
Merged

Fix Forge Dark/Light theme colors that don't meet WCAG AA contrast#107
github-actions[bot] merged 1 commit into
mainfrom
theme-application-wide-colors

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

  • ACCENT, OK, WARN, DANGER, ACCENT_2 (status), and TOOL were the same RGB constant shared between Theme::Dark and Theme::Light — Light theme was painting dark-theme-tuned bright colors onto a near-white background, with measured contrast ratios as low as 1.37:1 (WCAG AA requires ≥4.5:1).
  • Split every shared role into real LIGHT_* counterparts, recomputed against the actual backgrounds used in code (canvas, panel, panel_alt, selection), not just eyeballed.
  • Added new tag and selection_fg roles + a theme::tag_style(selected) helper, and wired it into the Connect & Model picker / theme picker so the "current"/"connected" label gets its own distinct, contrast-checked color instead of inheriting whatever style the row happened to have.
  • Retuned the highlighted-row background/foreground pair to a cyan/teal-tinted highlight distinguishable from plain selection.
  • Removed the now-dead text_strong/TEXT_STRONG field (its only caller switched to the new selection_fg).

No component was found bypassing the central theme.rs palette with hardcoded colors — the underlying bug was the palette itself not being theme-aware for several roles.

Test plan

  • cargo build --workspace
  • cargo clippy --workspace --all-targets (clean)
  • cargo fmt --check (clean)
  • cargo test -p forge-tui — 661 passed, including new theme::tests::{dark,light}_text_roles_meet_wcag_aa which compute real WCAG contrast ratios in Rust against every background each role is actually rendered on, so a future palette edit can't silently regress this.

accent, success, error, status, and tool tokens were literally the same
RGB constant shared between Theme::Dark and Theme::Light, so Light theme
was painting dark-theme-tuned bright colors onto a near-white background
(contrast ratios as low as 1.37:1). Split each into a real LIGHT_*
counterpart, recomputed against the actual backgrounds used in code
(canvas/panel/panel_alt/selection), and added a tag/selection_fg role so
the "current"/"connected" picker label gets its own color instead of
inheriting whatever style the row happened to have.

Adds theme::tests::{dark,light}_text_roles_meet_wcag_aa, which compute
real WCAG contrast ratios in Rust so a future palette edit can't
silently regress this again.
@github-actions
github-actions Bot enabled auto-merge (squash) August 1, 2026 08:02
@github-actions
github-actions Bot merged commit 661e6cb into main Aug 1, 2026
6 checks passed
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.

1 participant