package internal import ( "fmt" "image/color" "strconv" ) // format bytes func FormatBytes(bytes int64) string { value := float64(bytes) unit := "bytes" if bytes > 1000000 { value = value / 1000000 unit = "mega" + unit } else if bytes > 1000 { value = value / 1000 unit = "kilo" + unit } return strconv.FormatFloat(value, 'f', 2, 64) + " " + unit } // parse rgb color values to a hex hex func RgbToHex(color color.Color) string { r, g, b, _ := color.RGBA() return fmt.Sprintf("#%02x%02x%02x", uint8(r>>8), uint8(g>>8), uint8(b>>8)) }