-
-
Save szaydel/4de39ce8ce1a8ce5ae8d8fcb0c3626ae to your computer and use it in GitHub Desktop.
Simple golang expirement with ANSI colors
This file contains hidden or 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 | |
// http://play.golang.org/p/jZ5pa944O1 <- will not display the colors | |
import "fmt" | |
const ( | |
InfoColor = "\033[1;34m%s\033[0m" | |
NoticeColor = "\033[1;36m%s\033[0m" | |
WarningColor = "\033[1;33m%s\033[0m" | |
ErrorColor = "\033[1;31m%s\033[0m" | |
DebugColor = "\033[0;36m%s\033[0m" | |
) | |
func main() { | |
fmt.Printf(InfoColor, "Info") | |
fmt.Println("") | |
fmt.Printf(NoticeColor, "Notice") | |
fmt.Println("") | |
fmt.Printf(WarningColor, "Warning") | |
fmt.Println("") | |
fmt.Printf(ErrorColor, "Error") | |
fmt.Println("") | |
fmt.Printf(DebugColor, "Debug") | |
fmt.Println("") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment