From 75eb09e6dc90ebdb3c4fbf50bdbd462cf09fe661 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Wed, 8 Dec 2021 12:06:54 +0100 Subject: [PATCH] fix(color): do not fail on nil colors resolves #1388 --- src/writer_ansi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/writer_ansi.go b/src/writer_ansi.go index 460aa036..2e9da58a 100644 --- a/src/writer_ansi.go +++ b/src/writer_ansi.go @@ -179,9 +179,9 @@ func (a *AnsiWriter) asAnsiColors(background, foreground string) (AnsiColor, Ans func (a *AnsiWriter) isKeyword(color string) (string, bool) { switch { - case color == Background: + case color == Background && a.Colors != nil: return a.Colors.Background, true - case color == Foreground: + case color == Foreground && a.Colors != nil: return a.Colors.Foreground, true case color == ParentBackground && a.ParentColors != nil: return a.ParentColors.Background, true