Documentation ¶
Index ¶
- Variables
- func ByteToInt(Input []byte) int
- func Contains(s []string, e string) bool
- func HexToName(HexValue string, Spec string) string
- func HexToRGB(HexValue string) []int
- func HexToRGBPercent(HexValue string) []string
- func NameToRGB(Name string, Spec string) []int
- func NameToRGBPercent(Name string, Spec string) []string
- func NamesToHex(Name string, Spec string) string
- func NormalizeHex(HexValue string) string
- func NormalizeIntegerRGB(Value int) int
- func NormalizeIntegerTriplet(RGBTriplet []int) []int
- func NormalizePercentRGB(Value string) string
- func NormalizePercentTriplet(RGBTriplet []string) []string
- func PercentToInteger(Percent string) int
- func RGBPercentToHex(RGBPercentTriplet []string) string
- func RGBPercentToName(RGBPercentTriplet []string, Spec string) string
- func RGBPercentToRGB(RGBPercentTriplet []string) []int
- func RGBToHex(RGBTriplet []int) string
- func RGBToName(RGBTriplet []int, Spec string) string
- func RGBToRGBPercent(RGBTriplet []int) []string
- func ReverseMap(m map[string]string) map[string]string
Constants ¶
This section is empty.
Variables ¶
var CSS21HexToNames = ReverseMap(CSS21NamesToHex)
var CSS21NamesToHex = HTML4NamesToHex
var CSS2HexToNames = HTML4HexToNames
var CSS2NamesToHex = HTML4NamesToHex
var CSS3HexToNames = ReverseMap(CSS3NamesToHex)
var CSS3NamesToHex = map[string]string{}/* 147 elements not displayed */
var HTML4HexToNames = ReverseMap(HTML4NamesToHex)
var HTML4NamesToHex = map[string]string{
"aqua": "#00ffff",
"black": "#000000",
"blue": "#0000ff",
"fuchsia": "#ff00ff",
"green": "#008000",
"grey": "#808080",
"lime": "#00ff00",
"maroon": "#800000",
"navy": "#000080",
"olive": "#808000",
"purple": "#800080",
"red": "#ff0000",
"silver": "#c0c0c0",
"teal": "#008080",
"white": "#ffffff",
"yellow": "#ffff00",
"orange": "#ffa500",
}
var HexColorRegex = regexp.MustCompile(`^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$`)
var SupportedSpecifications = []string{"html4", "css2", "css21", "css3"}
Functions ¶
func HexToName ¶
Convert a hexadecimal color value to its corresponding normalized color name, if any such name exists
func HexToRGB ¶
Convert a hexadecimal color value to a 3-tuple of integers suitable for use in an rgb triplet specifying that color
func HexToRGBPercent ¶
Convert a hexadecimal color value to a 3-tuple of percentages suitable for use in an rgb triplet representing that color
func NameToRGB ¶
Convert a color name to a 3-tuple of integers suitable for use in an rgb triplet specifying that color
func NameToRGBPercent ¶
Convert a color name to a 3-tuple of percentages suitable for use in an rgb triplet specifying that color
func NamesToHex ¶
Convert a color name to a normalized hexadecimal color value
func NormalizeIntegerRGB ¶
Normalize value for use in an integer rgb triplet
func NormalizeIntegerTriplet ¶
Normalize an integer rgb triplet so that all values are within the range 0-255 inclusive.
func NormalizePercentRGB ¶
Normalize value for use in a percentage rgb triplet
func NormalizePercentTriplet ¶
Normalize a percentage rgb triplet to that all values are within the range 0%-100% inclusive.
func PercentToInteger ¶
Internal helper for converting a percentage value to an integer between 0 and 255 inclusive
func RGBPercentToHex ¶
Convert a 3-tuple of percentages, suitable for use in an rgb color triplet, to a normalized hexadecimal color value for that color
func RGBPercentToName ¶
Convert a 3-tuple of percentages, suitable for use in an rgb color triplet, to its corresponding normalized color name, if any such name exists
func RGBPercentToRGB ¶
Convert a 3-tuple of percentages, suitable for use in an rgb color triplet, to a 3-tuple of integers suitable for use in representing that color
func RGBToHex ¶
Convert a 3-tuple of integers, suitable for use in an rgb color triplet, to a normalized hexadecimal value for that color
func RGBToName ¶
Convert a 3-tuple of integers, suitable for use in an rgb color triplet, to its corresponding normalized color name, if any such name exists
func RGBToRGBPercent ¶
Convert a 3-tuple of integers, suitable for use in an rgb color triplet, to a 3-tuple of percentages suitable for use in representing that color
Types ¶
This section is empty.