Documentation ¶
Overview ¶
Package ansi provides utility functions to apply ANSI escape sequences to strings.
Index ¶
- Constants
- func Black(str string, mod modifier) string
- func Blue(str string, mod modifier) string
- func Cyan(str string, mod modifier) string
- func Disable()
- func Enable()
- func Green(str string, mod modifier) string
- func Magenta(str string, mod modifier) string
- func Red(str string, mod modifier) string
- func White(str string, mod modifier) string
- func Yellow(str string, mod modifier) string
Examples ¶
Constants ¶
View Source
const ( None = 0 Light modifier = 1 << iota Bold Italic Underline Blink )
Text modifiers.
Variables ¶
This section is empty.
Functions ¶
func Black ¶
Black returns a string enclosed in the ANSI escape code for black text.
Example ¶
fmt.Println(Black("This text will be black", None))
Output:
Example (Blink) ¶
fmt.Println(Black("This text will be blinking and black", Blink))
Output:
Example (Bold) ¶
fmt.Println(Black("This text will be bold and black", Bold))
Output:
Example (Combined) ¶
fmt.Println(Black("This text will be bold, underlined and black", Bold|Underline))
Output:
Example (Italic) ¶
fmt.Println(Black("This text will be italic and black", Italic))
Output:
Example (Light) ¶
fmt.Println(Black("This text will be light black", Light))
Output:
Example (Underline) ¶
fmt.Println(Black("This text will be underlined and black", Underline))
Output:
func Disable ¶
func Disable()
Disable disabled the use of ANSI escape sequences in calls to ansi functions. In short, no string manipulations will be done by the ansi functions.
func Enable ¶
func Enable()
Enable enables the use of ANSI escape sequences in calls to ansi functions.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.