Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions color.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,15 @@ func (c NoColor) Sequence(_ bool) string {
// Sequence returns the ANSI Sequence for the color.
func (c ANSIColor) Sequence(bg bool) string {
col := int(c)
bgMod := func(c int) int {
if bg {
return c + 10
}
return c
bgMod := 0
if bg {
bgMod = 10
}

if col < 8 {
return fmt.Sprintf("%d", bgMod(col)+30)
return fmt.Sprintf("%d", bgMod+col+30)
}
return fmt.Sprintf("%d", bgMod(col-8)+90)
return fmt.Sprintf("%d", bgMod+(col-8)+90)
}

// Sequence returns the ANSI Sequence for the color.
Expand Down