Skip to content

Instantly share code, notes, and snippets.

@TwiN
Last active January 9, 2019 01:04
Show Gist options
  • Save TwiN/4606266667d6330c6cbf8de73439a120 to your computer and use it in GitHub Desktop.
Save TwiN/4606266667d6330c6cbf8de73439a120 to your computer and use it in GitHub Desktop.
Colors in Go
package color
import "runtime"
var Reset = "\033[0m"
var Red = "\033[31m"
var Green = "\033[32m"
var Yellow = "\033[33m"
var Blue = "\033[34m"
var Purple = "\033[35m"
var Cyan = "\033[36m"
var Gray = "\033[37m"
var White = "\033[97m"
func init() {
if runtime.GOOS == "windows" {
Reset = ""
Red = ""
Green = ""
Yellow = ""
Blue = ""
Purple = ""
Cyan = ""
Gray = ""
White = ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment