Created
November 12, 2019 05:51
-
-
Save zaydek-old/ae517158fd2faa25c98871d7013acca5 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 ( | |
Blackf = newColorf("\033[1;30m%s\033[0m") | |
Redf = newColorf("\033[1;31m%s\033[0m") | |
Greenf = newColorf("\033[1;32m%s\033[0m") | |
Yellowf = newColorf("\033[1;33m%s\033[0m") | |
Purplef = newColorf("\033[1;34m%s\033[0m") | |
Magentaf = newColorf("\033[1;35m%s\033[0m") | |
Tealf = newColorf("\033[1;36m%s\033[0m") | |
Whitef = newColorf("\033[1;37m%s\033[0m") | |
) | |
func newColorf(colorf string) func(string, ...interface{}) string { | |
fn := func(format string, args ...interface{}) string { | |
return fmt.Sprintf(colorf, fmt.Sprintf(format, args...)) | |
} | |
return fn | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment