Skip to content

Instantly share code, notes, and snippets.

@jeasonstudio
Created February 10, 2017 07:48
Show Gist options
  • Save jeasonstudio/d5d7d13e40668ccd4ad4bdec4ca52c61 to your computer and use it in GitHub Desktop.
Save jeasonstudio/d5d7d13e40668ccd4ad4bdec4ca52c61 to your computer and use it in GitHub Desktop.
ColorFormat RGBA to Hexadecimal
package main
import (
"fmt"
"image"
"image/color"
)
func ColorFormat(color color.Color) string {
thisR, thisG, thisB, _ := color.RGBA()
return fmt.Sprintf("%.2x%.2x%.2x", uint8(thisR), uint8(thisG), uint8(thisB))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment