-
-
Notifications
You must be signed in to change notification settings - Fork 187
/
deprecated.go
46 lines (38 loc) · 1.18 KB
/
deprecated.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 pterm
import "strings"
// NewLettersFromString creates a Letters object from a string, which is prefilled with the LetterStyle from ThemeDefault.
// You can override the ThemeDefault LetterStyle if you want to.
//
// Deprecated: use putils.NewLettersFromString instead.
func NewLettersFromString(text string) Letters {
return NewLettersFromStringWithStyle(text, &ThemeDefault.LetterStyle)
}
// NewLettersFromStringWithStyle creates a Letters object from a string and applies a Style to it.
//
// Deprecated: use putils.NewLettersFromStringWithStyle instead.
func NewLettersFromStringWithStyle(text string, style *Style) Letters {
s := strings.Split(text, "")
l := Letters{}
for _, s2 := range s {
l = append(l, Letter{
String: s2,
Style: style,
})
}
return l
}
// NewLettersFromStringWithRGB creates a Letters object from a string and applies an RGB color to it (overwrites style).
//
// Deprecated: use putils.NewLettersFromStringWithRGB instead.
func NewLettersFromStringWithRGB(text string, rgb RGB) Letters {
s := strings.Split(text, "")
l := Letters{}
for _, s2 := range s {
l = append(l, Letter{
String: s2,
Style: &Style{},
RGB: rgb,
})
}
return l
}