1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-07-26 17:51:58 -07:00

Make preview-scrollbar color conditionally inherit from scrollbar color

This commit is contained in:
Junegunn Choi
2025-01-11 00:51:19 +09:00
parent bd3e65df4d
commit dfb88edb5e

@@ -897,6 +897,10 @@ func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, forceBlack bool, hasInp
theme.Border = o(baseTheme.Border, theme.Border) theme.Border = o(baseTheme.Border, theme.Border)
theme.BorderLabel = o(baseTheme.BorderLabel, theme.BorderLabel) theme.BorderLabel = o(baseTheme.BorderLabel, theme.BorderLabel)
undefined := NewColorAttr()
scrollbarDefined := theme.Scrollbar != undefined
previewBorderDefined := theme.PreviewBorder != undefined
// These colors are not defined in the base themes // These colors are not defined in the base themes
theme.ListFg = o(theme.Fg, theme.ListFg) theme.ListFg = o(theme.Fg, theme.ListFg)
theme.ListBg = o(theme.Bg, theme.ListBg) theme.ListBg = o(theme.Bg, theme.ListBg)
@@ -913,7 +917,17 @@ 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)
/*
--color list-border:green
--color scrollbar:red
--color scrollbar:red,list-border:green
--color scrollbar:red,preview-border:green
*/
if scrollbarDefined && !previewBorderDefined {
theme.PreviewScrollbar = o(theme.Scrollbar, theme.PreviewScrollbar)
} else {
theme.PreviewScrollbar = o(theme.PreviewBorder, theme.PreviewScrollbar) theme.PreviewScrollbar = o(theme.PreviewBorder, theme.PreviewScrollbar)
}
if hasInputWindow { if hasInputWindow {
theme.InputBg = o(theme.Bg, theme.InputBg) theme.InputBg = o(theme.Bg, theme.InputBg)
} else { } else {