forked from narqo/go-badge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
color.go
43 lines (39 loc) · 1.02 KB
/
color.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
package badge
// Color represents color of the badge.
type Color string
// ColorScheme contains named colors that could be used to render the badge.
var ColorScheme = map[string]string{
"brightgreen": "#4c1",
"green": "#97ca00",
"yellow": "#dfb317",
"yellowgreen": "#a4a61d",
"orange": "#fe7d37",
"red": "#e05d44",
"blue": "#007ec6",
"grey": "#555",
"gray": "#555",
"lightgrey": "#9f9f9f",
"lightgray": "#9f9f9f",
}
// Standard colors.
const (
ColorBrightgreen = Color("brightgreen")
ColorGreen = Color("green")
ColorYellow = Color("yellow")
ColorYellowgreen = Color("yellowgreen")
ColorOrange = Color("orange")
ColorRed = Color("red")
ColorBlue = Color("blue")
ColorGrey = Color("grey")
ColorGray = Color("gray")
ColorLightgrey = Color("lightgrey")
ColorLightgray = Color("lightgray")
)
func (c Color) String() string {
color, ok := ColorScheme[string(c)]
if ok {
return color
} else {
return string(c)
}
}