@@ -10,7 +10,8 @@ import (
10
10
"github.com/narqo/go-badge"
11
11
)
12
12
13
- var colors = statusToColors {
13
+ // Colors is used to harmonize status colors for all badges
14
+ var Colors = statusToColors {
14
15
c : map [task.State ]badge.Color {
15
16
// blue - lapis
16
17
task .Ready : "#2832C2" ,
@@ -20,8 +21,8 @@ var colors = statusToColors{
20
21
task .Running : "#DD571C" ,
21
22
// red - ruby
22
23
task .Failed : "#900603" ,
23
- // green - emerald
24
- task .Done : "#028A0F " ,
24
+ // green
25
+ task .Done : "#4ec820 " ,
25
26
},
26
27
// blue
27
28
Default : "#527284" ,
@@ -67,7 +68,7 @@ func StatusBadge(s storage.Storage, latest bool) func(http.ResponseWriter, *http
67
68
t , err := s .GetByCommit (service , project , branch , commit , latest )
68
69
69
70
if t == nil || err != nil {
70
- err = writeBadge ("status" , "?!" , colors .Default , w )
71
+ err = WriteBadge ("status" , "?!" , Colors .Default , w )
71
72
if err != nil {
72
73
panic (err )
73
74
}
@@ -79,15 +80,15 @@ func StatusBadge(s storage.Storage, latest bool) func(http.ResponseWriter, *http
79
80
return
80
81
}
81
82
82
- writeBadge (fmt .Sprintf ("status : %s" , service ), t .State .String (), colors .Get (t .State ), w )
83
+ WriteBadge (fmt .Sprintf ("status : %s" , service ), t .State .String (), Colors .Get (t .State ), w )
83
84
if err != nil {
84
85
panic (err )
85
86
}
86
87
}
87
88
}
88
89
89
- // writeBadge is a wrapper use to write a badge into an http response
90
- func writeBadge (label string , content string , color badge.Color , w http.ResponseWriter ) error {
90
+ // WriteBadge is a wrapper use to write a badge into an http response
91
+ func WriteBadge (label string , content string , color badge.Color , w http.ResponseWriter ) error {
91
92
w .Header ().Set ("content-type" , "image/svg+xml" )
92
93
return badge .Render (label , content , color , w )
93
94
}
0 commit comments