From ccd923a6ced81b70a4584f69d71648a5f206e352 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 5 Jul 2016 16:41:48 +0200 Subject: [PATCH] add color-naming map --- app.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app.go b/app.go index 140eed1..da19121 100644 --- a/app.go +++ b/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,