fix(color): do not fail on nil colors

resolves #1388
This commit is contained in:
Jan De Dobbeleer 2021-12-08 12:06:54 +01:00 committed by Jan De Dobbeleer
parent 98472abafc
commit 75eb09e6dc

View file

@ -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