summaryrefslogtreecommitdiff
path: root/vt100.go
blob: d3037fca48e8ca68e3a98180787a1faf3bffeb3e (plain)
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 vt100

type (
	Normal             string
	Bold               string
	Underline          string
	Blink              string
	Inverse            string
	DoubleWidth        string
	DoubleHeight       string
	DoubleHeightTop    string
	DoubleHeightBottom string
)

var (
	esc                = string(033)
	normal             = esc + "[0m"
	bold               = esc + "[1m"
	underline          = esc + "[4m"
	blink              = esc + "[5m"
	inverse            = esc + "[7m"
	doubleWidth        = esc + "#6"
	doubleHeightTop    = esc + "#3"
	doubleHeightBottom = esc + "#4"
)

func (s Normal) String() string {
	return normal + string(s) + normal
}

func (s Bold) String() string {
	return bold + string(s) + normal
}

func (s Underline) String() string {
	return underline + string(s) + normal
}

func (s Blink) String() string {
	return blink + string(s) + normal
}

func (s Inverse) String() string {
	return inverse + string(s) + normal
}

func (s DoubleWidth) String() string {
	return doubleWidth + string(s) + normal
}

func (s DoubleHeight) String() string {
	return DoubleHeightTop(s).String() + "\n" +
		DoubleHeightBottom(s).String()
}

func (s DoubleHeightTop) String() string {
	return doubleHeightTop + string(s) + normal
}

func (s DoubleHeightBottom) String() string {
	return doubleHeightBottom + string(s) + normal
}