Documentation ¶
Index ¶
- Constants
- func Apply(s string, ansi ...ANSI) string
- type ANSI
- func Color3BitB(c RGB3Bit) ANSI
- func Color3BitF(c RGB3Bit) ANSI
- func Color8BitB(c RGB8Bit) ANSI
- func Color8BitF(c RGB8Bit) ANSI
- func Column(col uint) ANSI
- func Down(n uint) ANSI
- func EraseDisplay(m EraseMode) ANSI
- func EraseLine(m EraseMode) ANSI
- func FullColorB(r, g, b uint8) ANSI
- func FullColorF(r, g, b uint8) ANSI
- func Left(n uint) ANSI
- func NextLine(n uint) ANSI
- func Position(row, col uint) ANSI
- func PreviousLine(n uint) ANSI
- func Right(n uint) ANSI
- func ScrollDown(n int) ANSI
- func ScrollUp(n int) ANSI
- func Up(n uint) ANSI
- type Builder
- func (builder *Builder) BlackB() *Builder
- func (builder *Builder) BlackF() *Builder
- func (builder *Builder) BlinkRapid() *Builder
- func (builder *Builder) BlinkSlow() *Builder
- func (builder *Builder) BlueB() *Builder
- func (builder *Builder) BlueF() *Builder
- func (builder *Builder) Bold() *Builder
- func (builder *Builder) Color3BitB(c RGB3Bit) *Builder
- func (builder *Builder) Color3BitF(c RGB3Bit) *Builder
- func (builder *Builder) Color8BitB(c RGB8Bit) *Builder
- func (builder *Builder) Color8BitF(c RGB8Bit) *Builder
- func (builder *Builder) Column(col uint) *Builder
- func (builder *Builder) Conceal() *Builder
- func (builder *Builder) CrossOut() *Builder
- func (builder *Builder) CyanB() *Builder
- func (builder *Builder) CyanF() *Builder
- func (builder *Builder) DefaultB() *Builder
- func (builder *Builder) DefaultF() *Builder
- func (builder *Builder) Down(n uint) *Builder
- func (builder *Builder) Encircle() *Builder
- func (builder *Builder) EraseDisplay(m EraseMode) *Builder
- func (builder *Builder) EraseLine(m EraseMode) *Builder
- func (builder *Builder) Faint() *Builder
- func (builder *Builder) Frame() *Builder
- func (builder *Builder) FullColorB(r, g, b uint8) *Builder
- func (builder *Builder) FullColorF(r, g, b uint8) *Builder
- func (builder *Builder) GreenB() *Builder
- func (builder *Builder) GreenF() *Builder
- func (builder *Builder) Hide() *Builder
- func (builder *Builder) Inverse() *Builder
- func (builder *Builder) Italic() *Builder
- func (builder *Builder) Left(n uint) *Builder
- func (builder *Builder) LightBlackB() *Builder
- func (builder *Builder) LightBlackF() *Builder
- func (builder *Builder) LightBlueB() *Builder
- func (builder *Builder) LightBlueF() *Builder
- func (builder *Builder) LightCyanB() *Builder
- func (builder *Builder) LightCyanF() *Builder
- func (builder *Builder) LightGreenB() *Builder
- func (builder *Builder) LightGreenF() *Builder
- func (builder *Builder) LightMagentaB() *Builder
- func (builder *Builder) LightMagentaF() *Builder
- func (builder *Builder) LightRedB() *Builder
- func (builder *Builder) LightRedF() *Builder
- func (builder *Builder) LightWhiteB() *Builder
- func (builder *Builder) LightWhiteF() *Builder
- func (builder *Builder) LightYellowB() *Builder
- func (builder *Builder) LightYellowF() *Builder
- func (builder *Builder) MagentaB() *Builder
- func (builder *Builder) MagentaF() *Builder
- func (builder *Builder) NextLine(n uint) *Builder
- func (builder *Builder) Overline() *Builder
- func (builder *Builder) Position(row, col uint) *Builder
- func (builder *Builder) PreviousLine(n uint) *Builder
- func (builder *Builder) RGB3BitB(r, g, b uint8) *Builder
- func (builder *Builder) RGB3BitF(r, g, b uint8) *Builder
- func (builder *Builder) RGB8BitB(r, g, b uint8) *Builder
- func (builder *Builder) RGB8BitF(r, g, b uint8) *Builder
- func (builder *Builder) RedB() *Builder
- func (builder *Builder) RedF() *Builder
- func (builder *Builder) Report() *Builder
- func (builder *Builder) Restore() *Builder
- func (builder *Builder) Right(n uint) *Builder
- func (builder *Builder) Save() *Builder
- func (builder *Builder) ScrollDown(n int) *Builder
- func (builder *Builder) ScrollUp(n int) *Builder
- func (builder *Builder) Show() *Builder
- func (builder *Builder) Underline() *Builder
- func (builder *Builder) Up(n uint) *Builder
- func (builder *Builder) WhiteB() *Builder
- func (builder *Builder) WhiteF() *Builder
- func (builder *Builder) With(a ...ANSI) *Builder
- func (builder *Builder) YellowB() *Builder
- func (builder *Builder) YellowF() *Builder
- type EraseMode
- type RGB3Bit
- type RGB8Bit
Constants ¶
const Reset string = "\x1b[0m"
Reset resets SGR effect.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ANSI ¶
type ANSI interface { fmt.Stringer // With adapts given ANSIs. With(...ANSI) ANSI // Apply wraps given string in ANSI. Apply(string) string }
ANSI represents ANSI escape code.
var ( // EraseModes is a list of EraseMode. EraseModes struct { // All erase all. All EraseMode // Head erase to head. Head EraseMode // Tail erase to tail. Tail EraseMode } // Save saves the cursor position. Save ANSI // Restore restores the cursor position. Restore ANSI // Hide hides the cursor. Hide ANSI // Show shows the cursor. Show ANSI // Report reports the cursor position. Report ANSI )
var ( // Bold set the text style to bold or increased intensity. Bold ANSI // Faint set the text style to faint. Faint ANSI // Italic set the text style to italic. Italic ANSI // Underline set the text style to underline. Underline ANSI // BlinkSlow set the text style to slow blink. BlinkSlow ANSI // BlinkRapid set the text style to rapid blink. BlinkRapid ANSI // Inverse swap the foreground color and background color. Inverse ANSI // Conceal set the text style to conceal. Conceal ANSI // CrossOut set the text style to crossed out. CrossOut ANSI // Frame set the text style to framed. Frame ANSI // Encircle set the text style to encircled. Encircle ANSI // Overline set the text style to overlined. Overline ANSI )
Style
var ( // DefaultF is the default color of foreground. DefaultF ANSI // Normal color BlackF ANSI RedF ANSI GreenF ANSI YellowF ANSI BlueF ANSI MagentaF ANSI CyanF ANSI WhiteF ANSI // Light color LightBlackF ANSI LightRedF ANSI LightGreenF ANSI LightYellowF ANSI LightBlueF ANSI LightMagentaF ANSI LightCyanF ANSI LightWhiteF ANSI )
Foreground color of text.
var ( // DefaultB is the default color of background. DefaultB ANSI // Normal color BlackB ANSI RedB ANSI GreenB ANSI YellowB ANSI BlueB ANSI MagentaB ANSI CyanB ANSI WhiteB ANSI // Light color LightBlackB ANSI LightRedB ANSI LightGreenB ANSI LightYellowB ANSI LightBlueB ANSI LightMagentaB ANSI LightCyanB ANSI LightWhiteB ANSI )
Background color of text.
func EraseDisplay ¶
EraseDisplay erases display by given EraseMode.
func PreviousLine ¶
PreviousLine moves up the cursor to head of a line.
type Builder ¶
type Builder struct {
ANSI ANSI
}
Builder is a lightweight syntax to construct customized ANSI.
var EmptyBuilder *Builder
EmptyBuilder is an initialized Builder.
func NewBuilder ¶
NewBuilder creates a Builder from existing ANSI.
func (*Builder) BlinkRapid ¶
BlinkRapid is a syntax for BlinkRapid.
func (*Builder) Color3BitB ¶
Color3BitB is a syntax for Color3BitB.
func (*Builder) Color3BitF ¶
Color3BitF is a syntax for Color3BitF.
func (*Builder) Color8BitB ¶
Color8BitB is a syntax for Color8BitB.
func (*Builder) Color8BitF ¶
Color8BitF is a syntax for Color8BitF.
func (*Builder) EraseDisplay ¶
EraseDisplay is a syntax for EraseDisplay.
func (*Builder) FullColorB ¶
FullColorB is a syntax for FullColorB.
func (*Builder) FullColorF ¶
FullColorF is a syntax for FullColorF.
func (*Builder) LightBlackB ¶
LightBlackB is a syntax for LightBlackB.
func (*Builder) LightBlackF ¶
LightBlackF is a syntax for LightBlueF.
func (*Builder) LightBlueB ¶
LightBlueB is a syntax for LightBlueB.
func (*Builder) LightBlueF ¶
LightBlueF is a syntax for LightBlueF.
func (*Builder) LightCyanB ¶
LightCyanB is a syntax for LightCyanB.
func (*Builder) LightCyanF ¶
LightCyanF is a syntax for LightCyanF.
func (*Builder) LightGreenB ¶
LightGreenB is a syntax for LightGreenB.
func (*Builder) LightGreenF ¶
LightGreenF is a syntax for LightGreenF.
func (*Builder) LightMagentaB ¶
LightMagentaB is a syntax for LightMagentaB.
func (*Builder) LightMagentaF ¶
LightMagentaF is a syntax for LightMagentaF.
func (*Builder) LightWhiteB ¶
LightWhiteB is a syntax for LightWhiteB.
func (*Builder) LightWhiteF ¶
LightWhiteF is a syntax for LightWhiteF.
func (*Builder) LightYellowB ¶
LightYellowB is a syntax for LightYellowB.
func (*Builder) LightYellowF ¶
LightYellowF is a syntax for LightYellowF.
func (*Builder) PreviousLine ¶
PreviousLine is a syntax for PreviousLine.
func (*Builder) ScrollDown ¶
ScrollDown is a syntax for ScrollDown.
type RGB3Bit ¶
type RGB3Bit uint8
RGB3Bit is a 3bit RGB color.
func NewRGB3Bit ¶
NewRGB3Bit create a RGB3Bit from given RGB.