-
Notifications
You must be signed in to change notification settings - Fork 3
/
example_color_style_test.go
62 lines (47 loc) · 1.63 KB
/
example_color_style_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package colorStyle_test
import (
"fmt"
"github.com/flylog/colorStyle"
)
func Example() {
text := colorStyle.Green("green")
fmt.Printf("a %s text\n", text)
text = colorStyle.DarkBlue("Blue")
fmt.Printf("a %s text\n", text)
text = colorStyle.New().ColorRed().Sprint("red")
fmt.Println("a", text, "text")
colorStyle.New().StyleItalic().ColorRed().BgYellow().Printf("a italic red bgYellow text: %s\n", "Hello 世界!")
colorStyle.New().StyleBold().Printf("a bold text: %s\n", "Hello 世界!")
colorStyle.New().StyleItalic().Printf("a italic text: %s\n", "Hello 世界!")
colorStyle.New().ColorPurple().Printf("a purple text: %s\n", "Hello 世界!")
colorStyle.New().BgLightBlue().Printf("a bgLightBlue text: %s\n", "Hello 世界!")
colorStyle.New().BgLightBlue().Println("a bgLightBlue text")
}
func ExampleGreen() {
text := colorStyle.Green("green")
fmt.Printf("a %s text\n", text)
}
func ExampleDarkBlue() {
text := colorStyle.DarkBlue("Blue")
fmt.Printf("a %s text\n", text)
}
func ExampleNew() {
css := colorStyle.New()
css.StyleItalic().ColorGreen().BgYellow()
css.Printf("a italic green bgYellow text: %s\n", "Hello 世界!")
}
func ExampleCSS_StyleBold() {
colorStyle.New().StyleBold().Printf("a bold text: %s\n", "Hello 世界!")
// or
css := colorStyle.New().StyleBold()
css.Printf("a bold text: %s\n", "Hello 世界!")
}
func ExampleCSS_ColorRed() {
colorStyle.New().ColorRed().Printf("a bold text: %s\n", "Hello 世界!")
}
func ExampleCSS_Printf() {
colorStyle.New().ColorRed().Printf("a bold text: %s\n", "Hello 世界!")
}
func ExampleCSS_Println() {
colorStyle.New().BgLightBlue().Println("a bgLightBlue text")
}