Task

Display a word in various colours on the terminal.

The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.



Optionally demonstrate:

 How the system should determine if the terminal supports colour
 Setting of the background colour
 How to cause blinking or flashing (if supported by the terminal)


package main
 
import (
    "fmt"
    "os"
    "os/exec"
)
 
func main() {
    color(red)
    fmt.Println("Red")
    color(green)
    fmt.Println("Green")
    color(blue)
    fmt.Println("Blue")
}
 
const (
    blue  = "1"
    green = "2"
    red   = "4"
)
 
func color(c string) {
    cmd := exec.Command("tput", "setf", c)
    cmd.Stdout = os.Stdout
    cmd.Run()
}