fic: Pick HSL function to generate random colors
This commit is contained in:
parent
6395eaaf5f
commit
63de5d64b1
3 changed files with 60 additions and 1 deletions
|
@ -3,6 +3,7 @@ package api
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -155,6 +156,10 @@ func createTeam(_ httprouter.Params, body []byte) (interface{}, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if ut.Color == 0 {
|
||||
ut.Color = fic.HSL{rand.Float64(), 1, 0.5}.ToRGB()
|
||||
}
|
||||
|
||||
return fic.CreateTeam(strings.TrimSpace(ut.Name), ut.Color, ut.ExternalId)
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue