summaryrefslogtreecommitdiffstats
path: root/models/issue_label.go
diff options
context:
space:
mode:
authorBwko <bouwko@gmail.com>2016-11-25 09:11:12 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2016-11-25 16:11:12 +0800
commitc0ca6644ade5ce21d8c7601439d94ea1fed7443d (patch)
tree1499afb6db12488a8ce1df8708717f46eb6e89b6 /models/issue_label.go
parent081c2a9395706e24bb396bf2aa9ac8a92d0a8f40 (diff)
downloadgitea-c0ca6644ade5ce21d8c7601439d94ea1fed7443d.tar.gz
gitea-c0ca6644ade5ce21d8c7601439d94ea1fed7443d.zip
Lint/issue &mail (#243)
* Lint models/release.go * Lint models/ issue_label, issue_mail & mail.go
Diffstat (limited to 'models/issue_label.go')
-rw-r--r--models/issue_label.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/models/issue_label.go b/models/issue_label.go
index 3eed8ed985..befe3f192a 100644
--- a/models/issue_label.go
+++ b/models/issue_label.go
@@ -62,6 +62,7 @@ type Label struct {
IsChecked bool `xorm:"-"`
}
+// APIFormat converts a Label to the api.Label format
func (label *Label) APIFormat() *api.Label {
return &api.Label{
ID: label.ID,
@@ -77,9 +78,9 @@ func (label *Label) CalOpenIssues() {
// ForegroundColor calculates the text color for labels based
// on their background color.
-func (l *Label) ForegroundColor() template.CSS {
- if strings.HasPrefix(l.Color, "#") {
- if color, err := strconv.ParseUint(l.Color[1:], 16, 64); err == nil {
+func (label *Label) ForegroundColor() template.CSS {
+ if strings.HasPrefix(label.Color, "#") {
+ if color, err := strconv.ParseUint(label.Color[1:], 16, 64); err == nil {
r := float32(0xFF & (color >> 16))
g := float32(0xFF & (color >> 8))
b := float32(0xFF & color)