feat: colored text

This commit is contained in:
2024-09-15 08:59:07 +08:00
parent fb65a59845
commit ddc9862c62
4 changed files with 39 additions and 12 deletions

22
utils/printf.go Normal file
View File

@@ -0,0 +1,22 @@
package utils
import (
"fmt"
"github.com/TwiN/go-color"
)
func DonePrintfln(format string, a ...interface{}) {
fmt.Printf(color.InBold(color.InGreen("[Done] "))+format+"\n", a...)
}
func InfoPrintfln(format string, a ...interface{}) {
fmt.Printf(color.InBold(color.InBlue("[Info] "))+format+"\n", a...)
}
func WarningPrintfln(format string, a ...interface{}) {
fmt.Printf(color.InBold(color.InYellow("[Warning] "))+format+"\n", a...)
}
func ErrorPrintfln(format string, a ...interface{}) {
fmt.Printf(color.InBold(color.InRed("[Error] "))+format+"\n", a...)
}