Skip to content

Commit

Permalink
Update avatar.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor-Lan committed Aug 24, 2022
1 parent 0943043 commit 67a6aec
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion common/utils/avatar.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (

func AvatarUrl() string {
url := fmt.Sprintf(
"https://avataaars.io/?accessoriesType=%s&avatarStyle=%s&clotheType=%s&eyeType=%s&eyebrowType=%s&facialHairColor=%s&facialHairType=%s&hairColor=%s&hatColor=%s&mouthType=%s&skinColor=%s&topType=%s",
"https://avataaars.io/?clotheColor=%s&accessoriesType=%s&avatarStyle=%s&clotheType=%s&eyeType=%s&eyebrowType=%s&facialHairColor=%s&facialHairType=%s&hairColor=%s&hatColor=%s&mouthType=%s&skinColor=%s&topType=%s",
clotheColor(),
accessoriesType(),
avatarStyle(),
clotheType(),
Expand All @@ -24,6 +25,26 @@ func AvatarUrl() string {
return url
}

func clotheColor() string {
clotheColor := make(map[int]string, 0)
clotheColor[0] = "Black"
clotheColor[1] = "Blue01"
clotheColor[2] = "Blue02"
clotheColor[3] = "Blue03"
clotheColor[4] = "Gray01"
clotheColor[5] = "Gray02"
clotheColor[6] = "Heather"
clotheColor[7] = "PastelBlue"
clotheColor[8] = "PastelGreen"
clotheColor[9] = "PastelOrange"
clotheColor[10] = "PastelRed"
clotheColor[11] = "PastelYellow"
clotheColor[12] = "Pink"
clotheColor[13] = "Red"
clotheColor[14] = "White"
return clotheColor[rand.Intn(15)]
}

func accessoriesType() string {
accessoriesType := make(map[int]string, 0)
accessoriesType[0] = "Blank"
Expand Down

0 comments on commit 67a6aec

Please sign in to comment.