mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #542] ANSIWriter background converting from chroma #395
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#395
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @neezer on GitHub (Dec 31, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/542
I'm rendering JSON in a TextView with syntax highlighting provided by chroma passed through an ANSIWriter, roughly like so:
The TextView puts a background behind my text, which I'm not expecting:
If I use the same
quick.Highlightcommand but change the writer toos.Stdout, then I don't see a different-color background:I have not called
.SetBackgroundon my TextView—I tried it and it completely wrecked the performance and functionality of my app... text got all garbled and rendered really slow.I suspect there's something getting messed up in the ANSIWriter translation, but I've no clue what. I tried creating my own custom Chroma theme that explicitly disables background color (eg.
chroma.Background: "bg:0") but I got the same behavior in mytview.TextBox.Any idea what I might be doing wrong or how I could eliminate the discrepancy in background color?
@rivo commented on GitHub (Jan 11, 2021):
It's hard to say without being able to reproduce this easily. It looks to me like your tool is generating a background colour that is different from
tview's default background colour (which istcell.ColorBlackand I don't really know what Escape codes are generated for this colour).Maybe it helps if you try with a minimal JSON file and post the output of
tview.TranslateANSI()here. It could give us some clues.@rivo commented on GitHub (Mar 13, 2021):
@neezer The most recent update to
tviewintroduces some fixes to its colour handling. (Actually, I had to work around a change that was introduced intcell.) Could you please try your code again with the latest version and let me know if the problem persists?@rivo commented on GitHub (Apr 27, 2021):
You can reopen if there's anything else that needs to be reviewed.