Skip to content

Commit

Permalink
fix: fix slice init length
Browse files Browse the repository at this point in the history
  • Loading branch information
cuishuang authored Oct 4, 2024
1 parent fedc174 commit 7758b4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func Rgb2hex(rgb []int) string { return RgbToHex(rgb) }
//
// hex := RgbToHex([]int{170, 187, 204}) // hex: "aabbcc"
func RgbToHex(rgb []int) string {
hexNodes := make([]string, len(rgb))
hexNodes := make([]string, 0, len(rgb))

for _, v := range rgb {
hexNodes = append(hexNodes, strconv.FormatInt(int64(v), 16))
Expand Down

0 comments on commit 7758b4f

Please sign in to comment.