/
label.go
74 lines (56 loc) · 1.69 KB
/
label.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: Unlicense OR MIT
package decredmaterial
import (
"image/color"
"gioui.org/unit"
"gioui.org/widget/material"
)
type Label struct {
material.LabelStyle
}
func (t *Theme) H1(txt string) Label {
return t.labelWithDefaultColor(Label{material.H1(t.Base, txt)})
}
func (t *Theme) H2(txt string) Label {
return t.labelWithDefaultColor(Label{material.H2(t.Base, txt)})
}
func (t *Theme) H3(txt string) Label {
return t.labelWithDefaultColor(Label{material.H2(t.Base, txt)})
}
func (t *Theme) H4(txt string) Label {
return t.labelWithDefaultColor(Label{material.H4(t.Base, txt)})
}
func (t *Theme) H5(txt string) Label {
return t.labelWithDefaultColor(Label{material.H5(t.Base, txt)})
}
func (t *Theme) H6(txt string) Label {
return t.labelWithDefaultColor(Label{material.H6(t.Base, txt)})
}
func (t *Theme) Body1(txt string) Label {
return t.labelWithDefaultColor(Label{material.Body1(t.Base, txt)})
}
func (t *Theme) Body2(txt string) Label {
return t.labelWithDefaultColor(Label{material.Body2(t.Base, txt)})
}
func (t *Theme) Caption(txt string) Label {
return Label{material.Caption(t.Base, txt)}
}
func (t *Theme) ErrorLabel(txt string) Label {
label := t.Caption(txt)
label.Color = t.Color.Danger
return label
}
func (t *Theme) Label(size unit.Value, txt string) Label {
return Label{material.Label(t.Base, size, txt)}
}
func (t *Theme) LabelColor(size unit.Value, txt string, color color.NRGBA) Label {
return t.labelWithColor(Label{material.Label(t.Base, size, txt)}, color)
}
func (t *Theme) labelWithColor(l Label, color color.NRGBA) Label {
l.Color = color
return l
}
func (t *Theme) labelWithDefaultColor(l Label) Label {
l.Color = t.Color.DeepBlue
return l
}