style

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionSet   = 1
	ActionUnset = 2
)

Variables

View Source
var (
	ErrNotFound       = errors.New("console: style not found")
	ErrDuplicateStyle = errors.New("console: Register called twice")
)

Functions

func MustRegister

func MustRegister(name string, style Style)

func Register

func Register(name string, style Style) error

Types

type Color

type Color string
const (
	Black   Color = "0"
	Red     Color = "1"
	Green   Color = "2"
	Yellow  Color = "3"
	Blue    Color = "4"
	Magenta Color = "5"
	Cyan    Color = "6"
	White   Color = "7"
	Default Color = "9"
)

func (Color) Apply

func (c Color) Apply(action int) string

type Option

type Option string
const (
	Bold       Option = "122"
	Underscore Option = "424"
	Blink      Option = "525"
	Reverse    Option = "727"
	Conseal    Option = "828"
)

func (Option) Apply

func (o Option) Apply(action int) string

type Style

type Style struct {
	Background Color
	Foreground Color
	Options    []Option
}

func Empty

func Empty() Style

func Find

func Find(name string) (Style, error)

func (Style) Apply

func (s Style) Apply(msg string) string

func (Style) Set

func (s Style) Set(action int) string

Jump to

Keyboard shortcuts

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