-
Notifications
You must be signed in to change notification settings - Fork 3
/
palette.go
167 lines (134 loc) Β· 3.61 KB
/
palette.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package main
import "github.com/charmbracelet/lipgloss"
var ClockEmoji = map[int]string{
0: "π",
12: "π",
24: "π",
1: "π",
13: "π",
2: "π",
14: "π",
3: "π",
15: "π",
4: "π",
16: "π",
5: "π",
17: "π",
6: "π",
18: "π",
7: "π",
19: "π",
8: "π",
20: "π",
9: "π",
21: "π",
10: "π",
22: "π",
11: "π",
23: "π",
}
type Palette struct {
Night string
Dawn string
Morning string
Noon string // work hours
AfterNoon string
Dusk string
Evening string
FgNight string
FgDawn string
FgMorning string
FgNoon string // work hours
FgAfterNoon string
FgDusk string
FgEvening string
Highlight string
FgHighlight string
Member string
FgMember string
LipglossPalette struct {
Night lipgloss.Style
Dawn lipgloss.Style
Morning lipgloss.Style
Noon lipgloss.Style // work hours
AfterNoon lipgloss.Style
Dusk lipgloss.Style
Evening lipgloss.Style
Highlight lipgloss.Style
Member lipgloss.Style
}
}
func NewPalette(theme string) *Palette {
p := &BlueYellow
p.LipglossPalette.Night = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgNight)).Background(lipgloss.Color(p.Night))
p.LipglossPalette.Dawn = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgDawn)).Background(lipgloss.Color(p.Dawn))
p.LipglossPalette.Morning = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgMorning)).Background(lipgloss.Color(p.Morning))
p.LipglossPalette.Noon = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgNoon)).Background(lipgloss.Color(p.Noon))
p.LipglossPalette.AfterNoon = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgAfterNoon)).Background(lipgloss.Color(p.AfterNoon))
p.LipglossPalette.Dusk = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgDusk)).Background(lipgloss.Color(p.Dusk))
p.LipglossPalette.Evening = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgEvening)).Background(lipgloss.Color(p.Evening))
p.LipglossPalette.Highlight = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgHighlight)).Background(lipgloss.Color(p.Highlight))
p.LipglossPalette.Member = lipgloss.NewStyle().Foreground(lipgloss.Color(p.FgMember)).Background(lipgloss.Color(p.Member))
return p
}
func (p *Palette) Style(timeOfDay int) lipgloss.Style {
switch timeOfDay {
case 22, 23, 24, 0, 1, 2, 3, 4:
return p.LipglossPalette.Night
case 5, 6:
return p.LipglossPalette.Dawn
case 7, 8:
return p.LipglossPalette.Morning
case 9, 10, 11, 12, 13, 14:
return p.LipglossPalette.Noon
case 15, 16:
return p.LipglossPalette.AfterNoon
case 17, 18, 19:
return p.LipglossPalette.Dusk
case 20, 21:
return p.LipglossPalette.Evening
default:
return p.LipglossPalette.Night
}
}
var BlueYellow = Palette{
Night: "#003E7F",
Dawn: "#406C95",
Evening: "#406C95",
Morning: "#7F99AB",
Dusk: "#7F99AB",
Noon: "#FEF4D7",
AfterNoon: "#B9C49F",
FgNight: "#FFFFFF",
FgDawn: "#FFFFFF",
FgMorning: "#FFFFFF",
FgNoon: "#000000",
FgAfterNoon: "#000000",
FgDusk: "#FFFFFF",
FgEvening: "#FFFFFF",
Highlight: "#fafa00",
FgHighlight: "#000000",
// Member: "#5495e1",
Member: "#A3D8BD",
// Member: "#F6F6F6",
// Member: "#FEF4D7",
FgMember: "#000000",
}
var PurpleYellow = Palette{
Night: "#3d0066",
Dawn: "#5c0099",
Morning: "#c86bfa",
Noon: "#fdc500",
AfterNoon: "#ffd500",
Dusk: "#ffee32",
Evening: "#03071e",
}
var BlueGreen = Palette{
Night: "#003e7f",
Dawn: "#0068af",
Morning: "#5495e1",
Noon: "#dddddd",
AfterNoon: "#44a75e",
Dusk: "#008239",
Evening: "#00540e",
}