Skip to content

Commit

Permalink
add None color constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mkideal committed Sep 11, 2024
1 parent 67545f7 commit 478bda1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions term/colors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ func BgRGB(r, g, b int) Color {
// Reset is the ANSI escape code to reset all attributes.
const Reset = "\033[0m"

// None is a color that does not apply any color.
const None = Color("")

const (
// Special effects
Bold = Color("\033[1m")
Expand Down
2 changes: 1 addition & 1 deletion term/term.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (c Color) Colorize(s string) fmt.Stringer {

// Background returns the background version of the color
func (c Color) Background() Color {
if len(c) < 5 {
if len(c) < 6 {
return c
}
bg := string(c[:5]) + "4" + string(c[6:])
Expand Down

0 comments on commit 478bda1

Please sign in to comment.