-
Notifications
You must be signed in to change notification settings - Fork 80
/
colors.go
104 lines (95 loc) · 3.46 KB
/
colors.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package gui
import (
"os"
"strings"
)
type colorSet struct {
rosterPeerBackground string
rosterPeerOfflineForeground string
rosterPeerOnlineForeground string
rosterGroupBackground string
rosterAccountOnlineBackground string
rosterAccountOfflineBackground string
conversationOutgoingUserForeground string
conversationIncomingUserForeground string
conversationOutgoingTextForeground string
conversationIncomingTextForeground string
conversationStatusTextForeground string
conversationOutgoingDelayedUserForeground string
conversationOutgoingDelayedTextForeground string
conversationLockTypingBackground string
conversationUnlockTypingBackground string
timestampForeground string
}
var themeVariant string
func (u *gtkUI) isDarkThemeVariant() bool {
if themeVariant != "" {
return themeVariant == "dark"
}
themeVariant = "light"
gtkTheme := os.Getenv("GTK_THEME")
if gtkTheme != "" {
toks := strings.Split(gtkTheme, ":")
variant := toks[len(toks)-1:][0]
if variant == "dark" {
themeVariant = variant
return true
}
}
settings, err := g.gtk.SettingsGetDefault()
if err != nil {
panic(err)
}
prefDark, _ := settings.GetProperty("gtk-application-prefer-dark-theme")
if prefDark.(bool) {
themeVariant = "dark"
return true
}
return false
}
func (u *gtkUI) currentColorSet() colorSet {
if u.isDarkThemeVariant() {
return u.defaultDarkColorSet()
}
return u.defaultLightColorSet()
}
func (u *gtkUI) defaultLightColorSet() colorSet {
return colorSet{
rosterPeerBackground: "#ffffff",
rosterPeerOfflineForeground: "#aaaaaa",
rosterPeerOnlineForeground: "#000000",
rosterGroupBackground: "#e9e7f3",
rosterAccountOnlineBackground: "#918caa",
rosterAccountOfflineBackground: "#d5d3de",
conversationOutgoingUserForeground: "#3465a4",
conversationIncomingUserForeground: "#a40000",
conversationOutgoingTextForeground: "#000000",
conversationIncomingTextForeground: "#000000",
conversationStatusTextForeground: "#aaaaaa",
conversationOutgoingDelayedUserForeground: "#aaaaaa",
conversationOutgoingDelayedTextForeground: "#aaaaaa",
conversationLockTypingBackground: "#e0e0e0",
conversationUnlockTypingBackground: "#f9f9f9",
timestampForeground: "#aaaaaa",
}
}
func (u *gtkUI) defaultDarkColorSet() colorSet {
return colorSet{
rosterPeerBackground: "#7f7f7f",
rosterPeerOfflineForeground: "#aaaaaa",
rosterPeerOnlineForeground: "#e5e5e5",
rosterGroupBackground: "#b8b6bf",
rosterAccountOnlineBackground: "#d5d3de",
rosterAccountOfflineBackground: "#918caa",
conversationOutgoingUserForeground: "#3465a4",
conversationIncomingUserForeground: "#a40000",
conversationOutgoingTextForeground: "#7f7f7f",
conversationIncomingTextForeground: "#7f7f7f",
conversationStatusTextForeground: "#4e9a06",
conversationOutgoingDelayedUserForeground: "#444444",
conversationOutgoingDelayedTextForeground: "#444444",
conversationLockTypingBackground: "#e0e0e0",
conversationUnlockTypingBackground: "#252a2c",
timestampForeground: "#444444",
}
}