-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcolor_test.go
46 lines (42 loc) · 864 Bytes
/
color_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
package vaxis_test
import "git.sr.ht/~rockorager/vaxis"
func ExampleRGBColor() {
vx, _ := vaxis.New(vaxis.Options{})
color := vaxis.RGBColor(1, 2, 3)
vx.Window().Fill(vaxis.Cell{
Character: vaxis.Character{
Grapheme: "a",
},
Style: vaxis.Style{
Background: color,
},
})
}
func ExampleIndexColor() {
vx, _ := vaxis.New(vaxis.Options{})
// Index 1 is usually a red
color := vaxis.IndexColor(1)
vx.Window().Fill(vaxis.Cell{
Character: vaxis.Character{
Grapheme: " ",
Width: 1,
},
Style: vaxis.Style{
Background: color,
},
})
}
func ExampleHexColor() {
vx, _ := vaxis.New(vaxis.Options{})
// Creates an RGB color from a hex value
color := vaxis.HexColor(0x00AABB)
vx.Window().Fill(vaxis.Cell{
Character: vaxis.Character{
Grapheme: " ",
Width: 1,
},
Style: vaxis.Style{
Background: color,
},
})
}