Inherit list-border color for inline header/footer separators

When --header-border=inline, --header-lines-border=inline, or
--footer-border=inline is used, default the section's border color to
--color list-border rather than the generic border color when the user
has not explicitly set it. The inline separator then matches the
surrounding list frame.

Explicit --color header-border / --color footer-border still wins.
This commit is contained in:
Junegunn Choi
2026-04-18 13:21:49 +09:00
parent e873128d93
commit 35e8e65b2e
2 changed files with 17 additions and 4 deletions
+3 -1
View File
@@ -1173,7 +1173,9 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
baseTheme = renderer.DefaultTheme()
}
// This should be called before accessing tui.Color*
tui.InitTheme(opts.Theme, baseTheme, opts.Bold, opts.Black, opts.InputBorderShape.Visible(), opts.HeaderBorderShape.Visible())
headerInline := opts.HeaderBorderShape == tui.BorderInline || opts.HeaderLinesShape == tui.BorderInline
footerInline := opts.FooterBorderShape == tui.BorderInline
tui.InitTheme(opts.Theme, baseTheme, opts.Bold, opts.Black, opts.InputBorderShape.Visible(), opts.HeaderBorderShape.Visible(), headerInline, footerInline)
// Gutter character
var gutterChar, gutterRawChar string
+14 -3
View File
@@ -1186,7 +1186,7 @@ func init() {
}
}
func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, boldify bool, forceBlack bool, hasInputWindow bool, hasHeaderWindow bool) {
func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, boldify bool, forceBlack bool, hasInputWindow bool, hasHeaderWindow bool, headerInline bool, footerInline bool) {
if forceBlack {
theme.Bg = ColorAttr{colBlack, AttrUndefined}
}
@@ -1320,11 +1320,22 @@ func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, boldify bool, forceBlac
} else {
theme.HeaderBg = o(theme.Bg, theme.ListBg)
}
theme.HeaderBorder = o(theme.Border, theme.HeaderBorder)
// Inline header/footer borders sit inside the list frame, so default their color
// to the list-border color when the user has not explicitly set it. The inline
// separator then matches the surrounding frame.
headerBorderFallback := theme.Border
if headerInline {
headerBorderFallback = theme.ListBorder
}
theme.HeaderBorder = o(headerBorderFallback, theme.HeaderBorder)
theme.HeaderLabel = o(theme.BorderLabel, theme.HeaderLabel)
theme.FooterBg = o(theme.Bg, theme.FooterBg)
theme.FooterBorder = o(theme.Border, theme.FooterBorder)
footerBorderFallback := theme.Border
if footerInline {
footerBorderFallback = theme.ListBorder
}
theme.FooterBorder = o(footerBorderFallback, theme.FooterBorder)
theme.FooterLabel = o(theme.BorderLabel, theme.FooterLabel)
if theme.Nomatch.IsUndefined() {