Documentation
¶
Index ¶
- Constants
- Variables
- func Background8Bit(color int) string
- func Background24Bit(r, g, b int) string
- func CursorBackward(n int) string
- func CursorDown(n int) string
- func CursorForward(n int) string
- func CursorHorizontalAbsolute(n int) string
- func CursorNextLineN(n int) string
- func CursorPosition(row, column int) string
- func CursorPreviousLineN(n int) string
- func CursorUp(n int) string
- func Foreground8Bit(color int) string
- func Foreground24Bit(r, g, b int) string
- func ScrollDownN(n int) string
- func ScrollUpN(n int) string
- func StripCodes(input string) string
Constants ¶
const ( ANSIBlack = iota ANSIRed ANSIGreen ANSIYellow ANSIBlue ANSIMagenta ANSICyan ANSIWhite ANSIBrightBlack ANSIBrightRed ANSIBrightGreen ANSIBrightYellow ANSIBrightBlue ANSIBrightMagenta ANSIBrightCyan ANSIBrightWhite )
ANSI color codes.
const ( // Clears from the cursor to the end of the screen. ClearFromCursorToEndScreen = csi + "0J" // Clears from the cursor to the beginning of the screen. ClearFromCursorToBeginScreen = csi + "1J" // Clear the entire screen. ClearScreen = csi + "2J" // Clear from the cursor to the end of the row (line). ClearToEnd = csi + "K" // Clear from the cursor to the beginning of the row (line). ClearToBegin = csi + "1K" // Clear the entire row (line). ClearLine = csi + "2K" // Clear the entire row (line) and move the cursor to the start of the row (line). ClearLineReset = csi + "2k\r" // Save the cursor position SaveCursorPos = csi + "s" // Restore the cursor position RestoreCursorPos = csi + "u" // Hide the cursor HideCursor = csi + "?25l" // Show the cursor ShowCursor = csi + "?25h" Reset = csi + "0m" Bold = csi + "1m" Dim = csi + "2m" Italic = csi + "3m" Underline = csi + "4m" SlowBlink = csi + "5m" RapidBlink = csi + "6m" Reverse = csi + "7m" Hidden = csi + "8m" Strike = csi + "9m" DoubleUnderline = csi + "21m" ResetIntensity = csi + "22m" ResetItalic = csi + "23m" ResetUnderline = csi + "24m" ResetBlink = csi + "25m" ResetReverse = csi + "27m" ResetHidden = csi + "28m" ResetStrike = csi + "29m" Black = csi + "30m" Red = csi + "31m" Green = csi + "32m" Yellow = csi + "33m" Blue = csi + "34m" Magenta = csi + "35m" Cyan = csi + "36m" White = csi + "37m" BlackBg = csi + "40m" RedBg = csi + "41m" GreenBg = csi + "42m" YellowBg = csi + "43m" BlueBg = csi + "44m" MagentaBg = csi + "45m" CyanBg = csi + "46m" WhiteBg = csi + "47m" DefaultBg = csi + "49m" IntenseBlack = csi + "90m" IntenseRed = csi + "91m" IntenseGreen = csi + "92m" IntenseYellow = csi + "93m" IntenseBlue = csi + "94m" IntenseMagenta = csi + "95m" IntenseCyan = csi + "96m" IntenseWhite = csi + "97m" IntenseBlackBg = csi + "100m" IntenseRedBg = csi + "101m" IntenseGreenBg = csi + "102m" IntenseYellowBg = csi + "103m" IntenseBlueBg = csi + "104m" IntenseMagentaBg = csi + "105m" IntenseCyanBg = csi + "106m" IntenseWhiteBg = csi + "107m" )
Variables ¶
var ( // Move the cursor to the top left corner of screen CursorTopLeft = CursorPosition(1, 1) // Move the cursor to beginning of the row (line). CursorLineBegin = CursorHorizontalAbsolute(1) // Move cursor down one row (line). CursorNextLine = CursorNextLineN(1) // Move cursor up one row (line). CursorPreviousLine = CursorPreviousLineN(1) // Scroll the screen up one row (line). ScrollNext = ScrollUpN(1) // Scroll the screen down one row (line). ScrollPrev = ScrollDownN(1) )
Functions ¶
func Background8Bit ¶
8-bit background color color must be between 0 and 255 othrewise it will return an empty string
func Background24Bit ¶
24-bit background color r, g, b must be between 0 and 255 otherwise it will return an empty string
func CursorBackward ¶
CursorBackward moves the cursor backward n columns.
func CursorForward ¶
CursorForward moves the cursor forward n columns.
func CursorHorizontalAbsolute ¶
CursorHorizontalAbsolute moves the cursor to the nth column.
func CursorNextLineN ¶
CursorNextLine moves the cursor down n rows (lines).
func CursorPosition ¶
CursorPosition moves the cursor to the specified position of row (line) and column.
func CursorPreviousLineN ¶
CursorPreviousLine moves the cursor up n rows (lines).
func Foreground8Bit ¶
8-bit foreground color color must be between 0 and 255 otherwise it will return an empty string
func Foreground24Bit ¶
24-bit foreground color r, g, b must be between 0 and 255 otherwise it will return an empty string
func ScrollDownN ¶
ScrollDownN scrolls the screen down n rows (lines).
func StripCodes ¶
StripCodes removes all ANSI escape codes from the input string.
Types ¶
This section is empty.