-
Notifications
You must be signed in to change notification settings - Fork 3
/
style.go
48 lines (37 loc) · 892 Bytes
/
style.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
package colorStyle
import "strconv"
type Style int
func (s Style) ptrString() *string {
str := strconv.Itoa(int(s))
return &str
}
const (
Default Style = iota // 默认值
Bold // 加粗
Grey // 灰显
Italic // 斜体
Underline // 下划线
Reverse // 反显
Strikethrough // 删除线
)
func (c *CSS) StyleDefault() *CSS {
return c.setStyle(Default)
}
func (c *CSS) StyleBold() *CSS {
return c.setStyle(Bold)
}
func (c *CSS) StyleGrey() *CSS {
return c.setStyle(Grey)
}
func (c *CSS) StyleItalic() *CSS {
return c.setStyle(Italic)
}
func (c *CSS) StyleUnderline() *CSS {
return c.setStyle(Underline)
}
func (c *CSS) StyleReverse() *CSS {
return c.setStyle(Reverse)
}
func (c *CSS) StyleStrikethrough() *CSS {
return c.setStyle(Strikethrough)
}