Fix --color=bw on tcell build
This commit is contained in:
parent
3dfc020fac
commit
f87d382ec8
@ -140,6 +140,8 @@ func Init(theme *ColorTheme, black bool, mouse bool) {
|
|||||||
_color = theme != nil
|
_color = theme != nil
|
||||||
if _color {
|
if _color {
|
||||||
InitTheme(theme, black)
|
InitTheme(theme, black)
|
||||||
|
} else {
|
||||||
|
theme = DefaultTheme()
|
||||||
}
|
}
|
||||||
ColNormal = ColorPair{theme.Fg, theme.Bg}
|
ColNormal = ColorPair{theme.Fg, theme.Bg}
|
||||||
ColPrompt = ColorPair{theme.Prompt, theme.Bg}
|
ColPrompt = ColorPair{theme.Prompt, theme.Bg}
|
||||||
@ -439,13 +441,20 @@ func (w *Window) PrintString(text string, pair ColorPair, a Attr) {
|
|||||||
t := text
|
t := text
|
||||||
lx := 0
|
lx := 0
|
||||||
|
|
||||||
// TODO respect attr
|
var style tcell.Style
|
||||||
style := pair.style().
|
if _color {
|
||||||
Blink(a&Attr(tcell.AttrBlink) != 0).
|
style = pair.style().
|
||||||
Bold(a&Attr(tcell.AttrBold) != 0).
|
|
||||||
Dim(a&Attr(tcell.AttrDim) != 0).
|
|
||||||
Reverse(a&Attr(tcell.AttrReverse) != 0).
|
Reverse(a&Attr(tcell.AttrReverse) != 0).
|
||||||
Underline(a&Attr(tcell.AttrUnderline) != 0)
|
Underline(a&Attr(tcell.AttrUnderline) != 0)
|
||||||
|
} else {
|
||||||
|
style = ColDefault.style().
|
||||||
|
Reverse(a&Attr(tcell.AttrReverse) != 0 || pair == ColCurrent || pair == ColCurrentMatch).
|
||||||
|
Underline(a&Attr(tcell.AttrUnderline) != 0 || pair == ColMatch || pair == ColCurrentMatch)
|
||||||
|
}
|
||||||
|
style = style.
|
||||||
|
Blink(a&Attr(tcell.AttrBlink) != 0).
|
||||||
|
Bold(a&Attr(tcell.AttrBold) != 0).
|
||||||
|
Dim(a&Attr(tcell.AttrDim) != 0)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if len(t) == 0 {
|
if len(t) == 0 {
|
||||||
@ -485,8 +494,13 @@ func (w *Window) CPrint(pair ColorPair, a Attr, text string) {
|
|||||||
func (w *Window) FillString(text string, pair ColorPair, a Attr) bool {
|
func (w *Window) FillString(text string, pair ColorPair, a Attr) bool {
|
||||||
lx := 0
|
lx := 0
|
||||||
|
|
||||||
//TODO: respect attr
|
var style tcell.Style
|
||||||
style := pair.style().
|
if _color {
|
||||||
|
style = pair.style()
|
||||||
|
} else {
|
||||||
|
style = ColDefault.style()
|
||||||
|
}
|
||||||
|
style = style.
|
||||||
Blink(a&Attr(tcell.AttrBlink) != 0).
|
Blink(a&Attr(tcell.AttrBlink) != 0).
|
||||||
Bold(a&Attr(tcell.AttrBold) != 0).
|
Bold(a&Attr(tcell.AttrBold) != 0).
|
||||||
Dim(a&Attr(tcell.AttrDim) != 0).
|
Dim(a&Attr(tcell.AttrDim) != 0).
|
||||||
@ -537,7 +551,12 @@ func (w *Window) DrawBorder() {
|
|||||||
top := w.Top
|
top := w.Top
|
||||||
bot := top + w.Height
|
bot := top + w.Height
|
||||||
|
|
||||||
style := ColBorder.style()
|
var style tcell.Style
|
||||||
|
if _color {
|
||||||
|
style = ColBorder.style()
|
||||||
|
} else {
|
||||||
|
style = ColDefault.style()
|
||||||
|
}
|
||||||
|
|
||||||
for x := left; x < right; x++ {
|
for x := left; x < right; x++ {
|
||||||
_screen.SetContent(x, top, tcell.RuneHLine, nil, style)
|
_screen.SetContent(x, top, tcell.RuneHLine, nil, style)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user