From fdbfe36c0b882a4e948fafd1949956341607b1e5 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 31 May 2015 16:46:54 +0900 Subject: Color customization (#245) --- src/item.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/item.go') diff --git a/src/item.go b/src/item.go index 711adbe2..7c2f94d5 100644 --- a/src/item.go +++ b/src/item.go @@ -143,13 +143,25 @@ func (item *Item) colorOffsets(color int, bold bool, current bool) []colorOffset offset: Offset{int32(start), int32(idx)}, color: color, bold: bold}) } else { ansi := item.colors[curr-1] + fg := ansi.color.fg + if fg == -1 { + if current { + fg = curses.CurrentFG + } else { + fg = curses.FG + } + } bg := ansi.color.bg - if current && bg == -1 { - bg = int(curses.DarkBG) + if bg == -1 { + if current { + bg = curses.DarkBG + } else { + bg = curses.BG + } } offsets = append(offsets, colorOffset{ offset: Offset{int32(start), int32(idx)}, - color: curses.PairFor(ansi.color.fg, bg), + color: curses.PairFor(fg, bg), bold: ansi.color.bold || bold}) } } -- cgit v1.2.3