moar colors
This commit is contained in:
parent
c0146efaae
commit
f3d3e0ed4f
1 changed files with 10 additions and 4 deletions
|
@ -60,14 +60,20 @@ func NewTerminal(cmd *exec.Cmd) (*Terminal, error) {
|
||||||
|
|
||||||
state := term.vterm.ObtainState()
|
state := term.vterm.ObtainState()
|
||||||
term.colors = make(map[tcell.Color]tcell.Color)
|
term.colors = make(map[tcell.Color]tcell.Color)
|
||||||
for i := 0; i < 16; i += 1 {
|
for i := 0; i < 256; i += 1 {
|
||||||
// Set the first 16 colors to predictable near-black RGB values
|
|
||||||
tcolor := tcell.Color(i)
|
tcolor := tcell.Color(i)
|
||||||
var r uint8 = 0
|
var r uint8 = 0
|
||||||
var g uint8 = 0
|
var g uint8 = 0
|
||||||
var b uint8 = uint8(i + 1)
|
var b uint8 = uint8(i + 1)
|
||||||
|
if i < 16 {
|
||||||
|
// Set the first 16 colors to predictable near-black RGB values
|
||||||
state.SetPaletteColor(i,
|
state.SetPaletteColor(i,
|
||||||
vterm.NewVTermColorRGB(gocolor.RGBA{r, g, b, 255}))
|
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
|
term.colors[tcell.NewRGBColor(int32(r), int32(g), int32(b))] = tcolor
|
||||||
}
|
}
|
||||||
fg, bg := state.GetDefaultColors()
|
fg, bg := state.GetDefaultColors()
|
||||||
|
|
Loading…
Reference in a new issue