blob: 59e9b5b09534079df4e32e43521150c2541c2381 [file] [log] [blame]
Don Newton2bdfd3f2019-04-08 17:06:33 -04001package color
2
3import (
4 "fmt"
5)
6
7// github.com/bclicn/color
8// colorized output for Mac & Linux terminal
9// version: 1.0.0
10// author: bcli, bclicn@gmail.com, 2016-11-4
11// see: http://misc.flogisoft.com/bash/tip_colors_and_formatting
12// usage:
13// For official code layout
14// $ go get github.com/bclicn/color
15// # in your project
16// import "github.com/bclicn/color"
17// func main() {
18// color.Test()
19// }
20
21func ColorTest() {
22
23 const HEAD = " "
24 const TAIL = " "
25
26 // regular
27 fmt.Println(HEAD + Black("black") + TAIL)
28 fmt.Println(HEAD + Red("red") + TAIL)
29 fmt.Println(HEAD + Green("green") + TAIL)
30 fmt.Println(HEAD + Yellow("yellow") + TAIL)
31 fmt.Println(HEAD + Blue("blue") + TAIL)
32 fmt.Println(HEAD + Purple("purple") + TAIL)
33 fmt.Println(HEAD + Cyan("cyan") + TAIL)
34 fmt.Println(HEAD + LightGray("light gray") + TAIL)
35 fmt.Println(HEAD + DarkGray("dark gray") + TAIL)
36 fmt.Println(HEAD + LightRed("light red") + TAIL)
37 fmt.Println(HEAD + LightGreen("light green") + TAIL)
38 fmt.Println(HEAD + LightYellow("light yellow") + TAIL)
39 fmt.Println(HEAD + LightBlue("light blue") + TAIL)
40 fmt.Println(HEAD + LightPurple("light purple") + TAIL)
41 fmt.Println(HEAD + LightCyan("light cyan") + TAIL)
42 fmt.Println(HEAD + White("white") + TAIL)
43
44 // bold
45 fmt.Println(HEAD + BBlack("bold black") + TAIL)
46 fmt.Println(HEAD + BRed("bold red") + TAIL)
47 fmt.Println(HEAD + BGreen("bold green") + TAIL)
48 fmt.Println(HEAD + BYellow("bold yellow") + TAIL)
49 fmt.Println(HEAD + BBlue("bold blue") + TAIL)
50 fmt.Println(HEAD + BPurple("bold purple") + TAIL)
51 fmt.Println(HEAD + BCyan("bold cyan") + TAIL)
52 fmt.Println(HEAD + BLightGray("bold light gray") + TAIL)
53 fmt.Println(HEAD + BDarkGray("bold dark gray") + TAIL)
54 fmt.Println(HEAD + BLightRed("bold light red") + TAIL)
55 fmt.Println(HEAD + BLightGreen("bold light green") + TAIL)
56 fmt.Println(HEAD + BLightYellow("bold light yellow") + TAIL)
57 fmt.Println(HEAD + BLightBlue("bold light blue") + TAIL)
58 fmt.Println(HEAD + BLightPurple("bold light purple") + TAIL)
59 fmt.Println(HEAD + BLightCyan("bold light cyan") + TAIL)
60 fmt.Println(HEAD + BWhite("bold white") + TAIL)
61
62 // background
63 fmt.Println(HEAD + GBlack("background black") + TAIL)
64 fmt.Println(HEAD + GRed("background red") + TAIL)
65 fmt.Println(HEAD + GGreen("background green") + TAIL)
66 fmt.Println(HEAD + GYellow("background yellow") + TAIL)
67 fmt.Println(HEAD + GBlue("background blue") + TAIL)
68 fmt.Println(HEAD + GPurple("background purple") + TAIL)
69 fmt.Println(HEAD + GCyan("background cyan") + TAIL)
70 fmt.Println(HEAD + GLightGray("background light gray") + TAIL)
71 fmt.Println(HEAD + GDarkGray("background dark gray") + TAIL)
72 fmt.Println(HEAD + GLightRed("background light red") + TAIL)
73 fmt.Println(HEAD + GLightGreen("background light green") + TAIL)
74 fmt.Println(HEAD + GLightYellow("background light yellow") + TAIL)
75 fmt.Println(HEAD + GLightBlue("background light blue") + TAIL)
76 fmt.Println(HEAD + GLightPurple("background light purple") + TAIL)
77 fmt.Println(HEAD + GLightCyan("background light cyan") + TAIL)
78 fmt.Println(HEAD + GWhite("background white") + TAIL)
79
80 // special
81 fmt.Println("A " + Bold("bold") + " text")
82 fmt.Println("This is a " + Dim("dimmed") + " text")
83 fmt.Println("Add a " + Underline("underline"))
84 fmt.Println("Use " + Invert("invert") + " to highlight your text")
85 fmt.Println("Your password is:" + Hide("myPass"))
86 fmt.Println("OMG I'm " + Blink("blinking") + " !!!") // blinking works only on mac
87}