Fix Forge Dark/Light theme colors that don't meet WCAG AA contrast - #107
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ACCENT,OK,WARN,DANGER,ACCENT_2(status), andTOOLwere the same RGB constant shared betweenTheme::DarkandTheme::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).LIGHT_*counterparts, recomputed against the actual backgrounds used in code (canvas,panel,panel_alt,selection), not just eyeballed.tagandselection_fgroles + atheme::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.text_strong/TEXT_STRONGfield (its only caller switched to the newselection_fg).No component was found bypassing the central
theme.rspalette with hardcoded colors — the underlying bug was the palette itself not being theme-aware for several roles.Test plan
cargo build --workspacecargo clippy --workspace --all-targets(clean)cargo fmt --check(clean)cargo test -p forge-tui— 661 passed, including newtheme::tests::{dark,light}_text_roles_meet_wcag_aawhich 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.