@@ -19,6 +19,7 @@ package output
19
19
20
20
import (
21
21
"fmt"
22
+ "unicode/utf8"
22
23
23
24
"github.com/fatih/color"
24
25
)
@@ -27,6 +28,8 @@ var red = color.New(color.FgRed).SprintfFunc()
27
28
var blue = color .New (color .FgBlue ).SprintfFunc ()
28
29
var green = color .New (color .FgGreen ).SprintfFunc ()
29
30
var yellow = color .New (color .FgYellow ).SprintfFunc ()
31
+ var white = color .New (color .FgWhite ).SprintfFunc ()
32
+ var hiWhite = color .New (color .FgHiWhite ).SprintfFunc ()
30
33
31
34
func Red (in string ) * Text {
32
35
return & Text {raw : red (in ), clean : in }
@@ -44,6 +47,14 @@ func Yellow(in string) *Text {
44
47
return & Text {raw : yellow (in ), clean : in }
45
48
}
46
49
50
+ func White (in string ) * Text {
51
+ return & Text {raw : white (in ), clean : in }
52
+ }
53
+
54
+ func HiWhite (in string ) * Text {
55
+ return & Text {raw : hiWhite (in ), clean : in }
56
+ }
57
+
47
58
type TextBox interface {
48
59
Len () int
49
60
Pad (availableWidth int ) string
@@ -56,7 +67,7 @@ type Text struct {
56
67
}
57
68
58
69
func (t * Text ) Len () int {
59
- return len (t .clean )
70
+ return utf8 . RuneCountInString (t .clean )
60
71
}
61
72
62
73
// func (t *Text) String() string {
0 commit comments