-
Notifications
You must be signed in to change notification settings - Fork 2
/
theme.go
60 lines (53 loc) · 1.22 KB
/
theme.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
// SPDX-License-Identifier: Unlicense OR MIT
package theme
import (
"gioui.org/font/gofont"
"gioui.org/text"
"gioui.org/unit"
"gioui.org/widget"
"gioui.org/widget/material"
"image/color"
)
type DuoUItheme struct {
T *material.Theme
Shaper text.Shaper
TextSize unit.Value
Color struct {
Primary color.RGBA
Text color.RGBA
Hint color.RGBA
InvText color.RGBA
}
Colors map[string]string
Fonts map[string]text.Typeface
Icons map[string]*widget.Icon
scrollBarSize int
}
func register(fnt text.Font, ttf []byte) {
//face, err := opentype.Parse(ttf)
//if err != nil {
// panic(fmt.Sprintf("failed to parse font: %v", err))
//}
//fnt.Typeface = "Go"
//font.Register(fnt, face)
}
func NewDuoUItheme() *DuoUItheme {
t := &DuoUItheme{
T: material.NewTheme(gofont.Collection()),
//Shaper: font.Default(),
}
t.Colors = NewDuoUIcolors()
t.TextSize = unit.Sp(16)
//t.Icons = NewDuoUIicons()
return t
}
func (t *DuoUItheme) ChangeLightDark() {
light := t.Colors["Light"]
dark := t.Colors["Dark"]
lightGray := t.Colors["LightGrayIII"]
darkGray := t.Colors["DarkGrayII"]
t.Colors["Light"] = dark
t.Colors["Dark"] = light
t.Colors["LightGrayIII"] = darkGray
t.Colors["DarkGrayII"] = lightGray
}