Skip to content

Instantly share code, notes, and snippets.

@pyperanger
Created February 3, 2020 17:59
Show Gist options
  • Save pyperanger/95d70d28ad9c0e653a7ff97dc4d54672 to your computer and use it in GitHub Desktop.
Save pyperanger/95d70d28ad9c0e653a7ff97dc4d54672 to your computer and use it in GitHub Desktop.
Golang colors without external library in Linux
package main
import (
"fmt"
)
var (
RED = "\x1b[31m"
GREEN = "\x1b[32m"
YELLOW = "\x1b[33m"
BLUE = "\x1b[34m"
MAGENTA = "\x1b[35m"
CYAN = "\x1b[36m"
)
func main() {
fmt.Println(RED, "RED",
GREEN, "GREEN",
YELLOW, "YELLOW",
BLUE, "BLUE",
MAGENTA, "MAGENTA",
CYAN, "CYAN");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment