mirror of
https://github.com/walles/moar.git
synced 2024-11-29 17:23:37 +03:00
Support SGR codes 90-97, bright colors
We just treat them as their plain counterparts. After testing vs less and cat on iTerm2 3.3.9 / macOS Catalina 10.15.4 that's how they seem to handle this. Counter examples welcome. Fixes #24
This commit is contained in:
parent
46881e4519
commit
a9ee2fae9d
@ -352,6 +352,32 @@ func _UpdateStyle(style tcell.Style, escapeSequence string) tcell.Style {
|
|||||||
case "49":
|
case "49":
|
||||||
style = style.Background(tcell.ColorDefault)
|
style = style.Background(tcell.ColorDefault)
|
||||||
|
|
||||||
|
// Bright foreground colors. Treat them as their plain counterparts.
|
||||||
|
//
|
||||||
|
// After testing vs less and cat on iTerm2 3.3.9 / macOS Catalina
|
||||||
|
// 10.15.4 that's how they seem to handle this.
|
||||||
|
//
|
||||||
|
// Counter examples welcome.
|
||||||
|
//
|
||||||
|
// Wikipedia indicates we should maybe use bold as well for these:
|
||||||
|
// https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit
|
||||||
|
case "90":
|
||||||
|
style = style.Foreground(0)
|
||||||
|
case "91":
|
||||||
|
style = style.Foreground(1)
|
||||||
|
case "92":
|
||||||
|
style = style.Foreground(2)
|
||||||
|
case "93":
|
||||||
|
style = style.Foreground(3)
|
||||||
|
case "94":
|
||||||
|
style = style.Foreground(4)
|
||||||
|
case "95":
|
||||||
|
style = style.Foreground(5)
|
||||||
|
case "96":
|
||||||
|
style = style.Foreground(6)
|
||||||
|
case "97":
|
||||||
|
style = style.Foreground(7)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log.Warnf("Unrecognized ANSI SGR code <%s>", number)
|
log.Warnf("Unrecognized ANSI SGR code <%s>", number)
|
||||||
}
|
}
|
||||||
|
17
sample-files/normal-and-bright-colors.txt
Normal file
17
sample-files/normal-and-bright-colors.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[30mBlack[m
|
||||||
|
[31mRed[m
|
||||||
|
[32mGreen[m
|
||||||
|
[33mYellow[m
|
||||||
|
[34mBlue[m
|
||||||
|
[35mMagenta[m
|
||||||
|
[36mCyan[m
|
||||||
|
[37mWhite[m
|
||||||
|
|
||||||
|
[90mBright Black[m
|
||||||
|
[91mBright Red[m
|
||||||
|
[92mBright Green[m
|
||||||
|
[93mBright Yellow[m
|
||||||
|
[94mBright Blue[m
|
||||||
|
[95mBright Magenta[m
|
||||||
|
[96mBright Cyan[m
|
||||||
|
[97mBright White[m
|
Loading…
Reference in New Issue
Block a user