diff --git a/src/terminal.go b/src/terminal.go index bc364cdf..d77b7221 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -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 diff --git a/src/tui/tui.go b/src/tui/tui.go index dbe19a03..b6e43a4e 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -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() {