color

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2019 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FgBlack attr = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)
View Source
const (
	Purple = 35
	Blue   = 34
)

Variables

View Source
var (
	// 本行代码来自github.com/fatih/color, 感谢fatih的付出
	NoColor = os.Getenv("TERM") == "dumb" ||
		(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
)

Functions

This section is empty.

Types

type BodyType

type BodyType int
const (
	JsonType BodyType = iota + 1
	XmlType
	YamlType
	TxtType
)

type Color

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

func New

func New(openColor bool, c ...attr) *Color

func (*Color) Sbluef

func (c *Color) Sbluef(format string, a ...interface{}) string

func (*Color) Spurple added in v0.0.4

func (c *Color) Spurple(a ...interface{}) string

func (*Color) Spurplef added in v0.0.4

func (c *Color) Spurplef(format string, a ...interface{}) string

type Formatter

type Formatter struct {
	KeyColor        *Color // 设置key的颜色
	StringColor     *Color // 设置string的颜色
	BoolColor       *Color // 设置bool的颜色
	NumberColor     *Color // 设置数字的颜色
	NullColor       *Color // 设置null的颜色
	StringMaxLength int
	Indent          int
	DisabledColor   bool
	RawStrings      bool
	// contains filtered or unexported fields
}

func NewFormatEncoder

func NewFormatEncoder(r io.Reader, openColor bool, bodyType BodyType) *Formatter

func (*Formatter) Marshal

func (f *Formatter) Marshal(jsonObj interface{}) ([]byte, error)

func (*Formatter) Read

func (f *Formatter) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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