diff --git a/src/result.go b/src/result.go index acd7bb06..3c63e2e4 100644 --- a/src/result.go +++ b/src/result.go @@ -228,10 +228,11 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t offset: [2]int32{int32(start), int32(idx)}, color: color, match: true, url: url}) } else if curr.color { ansi := itemColors[curr.index] - color := ansiToColorPair(ansi, colBase) + base := colBase if curr.nth { - color = color.WithAttr(attrNth) + base = base.WithAttr(attrNth) } + color := ansiToColorPair(ansi, base) colors = append(colors, colorOffset{ offset: [2]int32{int32(start), int32(idx)}, color: color, diff --git a/src/result_test.go b/src/result_test.go index 79cc1ee2..6e6d4387 100644 --- a/src/result_test.go +++ b/src/result_test.go @@ -176,7 +176,7 @@ func TestColorOffset(t *testing.T) { assert(9, 35, 37, tui.NewColorPair(4, 8, tui.Bold)) expected := tui.Bold | attr if attr == tui.AttrRegular { - expected = tui.AttrRegular + expected = tui.Bold } assert(10, 37, 39, tui.NewColorPair(4, 8, expected)) assert(11, 39, 40, tui.NewColorPair(4, 8, tui.Bold))