color

package
v6.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Blk Black text style
	Blk = "30"
	// Rd red text style
	Rd = "31"
	// Grn green text style
	Grn = "32"
	// Yel yellow text style
	Yel = "33"
	// Blu blue text style
	Blu = "34"
	// Mgn magenta text style
	Mgn = "35"
	// Cyn cyan text style
	Cyn = "36"
	// Wht white text style
	Wht = "37"
	// Gry grey text style
	Gry = "90"

	// BlkBg black background style
	BlkBg = "40"
	// RdBg red background style
	RdBg = "41"
	// GrnBg green background style
	GrnBg = "42"
	// YelBg yellow background style
	YelBg = "43"
	// BluBg blue background style
	BluBg = "44"
	// MgnBg magenta background style
	MgnBg = "45"
	// CynBg cyan background style
	CynBg = "46"
	// WhtBg white background style
	WhtBg = "47"

	// R reset emphasis style
	R = "0"
	// B bold emphasis style
	B = "1"
	// D dim emphasis style
	D = "2"
	// I italic emphasis style
	I = "3"
	// U underline emphasis style
	U = "4"
	// In inverse emphasis style
	In = "7"
	// H hidden emphasis style
	H = "8"
	// S strikeout emphasis style
	S = "9"
)

Color styles

Variables

View Source
var (
	Stdout = NewColorableStdout()
	Stderr = NewColorableStderr()
)

Stdout, Stderr are open Files pointing to colorful standard output and colorful standard error file descriptors.

Functions

func Black

func Black(msg interface{}, styles ...string) string

func BlackBg

func BlackBg(msg interface{}, styles ...string) string

func Blue

func Blue(msg interface{}, styles ...string) string

func BlueBg

func BlueBg(msg interface{}, styles ...string) string

func Bold

func Bold(msg interface{}, styles ...string) string

func Cyan

func Cyan(msg interface{}, styles ...string) string

func CyanBg

func CyanBg(msg interface{}, styles ...string) string

func Dim

func Dim(msg interface{}, styles ...string) string

func Disable

func Disable()

func Enable

func Enable()

func Green

func Green(msg interface{}, styles ...string) string

func GreenBg

func GreenBg(msg interface{}, styles ...string) string

func Grey

func Grey(msg interface{}, styles ...string) string

func Hidden

func Hidden(msg interface{}, styles ...string) string

func Inverse

func Inverse(msg interface{}, styles ...string) string

func IsTerminal

func IsTerminal(fd uintptr) bool

IsTerminal return true if the file descriptor is terminal.

func Italic

func Italic(msg interface{}, styles ...string) string

func Magenta

func Magenta(msg interface{}, styles ...string) string

func MagentaBg

func MagentaBg(msg interface{}, styles ...string) string

func NewColorable

func NewColorable(file *os.File) io.Writer

func NewColorableStderr

func NewColorableStderr() io.Writer

func NewColorableStdout

func NewColorableStdout() io.Writer

func Red

func Red(msg interface{}, styles ...string) string

func RedBg

func RedBg(msg interface{}, styles ...string) string

func Reset

func Reset(msg interface{}, styles ...string) string

func Strikeout

func Strikeout(msg interface{}, styles ...string) string

func Underline

func Underline(msg interface{}, styles ...string) string

func White

func White(msg interface{}, styles ...string) string

func WhiteBg

func WhiteBg(msg interface{}, styles ...string) string

func Yellow

func Yellow(msg interface{}, styles ...string) string

func YellowBg

func YellowBg(msg interface{}, styles ...string) string

Types

type Color

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

func New

func New() *Color

New creates a Color instance.

func (*Color) Black

func (c *Color) Black(msg interface{}, styles ...string) string

func (*Color) BlackBg

func (c *Color) BlackBg(msg interface{}, styles ...string) string

func (*Color) Blue

func (c *Color) Blue(msg interface{}, styles ...string) string

func (*Color) BlueBg

func (c *Color) BlueBg(msg interface{}, styles ...string) string

func (*Color) Bold

func (c *Color) Bold(msg interface{}, styles ...string) string

func (*Color) Cyan

func (c *Color) Cyan(msg interface{}, styles ...string) string

func (*Color) CyanBg

func (c *Color) CyanBg(msg interface{}, styles ...string) string

func (*Color) Dim

func (c *Color) Dim(msg interface{}, styles ...string) string

func (*Color) Disable

func (c *Color) Disable()

Disable disables the colors and styles.

func (*Color) Enable

func (c *Color) Enable()

Enable enables the colors and styles.

func (*Color) Green

func (c *Color) Green(msg interface{}, styles ...string) string

func (*Color) GreenBg

func (c *Color) GreenBg(msg interface{}, styles ...string) string

func (*Color) Grey

func (c *Color) Grey(msg interface{}, styles ...string) string

func (*Color) Hidden

func (c *Color) Hidden(msg interface{}, styles ...string) string

func (*Color) Inverse

func (c *Color) Inverse(msg interface{}, styles ...string) string

func (*Color) Italic

func (c *Color) Italic(msg interface{}, styles ...string) string

func (*Color) Magenta

func (c *Color) Magenta(msg interface{}, styles ...string) string

func (*Color) MagentaBg

func (c *Color) MagentaBg(msg interface{}, styles ...string) string

func (*Color) Red

func (c *Color) Red(msg interface{}, styles ...string) string

func (*Color) RedBg

func (c *Color) RedBg(msg interface{}, styles ...string) string

func (*Color) Reset

func (c *Color) Reset(msg interface{}, styles ...string) string

func (*Color) Strikeout

func (c *Color) Strikeout(msg interface{}, styles ...string) string

func (*Color) Underline

func (c *Color) Underline(msg interface{}, styles ...string) string

func (*Color) White

func (c *Color) White(msg interface{}, styles ...string) string

func (*Color) WhiteBg

func (c *Color) WhiteBg(msg interface{}, styles ...string) string

func (*Color) Yellow

func (c *Color) Yellow(msg interface{}, styles ...string) string

func (*Color) YellowBg

func (c *Color) YellowBg(msg interface{}, styles ...string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL