Skip to content

Regression: fenced code blocks render with white text on light backgrounds (v1.2.24) #16978

@KimDaehyeon6873

Description

@KimDaehyeon6873

Summary

Fenced code blocks render with white/near-white foreground text on light terminal backgrounds, making them invisible. This is a regression of previously fixed issues #16508 and #16731.

Environment

  • OpenCode version: 1.2.24
  • OS: macOS (darwin, arm64)
  • Terminal: iTerm2 3.6.9
  • Terminal theme: Poimandres Light (light background #fefeff)
  • OpenCode theme: opencode (with theme_mode: "light")
  • COLORTERM: truecolor
  • TERM: xterm-256color

Reproduction

  1. Use a terminal with a light background color scheme
  2. Run OpenCode with any theme in light mode (tested: opencode, system, catppuccin, and others — all exhibit the issue)
  3. Ask the AI to provide a response containing fenced code blocks (untagged, text tag, or unknown language), flow diagrams, or commit lists
  4. Observe: fenced code block text is white/near-white, invisible against the light background

What is visible

  • Inline code (single backticks)
  • Known language-tagged code blocks (e.g., python)
  • Headings, bold text, other markdown elements
  • Dark mode rendering (all text visible)

What is invisible

  • Untagged fenced code blocks
  • Fenced code blocks with text or unknown language tags
  • ASCII diagrams, commit lists, and other preformatted content inside fenced blocks

Workaround

Disabling the experimental markdown renderer resolves the issue:

export OPENCODE_EXPERIMENTAL_MARKDOWN=0

Root cause (from #16508 analysis)

The experimental markdown renderer's code block rendering path falls back to a hardcoded white foreground when syntax highlighting is unavailable for the block, instead of inheriting from the active theme's text/code-block color tokens.

This was previously fixed for #16508 and #16731 (reported on v1.2.20–1.2.21), but has regressed in v1.2.24.

Related issues

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions