Colours in the package are represented in 24 bits (8 bits for each plane R, G and B). In order to construct a colour use a defined color from the color package. For example,
In this example all predefined "Red" colors are returned by the Palette function and then the name and hash of the color is output.
The data.Color type
TODO
// HashString returns an RGB hash for a colorfuncHashString(color data.Color) string {// String returns a named color or a hash otherwisefuncString(color data.Color) string {// Name returns the name of a color or hash otherwisefuncName(color data.Color) string {// Palette returns colors in palette which adhere to a given// set of swatchesfuncPalette(data.ColorSwatch) []data.Color {// Distance returns the distance between two colorsfuncDistance(x, y data.Color) float32 {// Nearest returns a color from the provided palette which is// nearest to the provided color. If the palette is nil then// all colors in the palettefuncNearest(c data.Color, palette []data.Color) data.Color {// CMYK converts a color to a CMYK quadruplefuncCMYK(c data.Color) color.CMYK {// YCbCr converts an RGB triple to a Y'CbCr triplefuncYCbCr(c data.Color) color.YCbCr {