Skip to content

fix(tui): use markdownCodeBlock color for fenced code blocks#16131

Open
zerone0x wants to merge 1 commit intoanomalyco:devfrom
zerone0x:fix/theme-code-block-color-16121
Open

fix(tui): use markdownCodeBlock color for fenced code blocks#16131
zerone0x wants to merge 1 commit intoanomalyco:devfrom
zerone0x:fix/theme-code-block-color-16121

Conversation

@zerone0x
Copy link
Contributor

@zerone0x zerone0x commented Mar 5, 2026

Issue for this PR

Closes #16121

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fenced code blocks without a language specifier (e.g., ``` instead of ```javascript) were using theme.markdownCode (the inline code color) instead of theme.markdownCodeBlock. On light terminal backgrounds with custom themes, markdownCode is typically a bright accent color (green, pink, etc.) that becomes invisible or barely visible against light backgrounds.

The theme type system already defines a separate markdownCodeBlock property for this exact purpose, and every built-in theme sets it to a readable foreground/text color. However, the syntax highlighting scope rules grouped markup.raw and markup.raw.block together, applying the inline code color to both.

The fix: Split the scope rules so that:

  • markup.raw.block → uses theme.markdownCodeBlock (readable text color)
  • markup.raw / markup.raw.inline → uses theme.markdownCode (accent color, with background)

This is a 3-line change in the getSyntaxRules function in theme.tsx.

How did you verify your code works?

  • Verified that the markdownCodeBlock property exists in the ThemeColors type (line 89) with type RGBA
  • Confirmed all built-in theme JSON files define markdownCodeBlock as a readable foreground color
  • Confirmed the default fallback (line 521) maps markdownCodeBlock to fg (foreground)
  • The change is type-safe: both markdownCode and markdownCodeBlock are typed as RGBA

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code

…language

Code blocks without a language specifier (``` without language tag) were
using theme.markdownCode (inline code color) instead of
theme.markdownCodeBlock. On light terminal backgrounds with custom themes,
markdownCode is typically a bright accent color (e.g., green, pink) that
becomes invisible against light backgrounds. markdownCodeBlock is designed
for this purpose and defaults to the foreground text color.

Fixes anomalyco#16121

Co-Authored-By: Claude <noreply@anthropic.com>
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.

Custom theme text barely visible on light terminal

1 participant