mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Lint/issue &mail (#243)
* Lint models/release.go * Lint models/ issue_label, issue_mail & mail.go
This commit is contained in:
parent
081c2a9395
commit
c0ca6644ad
4 changed files with 35 additions and 27 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue