Documentation ¶
Overview ¶
Package colorx contains color utilities. It means to be a complement to the standard image/color package.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseHexColor ¶
ParseHexColor parses a web color given by its hex RGB format. See https://en.wikipedia.org/wiki/Web_colors for input format.
For details, see https://stackoverflow.com/a/54200713/1705598
Example ¶
ExampleParseHexColor shows how to use the ParseHexColor() function.
hexCols := []string{ "#112233", "#123", "#000233", "#023", "#bAC", "invalid", "#abcd", "#-12", } for _, hc := range hexCols { c, err := ParseHexColor(hc) fmt.Printf("%-7s = %3v, %v\n", hc, c, err) }
Output: #112233 = { 17 34 51 255}, <nil> #123 = { 17 34 51 255}, <nil> #000233 = { 0 2 51 255}, <nil> #023 = { 0 34 51 255}, <nil> #bAC = {187 170 204 255}, <nil> invalid = { 0 0 0 0}, invalid format #abcd = { 0 0 0 255}, invalid format #-12 = { 0 17 34 255}, invalid format
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.