Documentation
¶
Index ¶
- Constants
- func Background(v ColorIndex) string
- func BackgroundBlack() string
- func BackgroundGray(l byte) string
- func BackgroundRGB(r, g, b byte) string
- func BackgroundWhite() string
- func Foreground(v ColorIndex) string
- func ForegroundBlack() string
- func ForegroundGray(l byte) string
- func ForegroundRGB(r, g, b byte) string
- func ForegroundWhite() string
- type ColorIndex
- type OutputState
- type Style
Constants ¶
const ( Reset = "\x1b[0m" Bold = "\x1b[1m" Dim = "\x1b[2m" Italic = "\x1b[3m" Underline = "\x1b[4m" Blinking = "\x1b[5m" Inverse = "\x1b[7m" Hidden = "\x1b[8m" StrikeThrough = "\x1b[9m" )
const Black = ColorIndex(0)
const White = ColorIndex(15)
Variables ¶
This section is empty.
Functions ¶
func Background ¶
func Background(v ColorIndex) string
func BackgroundBlack ¶
func BackgroundBlack() string
func BackgroundGray ¶
func BackgroundRGB ¶
func BackgroundWhite ¶
func BackgroundWhite() string
func Foreground ¶
func Foreground(v ColorIndex) string
func ForegroundBlack ¶
func ForegroundBlack() string
func ForegroundGray ¶
func ForegroundRGB ¶
func ForegroundWhite ¶
func ForegroundWhite() string
Types ¶
type ColorIndex ¶
type ColorIndex uint8
An index into a standard 256-color ANSI palette
func Gray ¶
func Gray(l byte) ColorIndex
Gray maps luminance to an index in standard ANSI 256-color palette
input values [0..ff] are snapped to - 0x00 - 0x0A - 0x14 - 0x1E - 0x28 - 0x33 - 0x3D - 0x47 - 0x51 - 0x5B - 0x66 - 0x70 - 0x7A - 0x84 - 0x8E - 0x99 - 0xA3 - 0xAD - 0xB7 - 0xC1 - 0xCC - 0xD6 - 0xE0 - 0xEA - 0xF4 - 0xFF
func RGB ¶
func RGB(r, g, b byte) ColorIndex
RGB maps rgb color to an index in standard ANSI 256-color palette
input color component values [0..ff] are snapped to - 0x00 - 0x33 - 0x66 - 0x99 - 0xcc - 0xff
type OutputState ¶
type OutputState struct {
// contains filtered or unexported fields
}
OutputState allows restoring terminal to its original state
func SetupOutput ¶
func SetupOutput(output *os.File) *OutputState
SetupOutput prepares/validates an output to support virtual terminal escape sequences
Windows hosts: - configures terminal for UTF-8 output (65001 codepage) - enables virtual terminal processing mode
Other hosts (linux, bsd): - checks for termios support
Returns: - ok: indicates if the output supports virtual terminal escape sequences (will fail for regular files) - cleanup: to be used for restoring the output to its original state
func SetupStdout ¶
func SetupStdout() *OutputState
SetupStdout configures os.Stdout to support virtual terminal escape sequences
func (*OutputState) Restore ¶
func (s *OutputState) Restore()
func (*OutputState) Supported ¶ added in v0.5.4
func (s *OutputState) Supported() bool