Skip to content

fix(tui): improve body text contrast against Solarized background - #213

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/tui-solarized-body-text-contrast
Aug 3, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/tui-solarized-body-text-contrast

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Audit findings

1. Actual Solarized Dark hex values in use (crates/forge-tui/themes/solarized-dark.toml) — this is the canonical Ethan Schoonover palette, not a customized variant:

  • background = #002B36 (base03)
  • text_primary = #839496 (base0) — already correct; this is theme::text() / theme::text_primary_color(), used for primary body text app-wide.
  • text_secondary = #657B83 (base00), text_muted = #586E75 (base01) — these back theme::muted() / theme::dim(), correctly reserved for de-emphasized metadata (unaffected by this change).
  • accent = #268BD2 (Solarized blue), info = #2AA198 (Solarized cyan) — the interactive/status hues, used by theme::accent()/theme::brand() (links, active tab, tool tags) and theme::info()/theme::tool().
  • tag = #93A1A1 — already exactly Solarized base1, currently only used for the tag badge role.

So the default body text color (theme::text()) was already base0, not blue/cyan — contrary to the generic Solarized-Dark-low-contrast concern, this app's config already applies the higher-contrast tone by default. The actual problem was narrower: one call site reusing the interactive cyan color for body content.

2. Call sites where body text shared color with interactive elements — audited every non-test usage of theme::info() / theme::tool() / theme::accent() / theme::brand() in forge-tui/src:

  • conversation.rs:2076 — inline `backtick code` inside assistant/user message prose was styled with theme::tool() (cyan, same value as theme::info() — tool is literally sourced from the info palette field). This is genuine body text (part of the sentence being read), not a link — fixed.
  • Everything else checked out as legitimately interactive or semantically status-colored, not body text: file_source()/file_data() (clickable file-tree entries, info/tool), directory() (brand(), clickable), banner/status labels ("running", "waiting for approval", BannerKind::Info callouts — parallel to Warn/Error/Ok, not paragraph prose), dialog/heading titles in overlays.rs and source_viewer.rs (brand(), headers not body text, explicitly out of scope).

3–4. Fix — added theme::text_secondary_color() / theme::text_secondary() to the theme module, sourced from the existing tag palette field (already base1 #93A1A1 for Solarized Dark) rather than a new hardcoded hex or a new required theme-file field (all ThemePalette fields are required with no serde defaults, so adding one would break any custom user theme TOML). text_primary_color() already existed and needed no change. Changed the one flagged call site to theme::text_secondary(). Interactive elements (accent(), info()/tool(), brand()) are untouched and remain visually distinct.

5. Contrast ratio (WCAG relative-luminance formula, against background base03 #002B36):

  • text_secondary (base1, #93A1A1) vs base03 ≈ 5.6:1 — passes AA (≥4.5:1) with margin.
  • text_primary (base0, #839496) vs base03 ≈ 4.75:1 — passes AA, confirmed by a new test (previously untested).

Test plan

  • cargo fmt --all -- --check
  • cargo test --package forge-tui --lib (716 passed), including new tests: text_secondary_is_solarized_base1_and_distinct_from_interactive_colors, body_text_colors_meet_wcag_aa_against_the_background, inline_code_in_body_text_uses_secondary_body_color_not_interactive_accent.
  • git diff --check

@github-actions
github-actions Bot enabled auto-merge (squash) August 3, 2026 14:28
@github-actions
github-actions Bot merged commit c3cb86a into main Aug 3, 2026
7 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