package aec
import "github.com/morikuni/aec"
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 NewBuilder(a ...ANSI) *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.
Functions ¶
func Apply ¶
Apply wraps given string in ANSIs.
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 Color3BitB ¶
Color3BitB set the background color of text.
func Color3BitF ¶
Color3BitF set the foreground color of text.
func Color8BitB ¶
Color8BitB set the background color of text.
func Color8BitF ¶
Color8BitF set the foreground color of text.
func Column ¶
Column set the cursor position to a given column.
func Down ¶
Down moves down the cursor.
func EraseDisplay ¶
EraseDisplay erases display by given EraseMode.
func EraseLine ¶
EraseLine erases lines by given EraseMode.
func FullColorB ¶
FullColorB set the foreground color of text.
func FullColorF ¶
FullColorF set the foreground color of text.
func Left ¶
Left moves left the cursor.
func NextLine ¶
NextLine moves down the cursor to head of a line.
func Position ¶
Position set the cursor position to a given absolute position.
func PreviousLine ¶
PreviousLine moves up the cursor to head of a line.
func Right ¶
Right moves right the cursor.
func ScrollDown ¶
ScrollDown scrolls down the page.
func ScrollUp ¶
ScrollUp scrolls up the page.
func Up ¶
Up moves up the cursor.
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) BlackB ¶
BlackB is a syntax for BlackB.
func (*Builder) BlackF ¶
BlackF is a syntax for BlackF.
func (*Builder) BlinkRapid ¶
BlinkRapid is a syntax for BlinkRapid.
func (*Builder) BlinkSlow ¶
BlinkSlow is a syntax for BlinkSlow.
func (*Builder) BlueB ¶
BlueB is a syntax for BlueB.
func (*Builder) BlueF ¶
BlueF is a syntax for BlueF.
func (*Builder) Bold ¶
Bold is a syntax for Bold.
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) Column ¶
Column is a syntax for Column.
func (*Builder) Conceal ¶
Conceal is a syntax for Conceal.
func (*Builder) CrossOut ¶
CrossOut is a syntax for CrossOut.
func (*Builder) CyanB ¶
CyanB is a syntax for CyanB.
func (*Builder) CyanF ¶
CyanF is a syntax for CyanF.
func (*Builder) DefaultB ¶
DefaultB is a syntax for DefaultB.
func (*Builder) DefaultF ¶
DefaultF is a syntax for DefaultF.
func (*Builder) Down ¶
Down is a syntax for Down.
func (*Builder) Encircle ¶
Encircle is a syntax for Encircle.
func (*Builder) EraseDisplay ¶
EraseDisplay is a syntax for EraseDisplay.
func (*Builder) EraseLine ¶
EraseLine is a syntax for EraseLine.
func (*Builder) Faint ¶
Faint is a syntax for Faint.
func (*Builder) Frame ¶
Frame is a syntax for Frame.
func (*Builder) FullColorB ¶
FullColorB is a syntax for FullColorB.
func (*Builder) FullColorF ¶
FullColorF is a syntax for FullColorF.
func (*Builder) GreenB ¶
GreenB is a syntax for GreenB.
func (*Builder) GreenF ¶
GreenF is a syntax for GreenF.
func (*Builder) Hide ¶
Hide is a syntax for Hide.
func (*Builder) Inverse ¶
Inverse is a syntax for Inverse.
func (*Builder) Italic ¶
Italic is a syntax for Italic.
func (*Builder) Left ¶
Left is a syntax for Left.
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) LightRedB ¶
LightRedB is a syntax for LightRedB.
func (*Builder) LightRedF ¶
LightRedF is a syntax for LightRedF.
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) MagentaB ¶
MagentaB is a syntax for MagentaB.
func (*Builder) MagentaF ¶
MagentaF is a syntax for MagentaF.
func (*Builder) NextLine ¶
NextLine is a syntax for NextLine.
func (*Builder) Overline ¶
Overline is a syntax for Overline.
func (*Builder) Position ¶
Position is a syntax for Position.
func (*Builder) PreviousLine ¶
PreviousLine is a syntax for PreviousLine.
func (*Builder) RGB3BitB ¶
RGB3BitB is a syntax for Color3BitB with NewRGB3Bit.
func (*Builder) RGB3BitF ¶
RGB3BitF is a syntax for Color3BitF with NewRGB3Bit.
func (*Builder) RGB8BitB ¶
RGB8BitB is a syntax for Color8BitB with NewRGB8Bit.
func (*Builder) RGB8BitF ¶
RGB8BitF is a syntax for Color8BitF with NewRGB8Bit.
func (*Builder) RedB ¶
RedB is a syntax for RedB.
func (*Builder) RedF ¶
RedF is a syntax for RedF.
func (*Builder) Report ¶
Report is a syntax for Report.
func (*Builder) Restore ¶
Restore is a syntax for Restore.
func (*Builder) Right ¶
Right is a syntax for Right.
func (*Builder) Save ¶
Save is a syntax for Save.
func (*Builder) ScrollDown ¶
ScrollDown is a syntax for ScrollDown.
func (*Builder) ScrollUp ¶
ScrollUp is a syntax for ScrollUp.
func (*Builder) Show ¶
Show is a syntax for Show.
func (*Builder) Underline ¶
Underline is a syntax for Underline.
func (*Builder) Up ¶
Up is a syntax for Up.
func (*Builder) WhiteB ¶
WhiteB is a syntax for WhiteB.
func (*Builder) WhiteF ¶
WhiteF is a syntax for WhiteF.
func (*Builder) With ¶
With is a syntax for With.
func (*Builder) YellowB ¶
YellowB is a syntax for YellowB.
func (*Builder) YellowF ¶
YellowF is a syntax for YellowF.
type EraseMode ¶
type EraseMode uint
EraseMode is listed in a variable EraseModes.
type RGB3Bit ¶
type RGB3Bit uint8
RGB3Bit is a 3bit RGB color.
func NewRGB3Bit ¶
NewRGB3Bit create a RGB3Bit from given RGB.
type RGB8Bit ¶
type RGB8Bit uint8
RGB8Bit is a 8bit RGB color.
func NewRGB8Bit ¶
NewRGB8Bit create a RGB8Bit from given RGB.
Source Files ¶
aec.go ansi.go builder.go sgr.go
Directories ¶
Path | Synopsis |
---|---|
checkansi |
- Version
- v1.0.0 (latest)
- Published
- Jan 13, 2017
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 3 weeks ago –
Tools for package owners.