[GH-ISSUE #328] Feature Request: add support for highlighting ANSI text as colored text #84

Closed
opened 2026-03-02 23:44:25 +03:00 by kerem · 5 comments
Owner

Originally created by @remorses on GitHub (Nov 19, 2025).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/328

Currently opencode has no way to show colors for commands outputs because we do not have ANSI highlighting support

My idea for implementing this would be to

  • Parse ANSI into an array of colored segments
  • Convert this array into a list of TextChunk like we do now for tree sitter highlighting

I guess ANSI parsing would need to be fast so implemented in the Zig side

What do you think @kommander?

Originally created by @remorses on GitHub (Nov 19, 2025). Original GitHub issue: https://github.com/anomalyco/opentui/issues/328 Currently opencode has no way to show colors for commands outputs because we do not have ANSI highlighting support My idea for implementing this would be to - Parse ANSI into an array of colored segments - Convert this array into a list of `TextChunk` like we do now for tree sitter highlighting I guess ANSI parsing would need to be fast so implemented in the Zig side What do you think @kommander?
kerem 2026-03-02 23:44:25 +03:00
Author
Owner

@kommander commented on GitHub (Nov 19, 2025):

I think opencode would solve that with something like #166, but probably using libghostty-vt.

<!-- gh-comment-id:3553795455 --> @kommander commented on GitHub (Nov 19, 2025): I think opencode would solve that with something like #166, but probably using [libghostty-vt](https://mitchellh.com/writing/libghostty-is-coming).
Author
Owner

@remorses commented on GitHub (Nov 19, 2025):

I also found this project which would be a good start: https://github.com/coder/ghostty-web

It uses libghostty to render a terminal in the browser

<!-- gh-comment-id:3554220135 --> @remorses commented on GitHub (Nov 19, 2025): I also found this project which would be a good start: https://github.com/coder/ghostty-web It uses libghostty to render a terminal in the browser
Author
Owner

@kommander commented on GitHub (Nov 20, 2025):

Yeah that's basically what #166 does for opentui, but also providing it as a TerminalRenderable. So that but libghostty would be the way to go imo.

<!-- gh-comment-id:3555128702 --> @kommander commented on GitHub (Nov 20, 2025): Yeah that's basically what #166 does for opentui, but also providing it as a TerminalRenderable. So that but libghostty would be the way to go imo.
Author
Owner

@remorses commented on GitHub (Nov 25, 2025):

I found another example https://github.com/kcosr/pty-to-html/blob/main/src/main.zig

I can open a PR to add support for this, but without any stdin handling, just rendering the ansi into styled text without keeping any state

It would depend on some ghostty code. what do you think?

<!-- gh-comment-id:3576537498 --> @remorses commented on GitHub (Nov 25, 2025): I found another example https://github.com/kcosr/pty-to-html/blob/main/src/main.zig I can open a PR to add support for this, but without any stdin handling, just rendering the ansi into styled text without keeping any state It would depend on some ghostty code. what do you think?
Author
Owner

@remorses commented on GitHub (Nov 27, 2025):

I created a package to use ghostty-vt to turn ANSI into opentui renderables here

https://github.com/remorses/opentui-ansi-vt.git

<!-- gh-comment-id:3585077539 --> @remorses commented on GitHub (Nov 27, 2025): I created a package to use ghostty-vt to turn ANSI into opentui renderables here https://github.com/remorses/opentui-ansi-vt.git
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#84
No description provided.