[#1223] lens/tui: Fix color formatting
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
1515d8b7b4
commit
e3490cf0e1
2 changed files with 7 additions and 5 deletions
|
@ -32,7 +32,7 @@ func NewHexColor(hexColor string) tcell.Color {
|
|||
}
|
||||
|
||||
type FormatOptions struct {
|
||||
Foreground tcell.Color
|
||||
Color tcell.Color
|
||||
|
||||
Bold,
|
||||
Italic,
|
||||
|
@ -67,10 +67,10 @@ func Format(s string, opts FormatOptions) string {
|
|||
strikeThroughTag,
|
||||
)
|
||||
|
||||
color := strconv.FormatInt(int64(opts.Foreground.Hex()), 16)
|
||||
color := strconv.FormatInt(int64(opts.Color.Hex()), 16)
|
||||
|
||||
return fmt.Sprintf(
|
||||
"[#%06s::%s]%s[white::-]",
|
||||
"[#%06s::%s]%s[-::-]",
|
||||
color,
|
||||
attributes,
|
||||
s,
|
||||
|
@ -78,5 +78,5 @@ func Format(s string, opts FormatOptions) string {
|
|||
}
|
||||
|
||||
func FormatSimple(s string, c tcell.Color) string {
|
||||
return Format(s, FormatOptions{Foreground: c})
|
||||
return Format(s, FormatOptions{Color: c})
|
||||
}
|
||||
|
|
|
@ -153,8 +153,10 @@ func (v *RecordsView) Draw(screen tcell.Screen) {
|
|||
text := result.String()
|
||||
if index == v.selectedRecordIndex {
|
||||
text = fmt.Sprintf("[:white]%s[:black]", text)
|
||||
tview.Print(screen, text, x, y, width, tview.AlignLeft, tview.Styles.PrimitiveBackgroundColor)
|
||||
} else {
|
||||
tview.Print(screen, text, x, y, width, tview.AlignLeft, tview.Styles.PrimaryTextColor)
|
||||
}
|
||||
tview.Print(screen, text, x, y, width, tview.AlignLeft, tview.Styles.PrimaryTextColor)
|
||||
|
||||
y++
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue