Created
February 10, 2017 07:48
-
-
Save jeasonstudio/d5d7d13e40668ccd4ad4bdec4ca52c61 to your computer and use it in GitHub Desktop.
ColorFormat RGBA to Hexadecimal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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