Skip to content

fix: handle ANSI color indexes in theme resolution - #4842

Merged
rekram1-node merged 2 commits into
anomalyco:devfrom
dl-alexandre:fix/theme-ansi-crash
Dec 2, 2025
Merged

rekram1-node merged 2 commits into
anomalyco:devfrom
dl-alexandre:fix/theme-ansi-crash

Conversation

@dl-alexandre

Copy link
Copy Markdown
Contributor

Fixes #4429.

Issue

The theme engine was crashing when encountering numeric color values (ANSI color indexes) in theme definitions. It expected strings (hex codes or reference names) or RGBA objects, but not numbers.

Fix

This PR adds native support for ANSI color indexes (0-255) in the resolveColor function.
It implements a new helper ansiToRgba that converts these indexes to their corresponding RGBA values:

  • 0-15: Standard ANSI colors.
  • 16-231: 6x6x6 Color Cube.
  • 232-255: Grayscale Ramp.

This ensures that themes using ANSI color codes work correctly instead of crashing the application.

@rekram1-node
rekram1-node merged commit 702fb25 into anomalyco:dev Dec 2, 2025
3 checks passed
@graelo

graelo commented Dec 2, 2025

Copy link
Copy Markdown

Thanks!

Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request Jun 14, 2026
meSingh pushed a commit to meSingh/opencode that referenced this pull request Sep 6, 2026
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.

Crash when using theme with ANSI color indexes (terminal palette numbers)

3 participants