Add 'gap-line' color for the horizontal line on each gap

Color inheritance: border >> list-border >> gap-line
This commit is contained in:
Junegunn Choi 2025-01-18 13:47:25 +09:00
parent 0a10d14e19
commit c1875af70b
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
4 changed files with 13 additions and 1 deletions

View File

@ -228,6 +228,7 @@ color mappings.
\fBlist\-border \fRBorder around the list section (\fB\-\-list\-border\fR) \fBlist\-border \fRBorder around the list section (\fB\-\-list\-border\fR)
\fBscrollbar \fRScrollbar \fBscrollbar \fRScrollbar
\fBseparator \fRHorizontal separator on info line \fBseparator \fRHorizontal separator on info line
\fBgap\-line \fRHorizontal line on each gap
\fBpreview\-border \fRBorder around the preview window (\fB\-\-preview\fR) \fBpreview\-border \fRBorder around the preview window (\fB\-\-preview\fR)
\fBpreview\-scrollbar \fRScrollbar \fBpreview\-scrollbar \fRScrollbar
\fBinput\-border \fRBorder around the input window (\fB\-\-input\-border\fR) \fBinput\-border \fRBorder around the input window (\fB\-\-input\-border\fR)

View File

@ -1262,6 +1262,8 @@ func parseTheme(defaultTheme *tui.ColorTheme, str string) (*tui.ColorTheme, erro
mergeAttr(&theme.Header) mergeAttr(&theme.Header)
case "header-bg": case "header-bg":
mergeAttr(&theme.HeaderBg) mergeAttr(&theme.HeaderBg)
case "gap-line":
mergeAttr(&theme.GapLine)
default: default:
fail() fail()
} }

View File

@ -957,7 +957,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
// Gap line // Gap line
if t.gap > 0 && len(*opts.GapLine) > 0 { if t.gap > 0 && len(*opts.GapLine) > 0 {
t.gapLine, t.gapLineLen = t.ansiLabelPrinter(*opts.GapLine, &tui.ColListBorder, true) t.gapLine, t.gapLineLen = t.ansiLabelPrinter(*opts.GapLine, &tui.ColGapLine, true)
} }
if opts.Ellipsis != nil { if opts.Ellipsis != nil {

View File

@ -341,6 +341,7 @@ type ColorTheme struct {
BorderLabel ColorAttr BorderLabel ColorAttr
ListLabel ColorAttr ListLabel ColorAttr
ListBorder ColorAttr ListBorder ColorAttr
GapLine ColorAttr
} }
type Event struct { type Event struct {
@ -655,6 +656,7 @@ var (
ColHeaderLabel ColorPair ColHeaderLabel ColorPair
ColSeparator ColorPair ColSeparator ColorPair
ColScrollbar ColorPair ColScrollbar ColorPair
ColGapLine ColorPair
ColBorder ColorPair ColBorder ColorPair
ColPreview ColorPair ColPreview ColorPair
ColPreviewBorder ColorPair ColPreviewBorder ColorPair
@ -708,6 +710,7 @@ func EmptyTheme() *ColorTheme {
HeaderBg: ColorAttr{colUndefined, AttrUndefined}, HeaderBg: ColorAttr{colUndefined, AttrUndefined},
HeaderBorder: ColorAttr{colUndefined, AttrUndefined}, HeaderBorder: ColorAttr{colUndefined, AttrUndefined},
HeaderLabel: ColorAttr{colUndefined, AttrUndefined}, HeaderLabel: ColorAttr{colUndefined, AttrUndefined},
GapLine: ColorAttr{colUndefined, AttrUndefined},
Nth: ColorAttr{colUndefined, AttrUndefined}, Nth: ColorAttr{colUndefined, AttrUndefined},
} }
} }
@ -752,6 +755,7 @@ func NoColorTheme() *ColorTheme {
HeaderBg: ColorAttr{colDefault, AttrUndefined}, HeaderBg: ColorAttr{colDefault, AttrUndefined},
HeaderBorder: ColorAttr{colDefault, AttrUndefined}, HeaderBorder: ColorAttr{colDefault, AttrUndefined},
HeaderLabel: ColorAttr{colDefault, AttrUndefined}, HeaderLabel: ColorAttr{colDefault, AttrUndefined},
GapLine: ColorAttr{colDefault, AttrUndefined},
Nth: ColorAttr{colUndefined, AttrUndefined}, Nth: ColorAttr{colUndefined, AttrUndefined},
} }
} }
@ -793,6 +797,7 @@ func init() {
InputBg: ColorAttr{colUndefined, AttrUndefined}, InputBg: ColorAttr{colUndefined, AttrUndefined},
InputBorder: ColorAttr{colUndefined, AttrUndefined}, InputBorder: ColorAttr{colUndefined, AttrUndefined},
InputLabel: ColorAttr{colUndefined, AttrUndefined}, InputLabel: ColorAttr{colUndefined, AttrUndefined},
GapLine: ColorAttr{colUndefined, AttrUndefined},
Nth: ColorAttr{colUndefined, AttrUndefined}, Nth: ColorAttr{colUndefined, AttrUndefined},
} }
Dark256 = &ColorTheme{ Dark256 = &ColorTheme{
@ -831,6 +836,7 @@ func init() {
InputBg: ColorAttr{colUndefined, AttrUndefined}, InputBg: ColorAttr{colUndefined, AttrUndefined},
InputBorder: ColorAttr{colUndefined, AttrUndefined}, InputBorder: ColorAttr{colUndefined, AttrUndefined},
InputLabel: ColorAttr{colUndefined, AttrUndefined}, InputLabel: ColorAttr{colUndefined, AttrUndefined},
GapLine: ColorAttr{colUndefined, AttrUndefined},
Nth: ColorAttr{colUndefined, AttrUndefined}, Nth: ColorAttr{colUndefined, AttrUndefined},
} }
Light256 = &ColorTheme{ Light256 = &ColorTheme{
@ -872,6 +878,7 @@ func init() {
HeaderBg: ColorAttr{colUndefined, AttrUndefined}, HeaderBg: ColorAttr{colUndefined, AttrUndefined},
HeaderBorder: ColorAttr{colUndefined, AttrUndefined}, HeaderBorder: ColorAttr{colUndefined, AttrUndefined},
HeaderLabel: ColorAttr{colUndefined, AttrUndefined}, HeaderLabel: ColorAttr{colUndefined, AttrUndefined},
GapLine: ColorAttr{colUndefined, AttrUndefined},
Nth: ColorAttr{colUndefined, AttrUndefined}, Nth: ColorAttr{colUndefined, AttrUndefined},
} }
} }
@ -927,6 +934,7 @@ func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, forceBlack bool, hasInp
theme.ListBorder = o(theme.Border, theme.ListBorder) theme.ListBorder = o(theme.Border, theme.ListBorder)
theme.Separator = o(theme.ListBorder, theme.Separator) theme.Separator = o(theme.ListBorder, theme.Separator)
theme.Scrollbar = o(theme.ListBorder, theme.Scrollbar) theme.Scrollbar = o(theme.ListBorder, theme.Scrollbar)
theme.GapLine = o(theme.ListBorder, theme.GapLine)
/* /*
--color list-border:green --color list-border:green
--color scrollbar:red --color scrollbar:red
@ -992,6 +1000,7 @@ func initPalette(theme *ColorTheme) {
ColInfo = pair(theme.Info, theme.InputBg) ColInfo = pair(theme.Info, theme.InputBg)
ColSeparator = pair(theme.Separator, theme.InputBg) ColSeparator = pair(theme.Separator, theme.InputBg)
ColScrollbar = pair(theme.Scrollbar, theme.ListBg) ColScrollbar = pair(theme.Scrollbar, theme.ListBg)
ColGapLine = pair(theme.GapLine, theme.ListBg)
ColBorder = pair(theme.Border, theme.Bg) ColBorder = pair(theme.Border, theme.Bg)
ColBorderLabel = pair(theme.BorderLabel, theme.Bg) ColBorderLabel = pair(theme.BorderLabel, theme.Bg)
ColPreviewLabel = pair(theme.PreviewLabel, theme.PreviewBg) ColPreviewLabel = pair(theme.PreviewLabel, theme.PreviewBg)