Documentation
¶
Index ¶
- type ANSIColorCode
- type ColorModifier
- type Style
- func (c Style) Color() ANSIColorCode
- func (c Style) ColorModifiers() []ColorModifier
- func (c *Style) SetColor(color ANSIColorCode)
- func (c *Style) SetColorModifiers(cm ...ColorModifier)
- func (c *Style) SetStyleModifiers(sm ...StyleModifier)
- func (c Style) String() string
- func (c Style) StyleModifiers() []StyleModifier
- type StyleModifier
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ANSIColorCode ¶
type ANSIColorCode uint8
ANSIColorCode represents one of the 8 standard ANSI color codes
const ( Black ANSIColorCode = 30 Red ANSIColorCode = 31 Green ANSIColorCode = 32 Yellow ANSIColorCode = 33 Blue ANSIColorCode = 34 Purple ANSIColorCode = 35 Cyan ANSIColorCode = 36 White ANSIColorCode = 37 Default ANSIColorCode = 0 )
type ColorModifier ¶
type ColorModifier uint8
ColorModifier changes whether the color is for the foreground or background and whether or not it's the intense variant
const ( Foreground ColorModifier = 0 Background ColorModifier = 10 Intense ColorModifier = 60 )
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style represents a set of print modifications
func (Style) Color ¶
func (c Style) Color() ANSIColorCode
Return the current color, or Default if nil
func (Style) ColorModifiers ¶
func (c Style) ColorModifiers() []ColorModifier
ColorModifiers returns the normalized (sorted, deduplicated) list of color modifiers
func (*Style) SetColor ¶
func (c *Style) SetColor(color ANSIColorCode)
SetColor sets the color. The underlying color is a pointer, and is set to nil if the passed color is Default
func (*Style) SetColorModifiers ¶
func (c *Style) SetColorModifiers(cm ...ColorModifier)
SetColorModifiers sorts and deduplicates the list of color modifiers before setting it
func (*Style) SetStyleModifiers ¶
func (c *Style) SetStyleModifiers(sm ...StyleModifier)
SetStyleModifiers sorts and deduplicates the list of style modifiers before setting it
func (Style) String ¶
String implements fmt.Stringer and outputs the ANSI control code for this style
func (Style) StyleModifiers ¶
func (c Style) StyleModifiers() []StyleModifier
StyleModifiers returns the normalized (sorted, deduplicated) list of style modifiers
type StyleModifier ¶
type StyleModifier uint8
StyleModifier set things like bold, italic, etc. Not all StyleModifiers are supported by all systems
const ( Normal StyleModifier = 0 Bold StyleModifier = 1 Italic StyleModifier = 3 Underline StyleModifier = 4 Strikethrough StyleModifier = 9 )
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer implements io.Writer.