...
Documentation
Documentation

# Package color

## Overview ▹

## Overview ▾

Package color provides color handling structures and functions for use across all of the document types.

## Index ▹

## Index ▾

### Package files

color.go doc.go hex.go map.go names.go

## Variables

    var AliceBlue = Color{0xF0, 0xF8, 0xFF, 255, false}

    var AntiqueWhite = Color{0xFA, 0xEB, 0xD7, 255, false}

    var Aqua = Color{0x00, 0xFF, 0xFF, 255, false}

    var Aquamarine = Color{0x7F, 0xFF, 0xD4, 255, false}

Auto translates to an 'auto' tag in places where it's legal.

    var Auto = Color{0, 0, 0, 255, true}

    var Azure = Color{0xF0, 0xFF, 0xFF, 255, false}

    var Beige = Color{0xF5, 0xF5, 0xDC, 255, false}

    var Bisque = Color{0xFF, 0xE4, 0xC4, 255, false}

    var Black = Color{0x00, 0x00, 0x00, 255, false}

    var BlanchedAlmond = Color{0xFF, 0xEB, 0xCD, 255, false}

    var Blue = Color{0x00, 0x00, 0xFF, 255, false}

    var BlueViolet = Color{0x8A, 0x2B, 0xE2, 255, false}

    var Brown = Color{0xA5, 0x2A, 0x2A, 255, false}

    var BurlyWood = Color{0xDE, 0xB8, 0x87, 255, false}

    var CadetBlue = Color{0x5F, 0x9E, 0xA0, 255, false}

    var Chartreuse = Color{0x7F, 0xFF, 0x00, 255, false}

    var Chocolate = Color{0xD2, 0x69, 0x1E, 255, false}

ColorMap is a map of color names to Color values defined in the names.go file.

    var ColorMap = map[string]Color{
        "aliceblue":            AliceBlue,
        "antiquewhite":         AntiqueWhite,
        "aqua":                 Aqua,
        "aquamarine":           Aquamarine,
        "azure":                Azure,
        "beige":                Beige,
        "bisque":               Bisque,
        "black":                Black,
        "blanchedalmond":       BlanchedAlmond,
        "blue":                 Blue,
        "blueviolet":           BlueViolet,
        "brown":                Brown,
        "burlywood":            BurlyWood,
        "cadetblue":            CadetBlue,
        "chartreuse":           Chartreuse,
        "chocolate":            Chocolate,
        "coral":                Coral,
        "cornflowerblue":       CornflowerBlue,
        "cornsilk":             Cornsilk,
        "crimson":              Crimson,
        "cyan":                 Cyan,
        "darkblue":             DarkBlue,
        "darkcyan":             DarkCyan,
        "darkgoldenrod":        DarkGoldenRod,
        "darkgray":             DarkGray,
        "darkgrey":             DarkGrey,
        "darkgreen":            DarkGreen,
        "darkkhaki":            DarkKhaki,
        "darkmagenta":          DarkMagenta,
        "darkolivegreen":       DarkOliveGreen,
        "darkorange":           DarkOrange,
        "darkorchid":           DarkOrchid,
        "darkred":              DarkRed,
        "darksalmon":           DarkSalmon,
        "darkseagreen":         DarkSeaGreen,
        "darkslateblue":        DarkSlateBlue,
        "darkslategray":        DarkSlateGray,
        "darkslategrey":        DarkSlateGrey,
        "darkturquoise":        DarkTurquoise,
        "darkviolet":           DarkViolet,
        "deeppink":             DeepPink,
        "deepskyblue":          DeepSkyBlue,
        "dimgray":              DimGray,
        "dimgrey":              DimGrey,
        "dodgerblue":           DodgerBlue,
        "firebrick":            FireBrick,
        "floralwhite":          FloralWhite,
        "forestgreen":          ForestGreen,
        "fuchsia":              Fuchsia,
        "gainsboro":            Gainsboro,
        "ghostwhite":           GhostWhite,
        "gold":                 Gold,
        "goldenrod":            GoldenRod,
        "gray":                 Gray,
        "green":                Green,
        "greenyellow":          GreenYellow,
        "honeydew":             HoneyDew,
        "hotpink":              HotPink,
        "indianred":            IndianRed,
        "indigo":               Indigo,
        "ivory":                Ivory,
        "khaki":                Khaki,
        "lavender":             Lavender,
        "lavenderblush":        LavenderBlush,
        "lawngreen":            LawnGreen,
        "lemonchiffon":         LemonChiffon,
        "lightblue":            LightBlue,
        "lightcoral":           LightCoral,
        "lightcyan":            LightCyan,
        "lightgoldenrodyellow": LightGoldenRodYellow,
        "lightgray":            LightGray,
        "lightgrey":            LightGrey,
        "lightgreen":           LightGreen,
        "lightpink":            LightPink,
        "lightsalmon":          LightSalmon,
        "lightseagreen":        LightSeaGreen,
        "lightskyblue":         LightSkyBlue,
        "lightslategray":       LightSlateGray,
        "lightslategrey":       LightSlateGrey,
        "lightsteelblue":       LightSteelBlue,
        "lightyellow":          LightYellow,
        "lime":                 Lime,
        "limegreen":            LimeGreen,
        "linen":                Linen,
        "magenta":              Magenta,
        "maroon":               Maroon,
        "mediumaquamarine":     MediumAquaMarine,
        "mediumblue":           MediumBlue,
        "mediumorchid":         MediumOrchid,
        "mediumpurple":         MediumPurple,
        "mediumseagreen":       MediumSeaGreen,
        "mediumslateblue":      MediumSlateBlue,
        "mediumspringgreen":    MediumSpringGreen,
        "mediumturquoise":      MediumTurquoise,
        "mediumvioletred":      MediumVioletRed,
        "midnightblue":         MidnightBlue,
        "mintcream":            MintCream,
        "mistyrose":            MistyRose,
        "moccasin":             Moccasin,
        "navajowhite":          NavajoWhite,
        "navy":                 Navy,
        "oldlace":              OldLace,
        "olive":                Olive,
        "olivedrab":            OliveDrab,
        "orange":               Orange,
        "orangered":            OrangeRed,
        "orchid":               Orchid,
        "palegoldenrod":        PaleGoldenRod,
        "palegreen":            PaleGreen,
        "paleturquoise":        PaleTurquoise,
        "palevioletred":        PaleVioletRed,
        "papayawhip":           PapayaWhip,
        "peachpuff":            PeachPuff,
        "peru":                 Peru,
        "pink":                 Pink,
        "plum":                 Plum,
        "powderblue":           PowderBlue,
        "purple":               Purple,
        "rebeccapurple":        RebeccaPurple,
        "red":                  Red,
        "rosybrown":            RosyBrown,
        "royalblue":            RoyalBlue,
        "saddlebrown":          SaddleBrown,
        "salmon":               Salmon,
        "sandybrown":           SandyBrown,
        "successgreen":         SuccessGreen,
        "seagreen":             SeaGreen,
        "seashell":             SeaShell,
        "sienna":               Sienna,
        "silver":               Silver,
        "skyblue":              SkyBlue,
        "slateblue":            SlateBlue,
        "slategray":            SlateGray,
        "slategrey":            SlateGrey,
        "snow":                 Snow,
        "springgreen":          SpringGreen,
        "steelblue":            SteelBlue,
        "tan":                  Tan,
        "teal":                 Teal,
        "thistle":              Thistle,
        "tomato":               Tomato,
        "turquoise":            Turquoise,
        "violet":               Violet,
        "wheat":                Wheat,
        "white":                White,
        "whitesmoke":           WhiteSmoke,
        "yellow":               Yellow,
        "yellowgreen":          YellowGreen,
    }

    var Coral = Color{0xFF, 0x7F, 0x50, 255, false}

    var CornflowerBlue = Color{0x64, 0x95, 0xED, 255, false}

    var Cornsilk = Color{0xFF, 0xF8, 0xDC, 255, false}

    var Crimson = Color{0xDC, 0x14, 0x3C, 255, false}

    var Cyan = Color{0x00, 0xFF, 0xFF, 255, false}

    var DarkBlue = Color{0x00, 0x00, 0x8B, 255, false}

    var DarkCyan = Color{0x00, 0x8B, 0x8B, 255, false}

    var DarkGoldenRod = Color{0xB8, 0x86, 0x0B, 255, false}

    var DarkGray = Color{0xA9, 0xA9, 0xA9, 255, false}

    var DarkGreen = Color{0x00, 0x64, 0x00, 255, false}

    var DarkGrey = Color{0xA9, 0xA9, 0xA9, 255, false}

    var DarkKhaki = Color{0xBD, 0xB7, 0x6B, 255, false}

    var DarkMagenta = Color{0x8B, 0x00, 0x8B, 255, false}

    var DarkOliveGreen = Color{0x55, 0x6B, 0x2F, 255, false}

    var DarkOrange = Color{0xFF, 0x8C, 0x00, 255, false}

    var DarkOrchid = Color{0x99, 0x32, 0xCC, 255, false}

    var DarkRed = Color{0x8B, 0x00, 0x00, 255, false}

    var DarkSalmon = Color{0xE9, 0x96, 0x7A, 255, false}

    var DarkSeaGreen = Color{0x8F, 0xBC, 0x8F, 255, false}

    var DarkSlateBlue = Color{0x48, 0x3D, 0x8B, 255, false}

    var DarkSlateGray = Color{0x2F, 0x4F, 0x4F, 255, false}

    var DarkSlateGrey = Color{0x2F, 0x4F, 0x4F, 255, false}

    var DarkTurquoise = Color{0x00, 0xCE, 0xD1, 255, false}

    var DarkViolet = Color{0x94, 0x00, 0xD3, 255, false}

    var DeepPink = Color{0xFF, 0x14, 0x93, 255, false}

    var DeepSkyBlue = Color{0x00, 0xBF, 0xFF, 255, false}

    var DimGray = Color{0x69, 0x69, 0x69, 255, false}

    var DimGrey = Color{0x69, 0x69, 0x69, 255, false}

    var DodgerBlue = Color{0x1E, 0x90, 0xFF, 255, false}

    var FireBrick = Color{0xB2, 0x22, 0x22, 255, false}

    var FloralWhite = Color{0xFF, 0xFA, 0xF0, 255, false}

    var ForestGreen = Color{0x22, 0x8B, 0x22, 255, false}

    var Fuchsia = Color{0xFF, 0x00, 0xFF, 255, false}

    var Gainsboro = Color{0xDC, 0xDC, 0xDC, 255, false}

    var GhostWhite = Color{0xF8, 0xF8, 0xFF, 255, false}

    var Gold = Color{0xFF, 0xD7, 0x00, 255, false}

    var GoldenRod = Color{0xDA, 0xA5, 0x20, 255, false}

    var Gray = Color{0x80, 0x80, 0x80, 255, false}

    var Green = Color{0x00, 0x80, 0x00, 255, false}

    var GreenYellow = Color{0xAD, 0xFF, 0x2F, 255, false}

HighlightColorMap is a map of color names to ST_HighlightColor values which mainly used in text highlighting.

    var HighlightColorMap = map[string]wml.ST_HighlightColor{
        "black":       wml.ST_HighlightColorBlack,
        "blue":        wml.ST_HighlightColorBlue,
        "cyan":        wml.ST_HighlightColorCyan,
        "green":       wml.ST_HighlightColorGreen,
        "magenta":     wml.ST_HighlightColorMagenta,
        "red":         wml.ST_HighlightColorRed,
        "yellow":      wml.ST_HighlightColorYellow,
        "white":       wml.ST_HighlightColorWhite,
        "darkBlue":    wml.ST_HighlightColorDarkBlue,
        "darkCyan":    wml.ST_HighlightColorDarkCyan,
        "darkGreen":   wml.ST_HighlightColorDarkGreen,
        "darkMagenta": wml.ST_HighlightColorDarkMagenta,
        "darkRed":     wml.ST_HighlightColorDarkRed,
        "darkYellow":  wml.ST_HighlightColorDarkYellow,
        "lightGray":   wml.ST_HighlightColorLightGray,
        "darkGray":    wml.ST_HighlightColorDarkGray,
    }

HighlightColorToCreatorColorMap maps ST_HighlightColor values to creator.Color values.

    var HighlightColorToCreatorColorMap = map[wml.ST_HighlightColor]creator.Color{
        wml.ST_HighlightColorBlack:       creator.ColorBlack,
        wml.ST_HighlightColorBlue:        creator.ColorBlue,
        wml.ST_HighlightColorCyan:        creator.ColorRGBFrom8bit(0, 255, 255),
        wml.ST_HighlightColorGreen:       creator.ColorGreen,
        wml.ST_HighlightColorMagenta:     creator.ColorRGBFrom8bit(255, 0, 255),
        wml.ST_HighlightColorRed:         creator.ColorRed,
        wml.ST_HighlightColorYellow:      creator.ColorYellow,
        wml.ST_HighlightColorWhite:       creator.ColorWhite,
        wml.ST_HighlightColorDarkBlue:    creator.ColorRGBFrom8bit(0, 0, 128),
        wml.ST_HighlightColorDarkCyan:    creator.ColorRGBFrom8bit(0, 128, 128),
        wml.ST_HighlightColorDarkGreen:   creator.ColorRGBFrom8bit(0, 128, 0),
        wml.ST_HighlightColorDarkMagenta: creator.ColorRGBFrom8bit(128, 0, 128),
        wml.ST_HighlightColorDarkRed:     creator.ColorRGBFrom8bit(128, 0, 0),
        wml.ST_HighlightColorDarkYellow:  creator.ColorRGBFrom8bit(255, 215, 0),
        wml.ST_HighlightColorLightGray:   creator.ColorRGBFrom8bit(211, 211, 211),
        wml.ST_HighlightColorDarkGray:    creator.ColorRGBFrom8bit(169, 169, 169),
    }

    var HoneyDew = Color{0xF0, 0xFF, 0xF0, 255, false}

    var HotPink = Color{0xFF, 0x69, 0xB4, 255, false}

    var IndianRed = Color{0xCD, 0x5C, 0x5C, 255, false}

    var Indigo = Color{0x4B, 0x00, 0x82, 255, false}

    var Ivory = Color{0xFF, 0xFF, 0xF0, 255, false}

    var Khaki = Color{0xF0, 0xE6, 0x8C, 255, false}

    var Lavender = Color{0xE6, 0xE6, 0xFA, 255, false}

    var LavenderBlush = Color{0xFF, 0xF0, 0xF5, 255, false}

    var LawnGreen = Color{0x7C, 0xFC, 0x00, 255, false}

    var LemonChiffon = Color{0xFF, 0xFA, 0xCD, 255, false}

    var LightBlue = Color{0xAD, 0xD8, 0xE6, 255, false}

    var LightCoral = Color{0xF0, 0x80, 0x80, 255, false}

    var LightCyan = Color{0xE0, 0xFF, 0xFF, 255, false}

    var LightGoldenRodYellow = Color{0xFA, 0xFA, 0xD2, 255, false}

    var LightGray = Color{0xD3, 0xD3, 0xD3, 255, false}

    var LightGreen = Color{0x90, 0xEE, 0x90, 255, false}

    var LightGrey = Color{0xD3, 0xD3, 0xD3, 255, false}

    var LightPink = Color{0xFF, 0xB6, 0xC1, 255, false}

    var LightSalmon = Color{0xFF, 0xA0, 0x7A, 255, false}

    var LightSeaGreen = Color{0x20, 0xB2, 0xAA, 255, false}

    var LightSkyBlue = Color{0x87, 0xCE, 0xFA, 255, false}

    var LightSlateGray = Color{0x77, 0x88, 0x99, 255, false}

    var LightSlateGrey = Color{0x77, 0x88, 0x99, 255, false}

    var LightSteelBlue = Color{0xB0, 0xC4, 0xDE, 255, false}

    var LightYellow = Color{0xFF, 0xFF, 0xE0, 255, false}

    var Lime = Color{0x00, 0xFF, 0x00, 255, false}

    var LimeGreen = Color{0x32, 0xCD, 0x32, 255, false}

    var Linen = Color{0xFA, 0xF0, 0xE6, 255, false}

    var Magenta = Color{0xFF, 0x00, 0xFF, 255, false}

    var Maroon = Color{0x80, 0x00, 0x00, 255, false}

    var MediumAquaMarine = Color{0x66, 0xCD, 0xAA, 255, false}

    var MediumBlue = Color{0x00, 0x00, 0xCD, 255, false}

    var MediumOrchid = Color{0xBA, 0x55, 0xD3, 255, false}

    var MediumPurple = Color{0x93, 0x70, 0xDB, 255, false}

    var MediumSeaGreen = Color{0x3C, 0xB3, 0x71, 255, false}

    var MediumSlateBlue = Color{0x7B, 0x68, 0xEE, 255, false}

    var MediumSpringGreen = Color{0x00, 0xFA, 0x9A, 255, false}

    var MediumTurquoise = Color{0x48, 0xD1, 0xCC, 255, false}

    var MediumVioletRed = Color{0xC7, 0x15, 0x85, 255, false}

    var MidnightBlue = Color{0x19, 0x19, 0x70, 255, false}

    var MintCream = Color{0xF5, 0xFF, 0xFA, 255, false}

    var MistyRose = Color{0xFF, 0xE4, 0xE1, 255, false}

    var Moccasin = Color{0xFF, 0xE4, 0xB5, 255, false}

    var NavajoWhite = Color{0xFF, 0xDE, 0xAD, 255, false}

    var Navy = Color{0x00, 0x00, 0x80, 255, false}

    var OldLace = Color{0xFD, 0xF5, 0xE6, 255, false}

    var Olive = Color{0x80, 0x80, 0x00, 255, false}

    var OliveDrab = Color{0x6B, 0x8E, 0x23, 255, false}

    var Orange = Color{0xFF, 0xA5, 0x00, 255, false}

    var OrangeRed = Color{0xFF, 0x45, 0x00, 255, false}

    var Orchid = Color{0xDA, 0x70, 0xD6, 255, false}

    var PaleGoldenRod = Color{0xEE, 0xE8, 0xAA, 255, false}

    var PaleGreen = Color{0x98, 0xFB, 0x98, 255, false}

    var PaleTurquoise = Color{0xAF, 0xEE, 0xEE, 255, false}

    var PaleVioletRed = Color{0xDB, 0x70, 0x93, 255, false}

    var PapayaWhip = Color{0xFF, 0xEF, 0xD5, 255, false}

    var PeachPuff = Color{0xFF, 0xDA, 0xB9, 255, false}

    var Peru = Color{0xCD, 0x85, 0x3F, 255, false}

    var Pink = Color{0xFF, 0xC0, 0xCB, 255, false}

    var Plum = Color{0xDD, 0xA0, 0xDD, 255, false}

    var PowderBlue = Color{0xB0, 0xE0, 0xE6, 255, false}

    var Purple = Color{0x80, 0x00, 0x80, 255, false}

    var RebeccaPurple = Color{0x66, 0x33, 0x99, 255, false}

    var Red = Color{0xFF, 0x00, 0x00, 255, false}

    var RosyBrown = Color{0xBC, 0x8F, 0x8F, 255, false}

    var RoyalBlue = Color{0x41, 0x69, 0xE1, 255, false}

    var SaddleBrown = Color{0x8B, 0x45, 0x13, 255, false}

    var Salmon = Color{0xFA, 0x80, 0x72, 255, false}

    var SandyBrown = Color{0xF4, 0xA4, 0x60, 255, false}

    var SeaGreen = Color{0x2E, 0x8B, 0x57, 255, false}

    var SeaShell = Color{0xFF, 0xF5, 0xEE, 255, false}

    var Sienna = Color{0xA0, 0x52, 0x2D, 255, false}

    var Silver = Color{0xC0, 0xC0, 0xC0, 255, false}

    var SkyBlue = Color{0x87, 0xCE, 0xEB, 255, false}

    var SlateBlue = Color{0x6A, 0x5A, 0xCD, 255, false}

    var SlateGray = Color{0x70, 0x80, 0x90, 255, false}

    var SlateGrey = Color{0x70, 0x80, 0x90, 255, false}

    var Snow = Color{0xFF, 0xFA, 0xFA, 255, false}

    var SpringGreen = Color{0x00, 0xFF, 0x7F, 255, false}

    var SteelBlue = Color{0x46, 0x82, 0xB4, 255, false}

    var SuccessGreen = Color{0x00, 0xCC, 0x00, 255, false}

    var Tan = Color{0xD2, 0xB4, 0x8C, 255, false}

    var Teal = Color{0x00, 0x80, 0x80, 255, false}

    var Thistle = Color{0xD8, 0xBF, 0xD8, 255, false}

    var Tomato = Color{0xFF, 0x63, 0x47, 255, false}

    var Turquoise = Color{0x40, 0xE0, 0xD0, 255, false}

    var Violet = Color{0xEE, 0x82, 0xEE, 255, false}

    var Wheat = Color{0xF5, 0xDE, 0xB3, 255, false}

    var White = Color{0xFF, 0xFF, 0xFF, 255, false}

    var WhiteSmoke = Color{0xF5, 0xF5, 0xF5, 255, false}

    var Yellow = Color{0xFF, 0xFF, 0x00, 255, false}

    var YellowGreen = Color{0x9A, 0xCD, 0x32, 255, false}

## type Color ¶

Color is a 24 bit color that can be converted to internal ECMA-376 formats as needed.

    type Color struct {
        // contains filtered or unexported fields
    }

### func FromHex ¶

    func FromHex(s string) Color

### func RGB ¶

    func RGB(r, g, b uint8) Color

RGB constructs a new RGB color with a given red, green and blue value.

### func RGBA ¶

    func RGBA(r, g, b, a uint8) Color

RGBA constructs a new RGBA color with a given red, green, blue and alpha value.

### func (Color) AsRGBAString ¶

    func (c Color) AsRGBAString() *string

AsRGBAString is used by the various wrappers to return a pointer to a string containing a six digit hex RGB value.

### func (Color) AsRGBString ¶

    func (c Color) AsRGBString() *string

AsRGBString is used by the various wrappers to return a pointer to a string containing a six digit hex RGB value.

### func (Color) IsAuto ¶

    func (c Color) IsAuto() bool

IsAuto returns true if the color is the 'Auto' type. If the field doesn't support an Auto color, then black is used.