Created
January 13, 2023 16:10
-
-
Save sfate/494ae2c3d34077dfbcd7d937145db3ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
var ( | |
Info = Teal | |
Warn = Yellow | |
Fata = Red | |
) | |
var ( | |
Black = Color("\033[1;30m%s\033[0m") | |
Red = Color("\033[1;31m%s\033[0m") | |
Green = Color("\033[1;32m%s\033[0m") | |
Yellow = Color("\033[1;33m%s\033[0m") | |
Purple = Color("\033[1;34m%s\033[0m") | |
Magenta = Color("\033[1;35m%s\033[0m") | |
Teal = Color("\033[1;36m%s\033[0m") | |
White = Color("\033[1;37m%s\033[0m") | |
) | |
func Color(colorString string) func(...interface{}) string { | |
sprint := func(args ...interface{}) string { | |
return fmt.Sprintf(colorString, | |
fmt.Sprint(args...)) | |
} | |
return sprint | |
} | |
func main() { | |
fmt.Println(Info("hello, world!")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment