summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-11 00:51:19 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-11 00:51:49 +0900
commitdfb88edb5e2bc5b6cdd541eb30c84d04101f75b1 (patch)
treee68310e8588358ba747c6f224eccb91070ff8712 /src
parentbd3e65df4dc3f46119fe502e1ad502ef6b7873ca (diff)
downloadfzf-dfb88edb5e2bc5b6cdd541eb30c84d04101f75b1.tar.gz
Make preview-scrollbar color conditionally inherit from scrollbar color
Diffstat (limited to 'src')
-rw-r--r--src/tui/tui.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/tui/tui.go b/src/tui/tui.go
index 2bd9caf9..0ab4874b 100644
--- a/src/tui/tui.go
+++ b/src/tui/tui.go
@@ -897,6 +897,10 @@ func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, forceBlack bool, hasInp
theme.Border = o(baseTheme.Border, theme.Border)
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
theme.ListFg = o(theme.Fg, theme.ListFg)
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.Separator = o(theme.ListBorder, theme.Separator)
theme.Scrollbar = o(theme.ListBorder, theme.Scrollbar)
- theme.PreviewScrollbar = o(theme.PreviewBorder, theme.PreviewScrollbar)
+ /*
+ --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)
+ }
if hasInputWindow {
theme.InputBg = o(theme.Bg, theme.InputBg)
} else {