diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/fatih/color/color.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/fatih/color/color.go | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/Godeps/_workspace/src/github.com/fatih/color/color.go b/Godeps/_workspace/src/github.com/fatih/color/color.go index c4a10c3c8..e3e997284 100644 --- a/Godeps/_workspace/src/github.com/fatih/color/color.go +++ b/Godeps/_workspace/src/github.com/fatih/color/color.go @@ -6,8 +6,8 @@ import ( "strconv" "strings" + "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" - "github.com/shiena/ansicolor" ) // NoColor defines if the output is colorized or not. It's dynamically set to @@ -53,6 +53,18 @@ const ( FgWhite ) +// Foreground Hi-Intensity text colors +const ( + FgHiBlack Attribute = iota + 90 + FgHiRed + FgHiGreen + FgHiYellow + FgHiBlue + FgHiMagenta + FgHiCyan + FgHiWhite +) + // Background text colors const ( BgBlack Attribute = iota + 40 @@ -65,6 +77,18 @@ const ( BgWhite ) +// Background Hi-Intensity text colors +const ( + BgHiBlack Attribute = iota + 100 + BgHiRed + BgHiGreen + BgHiYellow + BgHiBlue + BgHiMagenta + BgHiCyan + BgHiWhite +) + // New returns a newly created color object. func New(value ...Attribute) *Color { c := &Color{params: make([]Attribute, 0)} @@ -123,7 +147,7 @@ func (c *Color) prepend(value Attribute) { // Output defines the standard output of the print functions. By default // os.Stdout is used. -var Output = ansicolor.NewAnsiColorWriter(os.Stdout) +var Output = colorable.NewColorableStdout() // Print formats using the default formats for its operands and writes to // standard output. Spaces are added between operands when neither is a @@ -259,6 +283,31 @@ func (c *Color) isNoColorSet() bool { return NoColor } +// Equals returns a boolean value indicating whether two colors are equal. +func (c *Color) Equals(c2 *Color) bool { + if len(c.params) != len(c2.params) { + return false + } + + for _, attr := range c.params { + if !c2.attrExists(attr) { + return false + } + } + + return true +} + +func (c *Color) attrExists(a Attribute) bool { + for _, attr := range c.params { + if attr == a { + return true + } + } + + return false +} + func boolPtr(v bool) *bool { return &v } |