Documentation ¶
Overview ¶
Package color is a Go library to render ANSI escape color sequences.
Index ¶
- func Error(message string) string
- func Info(message string) string
- func Notice(message string) string
- func Warn(message string) string
- type Code
- type EffectCode
- type Effector
- func (e *Effector) ExportConfig() EffectorConfig
- func (e *Effector) Render(s string) string
- func (e *Effector) SetBG256Color(color int)
- func (e *Effector) SetBGColor(color Code)
- func (e *Effector) SetBGRGBColor(red int, green int, blue int)
- func (e *Effector) SetEffect(code ...EffectCode)
- func (e *Effector) SetFG256Color(color int)
- func (e *Effector) SetFGColor(color Code)
- func (e *Effector) SetFGRGBColor(red int, green int, blue int)
- type EffectorConfig
- type Palette
- type PaletteConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EffectCode ¶
type EffectCode int
const ( Reset EffectCode = iota Bold Faint Italic Underline SlowBlink RapidBlink ReverseVideo Conceal CrossedOut )
func ParseEffectCode ¶
func ParseEffectCode(s string) (EffectCode, error)
func (EffectCode) String ¶
func (c EffectCode) String() string
type Effector ¶
type Effector struct { Enclose bool // contains filtered or unexported fields }
func GenerateEffector ¶
func GenerateEffector(config EffectorConfig) (*Effector, error)
func NewEffector ¶
func NewEffector() *Effector
func (*Effector) ExportConfig ¶
func (e *Effector) ExportConfig() EffectorConfig
func (*Effector) SetBG256Color ¶
func (*Effector) SetBGColor ¶
func (*Effector) SetEffect ¶
func (e *Effector) SetEffect(code ...EffectCode)
func (*Effector) SetFG256Color ¶
func (*Effector) SetFGColor ¶
type EffectorConfig ¶
type EffectorConfig struct { Effects []string `json:"effects"` Foreground interface{} `json:"foreground"` Background interface{} `json:"background"` }
type Palette ¶
type Palette struct {
// contains filtered or unexported fields
}
func GeneratePalette ¶
func GeneratePalette(config PaletteConfig) (*Palette, error)
func NewPalette ¶
func NewPalette() *Palette
func (*Palette) ExportConfig ¶
func (p *Palette) ExportConfig() PaletteConfig
func (*Palette) SetEffector ¶
type PaletteConfig ¶
type PaletteConfig struct {
Effectors map[string]EffectorConfig `json:"effectors"`
}
Click to show internal directories.
Click to hide internal directories.