2017-04-13 13:49:51 +00:00
|
|
|
package style
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/fatih/color"
|
|
|
|
)
|
|
|
|
|
|
|
|
type colorBase color.Attribute
|
|
|
|
|
|
|
|
func (s colorBase) Regular(a ...interface{}) string {
|
|
|
|
return color.New(color.Attribute(s)).Sprint(a...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s colorBase) Bold(a ...interface{}) string {
|
|
|
|
return color.New(color.Attribute(s), color.Bold).Sprint(a...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// allowed colors
|
|
|
|
var (
|
|
|
|
Red = colorBase(color.FgRed)
|
|
|
|
Blue = colorBase(color.FgBlue)
|
|
|
|
Yellow = colorBase(color.FgYellow)
|
|
|
|
Magenta = colorBase(color.FgMagenta)
|
|
|
|
Green = colorBase(color.FgGreen)
|
|
|
|
)
|
2017-08-31 06:58:04 +00:00
|
|
|
|
|
|
|
// Output defines the standard output of the print functions. By default, os.Stdout is used.
|
|
|
|
// When invoked on Windows machines, this automatically handles escape sequences.
|
|
|
|
var Output = color.Output
|