[GH-ISSUE #317] TranslateANSI returns invalid background #241

Closed
opened 2026-03-04 01:03:16 +03:00 by kerem · 1 comment
Owner

Originally created by @serge-v on GitHub (Jun 28, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/317

Test returns [#00ccff:darkmagenta:l]color but it should be only fg color in the result.

func TestTranslate(t *testing.T) {
	color := "\x1b[38;5;45m"
	off := "\x1b[0m"
	s := color + "TEST" + off
	res := TranslateANSI(s)
	if res != "[#00ccff::]TEST[-:-:-]" {
		t.Fatal("ansi:", s, "returned:", res)
	}
	t.Log(s, res)
}
Originally created by @serge-v on GitHub (Jun 28, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/317 Test returns `[#00ccff:darkmagenta:l]`color but it should be only fg color in the result. ```go func TestTranslate(t *testing.T) { color := "\x1b[38;5;45m" off := "\x1b[0m" s := color + "TEST" + off res := TranslateANSI(s) if res != "[#00ccff::]TEST[-:-:-]" { t.Fatal("ansi:", s, "returned:", res) } t.Log(s, res) } ```
kerem closed this issue 2026-03-04 01:03:16 +03:00
Author
Owner

@rivo commented on GitHub (Jul 11, 2019):

Thanks! Should be fixed now.

<!-- gh-comment-id:510432814 --> @rivo commented on GitHub (Jul 11, 2019): Thanks! Should be fixed now.
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/tview#241
No description provided.