123456789101112131415 |
- package main
- import "fmt"
- func uintToHex(v uint32) string {
- r := fmt.Sprintf("%X", v)
- if len(r) >= 2 {
- return r[0:2]
- }
- return r
- }
- func rgbToHex(r, g, b uint32) string {
- return fmt.Sprintf("%s%s%s", uintToHex(r), uintToHex(g), uintToHex(b))
- }
|