mirror of https://github.com/gdamore/tcell.git
fixes #564 Excessive Ram usage for colors in direct / Tc mode
This commit is contained in:
parent
178ac4393a
commit
7557ac2a6c
10
tscreen.go
10
tscreen.go
|
@ -199,9 +199,13 @@ func (t *tScreen) Init() error {
|
||||||
if os.Getenv("TCELL_TRUECOLOR") == "disable" {
|
if os.Getenv("TCELL_TRUECOLOR") == "disable" {
|
||||||
t.truecolor = false
|
t.truecolor = false
|
||||||
}
|
}
|
||||||
t.colors = make(map[Color]Color)
|
nColors := t.nColors()
|
||||||
t.palette = make([]Color, t.nColors())
|
if nColors > 256 {
|
||||||
for i := 0; i < t.nColors(); i++ {
|
nColors = 256 // clip to reasonable limits
|
||||||
|
}
|
||||||
|
t.colors = make(map[Color]Color, nColors)
|
||||||
|
t.palette = make([]Color, nColors)
|
||||||
|
for i := 0; i < nColors; i++ {
|
||||||
t.palette[i] = Color(i) | ColorValid
|
t.palette[i] = Color(i) | ColorValid
|
||||||
// identity map for our builtin colors
|
// identity map for our builtin colors
|
||||||
t.colors[Color(i)|ColorValid] = Color(i) | ColorValid
|
t.colors[Color(i)|ColorValid] = Color(i) | ColorValid
|
||||||
|
|
Loading…
Reference in New Issue