style

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(str string, formats ...string) string

Types

type Color

type Color int
const (
	Black Color = iota
	Red
	Green
	Yellow
	Blue
	Majenta
	Cyan
	White

	Light      Color = 1 << 3
	Background Color = 1 << 4
	None       Color = -1
)

func BgColor

func BgColor(name string) Color

func BgDarkColor

func BgDarkColor(name string) Color

func BgLightColor

func BgLightColor(name string) Color

func ColorOf

func ColorOf(name string) Color

func FgColor

func FgColor(name string) Color

func FgDarkColor

func FgDarkColor(name string) Color

func FgLightColor

func FgLightColor(name string) Color

func (Color) Base

func (c Color) Base() int

func (Color) IsBackground

func (c Color) IsBackground() bool

func (Color) IsLight

func (c Color) IsLight() bool

func (Color) String

func (c Color) String(force ...bool) string

type Formatter

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

func New

func New(formats ...string) *Formatter

func (*Formatter) Add

func (f *Formatter) Add(formats ...string) *Formatter

func (*Formatter) AddBg

func (f *Formatter) AddBg(name string) *Formatter

func (*Formatter) AddColor

func (f *Formatter) AddColor(name string) *Formatter

func (*Formatter) AddFg

func (f *Formatter) AddFg(name string) *Formatter

func (*Formatter) AddStyle

func (f *Formatter) AddStyle(name string) *Formatter

func (*Formatter) Background

func (f *Formatter) Background() Color

func (*Formatter) Foreground

func (f *Formatter) Foreground() Color

func (*Formatter) Format

func (f *Formatter) Format(str string) string

func (*Formatter) RemoveBg

func (f *Formatter) RemoveBg() *Formatter

func (*Formatter) RemoveFg added in v1.0.1

func (f *Formatter) RemoveFg() *Formatter

func (*Formatter) RemoveStyle

func (f *Formatter) RemoveStyle(name string) *Formatter

func (*Formatter) Reset

func (f *Formatter) Reset() *Formatter

func (*Formatter) String

func (f *Formatter) String() string

func (*Formatter) Styles

func (f *Formatter) Styles() []Style

type Style

type Style int
const (
	Normal    Style = 0
	Bold      Style = 1
	Italic    Style = 3
	Underline Style = 4
	Blink     Style = 5
	Inverted  Style = 7
	Crossed   Style = 9
	Cancel    Style = 20
)

func StyleOf

func StyleOf(name string) Style

func (Style) IsCancel

func (st Style) IsCancel() bool

func (Style) String

func (st Style) String() string

Jump to

Keyboard shortcuts

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