summaryrefslogtreecommitdiff
path: root/src/result.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-10-21 19:35:59 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-10-21 19:35:59 +0900
commit0a8d2996dcb3cd3ebf55b783b08667fa3740433b (patch)
tree62b1268f394dfd5bed28398fbd3ca379b8c87953 /src/result.go
parentcfdb00b9718822b6ab2018a47288d5be3a32d07c (diff)
downloadfzf-0a8d2996dcb3cd3ebf55b783b08667fa3740433b.tar.gz
Set foreground color without affecting background
Close #712
Diffstat (limited to 'src/result.go')
-rw-r--r--src/result.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/result.go b/src/result.go
index 347cf599..69e83f85 100644
--- a/src/result.go
+++ b/src/result.go
@@ -92,13 +92,13 @@ func minRank() rank {
return rank{index: 0, points: [4]uint16{math.MaxUint16, 0, 0, 0}}
}
-func (result *Result) colorOffsets(matchOffsets []Offset, color int, attr curses.Attr, current bool) []colorOffset {
+func (result *Result) colorOffsets(matchOffsets []Offset, theme *curses.ColorTheme, color int, attr curses.Attr, current bool) []colorOffset {
itemColors := result.item.Colors()
+ // No ANSI code, or --color=no
if len(itemColors) == 0 {
var offsets []colorOffset
for _, off := range matchOffsets {
-
offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: color, attr: attr})
}
return offsets
@@ -149,17 +149,17 @@ func (result *Result) colorOffsets(matchOffsets []Offset, color int, attr curses
fg := ansi.color.fg
if fg == -1 {
if current {
- fg = curses.CurrentFG
+ fg = int(theme.Current)
} else {
- fg = curses.FG
+ fg = int(theme.Fg)
}
}
bg := ansi.color.bg
if bg == -1 {
if current {
- bg = curses.DarkBG
+ bg = int(theme.DarkBg)
} else {
- bg = curses.BG
+ bg = int(theme.Bg)
}
}
colors = append(colors, colorOffset{