-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
theme.go
74 lines (66 loc) · 1.44 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package main
import (
"github.com/gdamore/tcell"
)
type Theme struct {
Name string
BackGround tcell.Color
Colors []tcell.Color
Levels []int
}
var ThemeOcean = Theme{
Name: "Ocean",
BackGround: tcell.NewRGBColor(0, 0, 100),
Colors: []tcell.Color{
tcell.NewRGBColor(50, 50, 255),
tcell.NewRGBColor(100, 100, 255),
tcell.NewRGBColor(150, 150, 255),
tcell.NewRGBColor(255, 255, 255),
},
Levels: []int{1, 1, 1, 1},
}
var ThemeFire = Theme{
Name: "Fire",
BackGround: tcell.NewRGBColor(100, 0, 0),
Colors: []tcell.Color{
tcell.NewRGBColor(255, 50, 50),
tcell.NewRGBColor(255, 100, 100),
tcell.NewRGBColor(255, 150, 150),
tcell.NewRGBColor(255, 255, 255),
},
Levels: []int{1, 1, 1, 1},
}
var ThemeMatrix = Theme{
Name: "Matrix",
BackGround: tcell.NewRGBColor(0, 0, 0),
Colors: []tcell.Color{
tcell.NewRGBColor(50, 255, 50),
},
Levels: []int{1},
}
var ThemeBlackAndWhite = Theme{
Name: "BlackAndWhite",
BackGround: tcell.NewRGBColor(0, 0, 0),
Colors: []tcell.Color{
tcell.NewRGBColor(255, 255, 255),
},
Levels: []int{1},
}
var ThemeWhiteAndBlack = Theme{
Name: "WhiteAndBlack",
BackGround: tcell.NewRGBColor(255, 255, 255),
Colors: []tcell.Color{
tcell.NewRGBColor(0, 0, 0),
},
Levels: []int{1},
}
func (t *Theme) Color(time int) tcell.Color {
total := 0
for i, l := range t.Levels {
total += l
if time < total {
return t.Colors[i]
}
}
return t.Colors[len(t.Colors)-1]
}