mirror of
https://github.com/Luzifer/badge-gen.git
synced 2024-11-08 13:20:02 +00:00
add color-naming map
This commit is contained in:
parent
9df7c301bb
commit
ccd923a6ce
1 changed files with 18 additions and 0 deletions
18
app.go
18
app.go
|
@ -42,6 +42,20 @@ var (
|
|||
serviceHandlers = map[string]serviceHandler{}
|
||||
version = "dev"
|
||||
|
||||
colorList = 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",
|
||||
}
|
||||
|
||||
cacheStore cache.Cache
|
||||
configStore = configStorage{}
|
||||
)
|
||||
|
@ -184,6 +198,10 @@ func createBadge(title, text, color string) ([]byte, string) {
|
|||
t, _ := Asset("assets/badgeTemplate.tpl")
|
||||
tpl, _ := template.New("svg").Parse(string(t))
|
||||
|
||||
if c, ok := colorList[color]; ok {
|
||||
color = c
|
||||
}
|
||||
|
||||
tpl.Execute(&buf, map[string]interface{}{
|
||||
"Width": width,
|
||||
"TitleWidth": titleW + 2*xSpacing,
|
||||
|
|
Loading…
Reference in a new issue