Skip to content

Commit

Permalink
Added methods to color text in red and green
Browse files Browse the repository at this point in the history
  • Loading branch information
orwaichman committed Jan 15, 2025
1 parent 66660ff commit ff53f4b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion utils/coreutils/cmdutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func extractBoolOptionFromArgs(args []string, optionName string) (cleanArgs []st

// Add green color style to the string if possible.
func PrintTitle(str string) string {
return colorStr(str, color.Green)
return PrintGreen(str)
}

// Add cyan color style to the string if possible.
Expand All @@ -253,11 +253,21 @@ func PrintComment(str string) string {
return colorStr(str, color.Gray)
}

// Add red color style to the string if possible.
func PrintRed(str string) string {
return colorStr(str, color.Red)
}

// Add yellow color style to the string if possible.
func PrintYellow(str string) string {
return colorStr(str, color.Yellow)
}

// Add green color style to the string if possible.
func PrintGreen(str string) string {
return colorStr(str, color.Green)
}

// Add the requested style to the string if possible.
func colorStr(str string, c color.Color) string {
// Add styles only on supported terminals
Expand Down

0 comments on commit ff53f4b

Please sign in to comment.