Handle ansi code 39 and 49

39 is apparently the "default foreground color"
49 is apparently the "default background color"
This commit is contained in:
Sean Smith 2019-09-13 20:12:34 -04:00 committed by Trevor Slocum
parent 6e548abb6b
commit 9aa08ad7c7
1 changed files with 4 additions and 0 deletions

View File

@ -145,9 +145,13 @@ func (a *ansi) Write(text []byte) (int, error) {
case "30", "31", "32", "33", "34", "35", "36", "37":
colorNumber, _ := strconv.Atoi(field)
foreground = lookupColor(colorNumber-30, false)
case "39":
foreground = "default"
case "40", "41", "42", "43", "44", "45", "46", "47":
colorNumber, _ := strconv.Atoi(field)
background = lookupColor(colorNumber-40, false)
case "49":
background = "default"
case "90", "91", "92", "93", "94", "95", "96", "97":
colorNumber, _ := strconv.Atoi(field)
foreground = lookupColor(colorNumber-90, true)