diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-03-17 18:06:15 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-17 18:06:15 -0400 |
commit | f3d3e0ed4f5dbf36b7a7c9762e6297083843f127 (patch) | |
tree | 69f2e6fa9949cd203650ca86fc8accdfaf67ddeb /widgets/terminal.go | |
parent | c0146efaaee1f777f8eea8ad6c9e4477e346103b (diff) | |
download | aerc-f3d3e0ed4f5dbf36b7a7c9762e6297083843f127.tar.gz |
moar colors
Diffstat (limited to 'widgets/terminal.go')
-rw-r--r-- | widgets/terminal.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/widgets/terminal.go b/widgets/terminal.go index 9849b730..07b0f450 100644 --- a/widgets/terminal.go +++ b/widgets/terminal.go @@ -60,14 +60,20 @@ func NewTerminal(cmd *exec.Cmd) (*Terminal, error) { state := term.vterm.ObtainState() term.colors = make(map[tcell.Color]tcell.Color) - for i := 0; i < 16; i += 1 { - // Set the first 16 colors to predictable near-black RGB values + for i := 0; i < 256; i += 1 { tcolor := tcell.Color(i) var r uint8 = 0 var g uint8 = 0 var b uint8 = uint8(i + 1) - state.SetPaletteColor(i, - vterm.NewVTermColorRGB(gocolor.RGBA{r, g, b, 255})) + if i < 16 { + // Set the first 16 colors to predictable near-black RGB values + state.SetPaletteColor(i, + vterm.NewVTermColorRGB(gocolor.RGBA{r, g, b, 255})) + } else { + // The rest use RGB + vcolor := state.GetPaletteColor(i) + r, g, b = vcolor.GetRGB() + } term.colors[tcell.NewRGBColor(int32(r), int32(g), int32(b))] = tcolor } fg, bg := state.GetDefaultColors() |